Files
tehran_taj/docker-compose.yml
T

131 lines
5.0 KiB
YAML

# No `version:` key — it is obsolete in Compose v2 and only prints a warning on
# every command, which made the delivery checklist's output noisy.
services:
db:
image: docker.arvancloud.ir/postgres:15-alpine
container_name: goldbank_db
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-goldbank}
ports:
- "${EXTERNAL_DB_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-goldbank}"]
interval: 5s
timeout: 5s
retries: 12
api:
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:
condition: service_healthy
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@db:5432/goldbank?schema=public}
- PORT=${PORT:-3000}
# Auth. Without these the API falls back to a well-known development
# secret, so set them in the deployment environment.
- JWT_SECRET=${JWT_SECRET:-}
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-}
- JWT_CUSTOMER_SECRET=${JWT_CUSTOMER_SECRET:-}
- JWT_CUSTOMER_EXPIRES_IN=${JWT_CUSTOMER_EXPIRES_IN:-}
# ⚠ DELIVERY ONLY — a fixed OTP that signs in ANY active customer.
# Empty/unset disables it, which is the correct state for production.
# See ISSUES REL-01. Must be exactly 4 digits to be typable in the apps.
- OTP_MASTER_CODE=${OTP_MASTER_CODE:-}
# SMS. All blank = messages are logged, not sent; the API still boots (D20).
- SMS_PROVIDER=${SMS_PROVIDER:-}
- SMS_TREZ_URL=${SMS_TREZ_URL:-}
- SMS_TREZ_USERNAME=${SMS_TREZ_USERNAME:-}
- SMS_TREZ_PASSWORD=${SMS_TREZ_PASSWORD:-}
- SMS_TREZ_SENDER_LINE=${SMS_TREZ_SENDER_LINE:-}
# Admin mobiles told when a customer completes their profile (D22).
# Blank = nobody is notified; the upload still succeeds.
- PROFILE_ADMIN_MOBILES=${PROFILE_ADMIN_MOBILES:-}
# Central IAM. Read at process start from this container only.
# Frontends compute callback URLs from the browser origin, so these
# never belong in a Vite build. Blank stays off (env.ts treats "").
- IAM_ENABLED=${IAM_ENABLED:-}
- IAM_ISSUER=${IAM_ISSUER:-}
- IAM_CLIENT_ID=${IAM_CLIENT_ID:-}
- IAM_CLIENT_SECRET=${IAM_CLIENT_SECRET:-}
- IAM_TENANT_ID=${IAM_TENANT_ID:-}
- IAM_TENANT_SLUG=${IAM_TENANT_SLUG:-}
- IAM_LOGIN_DELEGATION=${IAM_LOGIN_DELEGATION:-}
- IAM_HTTP_TIMEOUT_MS=${IAM_HTTP_TIMEOUT_MS:-}
- IAM_REDIRECT_URI=${IAM_REDIRECT_URI:-}
- IAM_REDIRECT_URIS=${IAM_REDIRECT_URIS:-}
- IAM_BROWSER_RETURN_URL=${IAM_BROWSER_RETURN_URL:-}
- IAM_POST_LOGOUT_REDIRECT_URI=${IAM_POST_LOGOUT_REDIRECT_URI:-}
- IAM_ALLOWED_RETURN_URLS=${IAM_ALLOWED_RETURN_URLS:-}
- IAM_ADMIN_REDIRECT_URI=${IAM_ADMIN_REDIRECT_URI:-}
- IAM_ADMIN_REDIRECT_URIS=${IAM_ADMIN_REDIRECT_URIS:-}
- IAM_ADMIN_BROWSER_RETURN_URL=${IAM_ADMIN_BROWSER_RETURN_URL:-}
- IAM_ADMIN_POST_LOGOUT_REDIRECT_URI=${IAM_ADMIN_POST_LOGOUT_REDIRECT_URI:-}
- IAM_ADMIN_ALLOWED_RETURN_URLS=${IAM_ADMIN_ALLOWED_RETURN_URLS:-}
- AUTH_SESSION_TRACKING=${AUTH_SESSION_TRACKING:-}
# No host ports — Dokploy/Traefik routes by domain to container port 3000
expose:
- "3000"
# Uploaded files (product images, etc.) land in storage/uploads inside the
# container. Without a volume they vanish on every recreate/redeploy, and
# every UploadedFile/ProductImage row created before that would then point
# at a URL that 404s.
volumes:
- api_uploads:/app/storage/uploads
restart: unless-stopped
# The bare name "api" is ambiguous on Dokploy's shared network (other stacks
# register it too), which made nginx dial the wrong containers. Use a unique alias.
networks:
default:
aliases:
- goldbank-api
admin-panel:
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"
restart: unless-stopped
depends_on:
- api
user-app:
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"
restart: unless-stopped
depends_on:
- api
# Same copy-only nginx pattern as user-app; map a separate Dokploy domain to this service.
user-app-v2:
build:
context: ./apps/user-app-v2
dockerfile: Dockerfile
container_name: goldbank_user_app_v2
expose:
- "80"
restart: unless-stopped
depends_on:
- api
volumes:
postgres_data:
api_uploads: