services: # Next.js Application (Staging Mode) app: build: context: ./proto dockerfile: Dockerfile target: runner args: - NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://stage.mozdit.hu} - NEXT_PUBLIC_DEPLOY_ENV=staging - DEPLOY_VERSION=${DEPLOY_VERSION:-unversioned} container_name: mozdit-app-staging ports: - "127.0.0.1:8081:3000" # Belső port — csak nginx-en keresztül elérhető environment: - NODE_ENV=production # MITHOME-136: PostgreSQL (the site's own database on the shared server). # Built from POSTGRES_PASSWORD so the secret lives in one place; no # fallback — a missing password must fail the deploy loudly. Use a # URL-safe password (e.g. `openssl rand -hex 32`). - DATABASE_URI=postgresql://${POSTGRES_USER:-mozdit_web}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@postgres:5432/mozdit_web # No fallback either (MITHOME-97): Payload refuses to start without a real # secret ("missing secret key"), which is exactly what we want here. - PAYLOAD_SECRET=${PAYLOAD_SECRET} - NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://stage.mozdit.hu} - NEXT_PUBLIC_DEPLOY_ENV=staging - NEXT_PUBLIC_COMPANY_NAME=${NEXT_PUBLIC_COMPANY_NAME:-mozdIT Bt.} - NEXT_PUBLIC_CONTACT_EMAIL=${NEXT_PUBLIC_CONTACT_EMAIL:-info@mozdit.hu} volumes: # Payload helyi upload storage (proto/src/collections/Media.ts) — futásidőben # a konténer WORKDIR-je (/app) alatti media/ mappába ír. Named volume nélkül # a `deploy.sh` minden újratelepítéskor (--force-recreate) elveszítené a # korábban feltöltött logókat/képeket (MITHOME-97). - media_data_staging:/app/media depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/api/health"] interval: 30s timeout: 10s retries: 3 start_period: 60s networks: - mozdit-network-staging restart: always logging: driver: "json-file" options: max-size: "10m" max-file: "3" # PostgreSQL (MITHOME-136) — llmdev Docker spec: healthcheck, log limit, # memory limit, no host port (the app reaches it on the project network). postgres: image: postgres:16-alpine container_name: mozdit-postgres-staging environment: - POSTGRES_DB=mozdit_web - POSTGRES_USER=${POSTGRES_USER:-mozdit_web} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} volumes: - postgres_data_staging:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-mozdit_web} -d mozdit_web"] interval: 10s timeout: 5s retries: 5 start_period: 20s deploy: resources: limits: memory: 1G logging: driver: "json-file" options: max-size: "100m" max-file: "3" networks: - mozdit-network-staging restart: unless-stopped # MongoDB — MITHOME-136: no longer used by the app. Kept for one release as # the rollback path and the source of the one-off content transfer # (proto/scripts/transfer-content.ts); remove afterwards (tasks 4.3). mongodb: image: mongo:7.0 container_name: mozdit-mongodb-staging ports: - "127.0.0.1:27019:27017" # Belső port, nem ütközik a prod 27018-cal environment: - MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER:-admin} # No weak default password: a missing value must fail the container loudly. - MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD} - MONGO_INITDB_DATABASE=mozdit volumes: - mongodb_data_staging:/data/db networks: - mozdit-network-staging restart: always volumes: postgres_data_staging: driver: local mongodb_data_staging: driver: local media_data_staging: driver: local networks: mozdit-network-staging: driver: bridge