# Independent production configuration; do not merge with compose.yaml. name: wq-alpha-production x-backend: &backend image: wq-alpha-production-backend:${DEPLOY_TAG:-local} build: context: . dockerfile: Dockerfile.backend environment: DATABASE_URL: ${DATABASE_URL:?Set the Gitea DATABASE_URL secret} ADMIN_USERNAME: ${ADMIN_USERNAME:-admin} ADMIN_PASSWORD: ${ADMIN_PASSWORD:?Set ADMIN_PASSWORD} ENCRYPTION_KEY: ${ENCRYPTION_KEY:?Set ENCRYPTION_KEY} PUBLIC_ORIGIN: ${PUBLIC_ORIGIN:?Set the public HTTPS origin} WQ_EMAIL: ${WQ_EMAIL:?Set the Gitea WQ_EMAIL secret} WQ_PASSWORD: ${WQ_PASSWORD:?Set the Gitea WQ_PASSWORD secret} COOKIE_SECURE: "true" AI_REQUEST_LIMIT: ${AI_REQUEST_LIMIT:-12} AI_TOOL_LIMIT: ${AI_TOOL_LIMIT:-12} AI_OUTPUT_TOKENS: ${AI_OUTPUT_TOKENS:-4096} AI_TIMEOUT: ${AI_TIMEOUT:-180} WQ_BASE_URL: ${WQ_BASE_URL:-https://api.worldquantbrain.com} networks: - default - database services: backend: <<: *backend # Migration is run separately with all application writers stopped. command: [uvicorn, 'app.main:create_app', --factory, --host, 0.0.0.0, --port, '8000', --workers, '1', --proxy-headers] healthcheck: test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/health', timeout=3)"] interval: 10s timeout: 5s retries: 12 start_period: 20s stop_grace_period: 60s restart: unless-stopped migrate: <<: *backend profiles: [jobs] command: [alembic, upgrade, head] restart: 'no' web: image: wq-alpha-production-web:${DEPLOY_TAG:-local} build: context: . dockerfile: Dockerfile.frontend environment: SITE_ADDRESS: http://:80 ports: - '127.0.0.1:${WEB_PORT:-8112}:80' volumes: - caddy_data:/data - caddy_config:/config depends_on: backend: condition: service_healthy healthcheck: test: [CMD-SHELL, 'wget -q -O /dev/null http://127.0.0.1/api/v1/health && wget -q -O /dev/null http://127.0.0.1/'] interval: 10s timeout: 5s retries: 12 start_period: 10s restart: unless-stopped networks: database: external: true name: ${DATABASE_NETWORK:?Set the existing PostgreSQL Docker network} volumes: caddy_data: caddy_config: