From 8527671f460cec3e244371f7e7c094645012f7b3 Mon Sep 17 00:00:00 2001 From: amaliadwiy Date: Mon, 27 Apr 2026 17:16:36 +0800 Subject: [PATCH] upd:compose --- compose.yml | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 compose.yml diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..aaaca7d --- /dev/null +++ b/compose.yml @@ -0,0 +1,65 @@ +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