Files
soroban-abacus-flashcards/nas-deployment/docker-compose.green.yaml
Thomas Hallock b47992f770 feat(deploy): add blue-green deployment with health endpoint
- Add /api/health endpoint that checks database connectivity
- Set up blue-green deployment with two containers (abaci-blue, abaci-green)
- Add docker-compose.yaml with YAML anchors for DRY config
- Add generate-compose.sh to create blue/green compose files from main
- Update deploy.sh with NAS-specific fixes (scp -O, PATH for docker)
- Fix deploy.sh to not overwrite production .env by default

The blue-green setup allows zero-downtime deployments via compose-updater,
which watches separate compose files and restarts containers independently.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 17:04:01 -06:00

46 lines
1.9 KiB
YAML

version: "3.8"
services:
green:
image: ghcr.io/antialias/soroban-abacus-flashcards:latest
restart: unless-stopped
env_file:
- .env
volumes:
- ./public:/app/public
- ./data:/app/apps/web/data
- ./uploads:/app/uploads
networks:
- webgateway
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/', r => process.exit(r.statusCode < 400 ? 0 : 1)).on('error', () => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
container_name: abaci-green
labels:
traefik.enable: "true"
traefik.http.routers.abaci.rule: "Host(`abaci.one`)"
traefik.http.routers.abaci.entrypoints: websecure
traefik.http.routers.abaci.tls: "true"
traefik.http.routers.abaci.tls.certresolver: myresolver
traefik.http.routers.abaci.middlewares: hsts@docker
traefik.http.routers.abaci.service: abaci
traefik.http.routers.abaci-http.rule: "Host(`abaci.one`)"
traefik.http.routers.abaci-http.entrypoints: web
traefik.http.routers.abaci-http.middlewares: redirect-https@docker
traefik.http.services.abaci.loadbalancer.server.port: "3000"
traefik.http.services.abaci.loadbalancer.healthcheck.path: /
traefik.http.services.abaci.loadbalancer.healthcheck.interval: 10s
traefik.http.middlewares.redirect-https.redirectscheme.scheme: https
traefik.http.middlewares.redirect-https.redirectscheme.permanent: "true"
traefik.http.middlewares.hsts.headers.stsSeconds: "63072000"
traefik.http.middlewares.hsts.headers.stsIncludeSubdomains: "true"
traefik.http.middlewares.hsts.headers.stsPreload: "true"
docker-compose-watcher.watch: "1"
docker-compose-watcher.dir: /volume1/homes/antialias/projects/abaci.one
docker-compose-watcher.file: docker-compose.green.yaml
networks:
webgateway:
external: true