Info

How a deploy works

  1. Push to master deploys prod (merge develop into master and push). Run the workflow by hand to pick dev or prod. Prod deploys only from master
  2. The workflow publishes the app and writes .env from the repo's GitHub secrets and variables. It runs no tests: run dotnet test tests/ServiceHub.Tests locally before pushing
  3. It deletes the old publish/ on the server, then copies the compose files, Dockerfile, .dockerignore, publish/ and .env to the server over SSH. .env is readable only by the deploy account
  4. On the server it dumps the database to backups on the network share (prod-deploy-YYYYMMDD-HHMMSS, the last five per environment are kept), before the migrations run. The dump is encrypted with ANALYTICS_ENCRYPTION_KEY, together with a copy of the hub's key store (deploy/save-backup.sh). Without the share, or when the dump fails, nothing is deployed
  5. It keeps the running image as service-hub:previous, pulls newer images, builds with the newest .NET base image (build --pull) and runs docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d --remove-orphans. Dev uses docker-compose.dev.yml. A failed build stops the deploy
  6. It adds --profile streaming when LIVEKIT_API_KEY and LIVEKIT_API_SECRET are set, and --profile shared-files when /mnt/polis/service-hub is mounted and has a shared folder
  7. It waits up to 2 minutes for the app to start, e.g. after its migrations, and checks that https://DOMAIN/api/probe/ping answers within 30 s
  8. When it doesn't, the deploy goes back to service-hub:previous, shows the last log lines and fails. Migrations that already ran stay; the dump from step 4 has the database from before
  9. Prod only: it updates monitoring (see Monitoring), the admin tools and GlitchTip, each once its secrets exist. A failure there only warns

Compose files