Fix some for docker

This commit is contained in:
M.Lotfi
2026-10-14 08:48:15 +03:30
parent d6d33d31c3
commit 3f033071f7
3 changed files with 16 additions and 6 deletions
+2 -1
View File
@@ -3,7 +3,8 @@ POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=goldbank
# Host port exposed for PostgreSQL (used by docker-compose db service)
# Host port for PostgreSQL. Each copy of this stack on the same machine
# must use a different port (the apps talk to hostname "db", not this port).
EXTERNAL_DB_PORT=5432
# Prisma connection string (inside Docker network use hostname "db")
+7
View File
@@ -33,6 +33,13 @@ DATABASE_URL=postgresql://goldbank:...@db:5432/goldbank?schema=public
PORT=3000
```
A second copy on the **same server** is a separate Dokploy application (its own
domains, passwords, and `JWT_SECRET`). Do not set `container_name` in this file:
those names are global in Docker, and a fixed `goldbank_db` collides with the
first copy. Give the second app its own `EXTERNAL_DB_PORT` (for example `5434`
if `5433` is already taken). Volumes stay separate because Dokploy uses a
different Compose project name for each application.
## Domains (container ports)
| Service | Domain | Port |
+7 -5
View File
@@ -3,11 +3,17 @@
services:
db:
image: docker.arvancloud.ir/postgres:15-alpine
container_name: goldbank_db
# No container_name. Docker container names are global on the host, so a
# fixed name (goldbank_db) makes a second Dokploy app of this stack fail
# with "container name already in use". Compose names each container from
# the project name, which Dokploy sets uniquely per application.
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-goldbank}
# Host port only. The apps use hostname "db" inside the compose network.
# Two copies on one machine must publish different host ports; set
# EXTERNAL_DB_PORT on the second Dokploy app (5432 stays the local default).
ports:
- "${EXTERNAL_DB_PORT:-5432}:5432"
volumes:
@@ -23,7 +29,6 @@ services:
build:
context: ./apps/api
dockerfile: Dockerfile
container_name: goldbank_api
# Prisma connects on module init, so a not-yet-ready DB crash-loops the API.
depends_on:
db:
@@ -110,7 +115,6 @@ services:
build:
context: ./apps/admin-panel
dockerfile: Dockerfile
container_name: goldbank_admin_panel
# No host ports — Dokploy/Traefik routes by domain to container port 80
expose:
- "80"
@@ -122,7 +126,6 @@ services:
build:
context: ./apps/user-app
dockerfile: Dockerfile
container_name: goldbank_user_app
# No host ports — Dokploy/Traefik routes by domain to container port 80
expose:
- "80"
@@ -135,7 +138,6 @@ services:
build:
context: ./apps/user-app-v2
dockerfile: Dockerfile
container_name: goldbank_user_app_v2
expose:
- "80"
restart: unless-stopped