services: monitoring-app: image: ghcr.io/bipprojectbali/monitoring-app:stg-latest container_name: monitoring-app-stg restart: unless-stopped environment: # Database - DATABASE_URL=${DATABASE_URL} - DIRECT_URL=${DIRECT_URL} # Google OAuth - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID} - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET} # App - PORT=${PORT:-3000} - NODE_ENV=${NODE_ENV:-production} # Admin (initial Super Admin emails, comma-separated) - SUPER_ADMIN_EMAIL=${SUPER_ADMIN_EMAIL} networks: - public-net - postgres-net-stg depends_on: migrate: condition: service_completed_successfully deploy: resources: limits: cpus: '1.0' memory: 1G reservations: memory: 512M logging: driver: json-file options: max-size: "10m" max-file: "3" labels: - "traefik.enable=true" - "traefik.docker.network=public-net" - "traefik.http.routers.monitoring-app.rule=Host(`monitoring-stg.wibudev.com`)" - "traefik.http.routers.monitoring-app.entrypoints=websecure" - "traefik.http.routers.monitoring-app.tls=true" - "traefik.http.routers.monitoring-app.tls.certresolver=letsencrypt" - "traefik.http.services.monitoring-app.loadbalancer.server.port=3000" migrate: image: ghcr.io/bipprojectbali/monitoring-app:stg-latest container_name: monitoring-app-stg-migrate restart: "no" # `migrate deploy` only applies existing migrations from prisma/migrations/. # Safer than `migrate dev --name auto` which auto-generates new migrations # from schema diff (risk of drift in production). # Seed runs only if SEED_ON_DEPLOY=true (idempotent — wipe-and-reseed by # design; recommend leaving false for production with real customer data). entrypoint: ["sh", "-c", "bunx prisma migrate deploy && if [ \"$$SEED_ON_DEPLOY\" = \"true\" ]; then bun prisma/seed.ts; fi"] environment: - DATABASE_URL=${DIRECT_URL} - SEED_ON_DEPLOY=${SEED_ON_DEPLOY:-false} networks: - postgres-net-stg networks: public-net: external: true postgres-net-stg: external: true