Info
- Production and dev run on our server with Docker Compose behind Traefik, which handles HTTPS (Let's Encrypt)
- Deploys are done by GitHub Actions (
.github/workflows/build.yml)
- Containers: the app (
service-hub), PostgreSQL, LiveKit for video streaming and an nginx that serves the network share's shared folder. Compose projects are service-hub and service-hub-dev. Monitoring, the admin tools (Arcane and pgAdmin, in deploy/tools) and GlitchTip (crash reports, in deploy/glitchtip) are their own projects
- The app runs as the image's non-root user (uid 1654)
How a deploy works
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- Prod only: it updates monitoring (see Monitoring), the admin tools and GlitchTip, each once its secrets exist. A failure there only warns
- One deploy per environment at a time. A newer push waits for the running one and replaces an older one still waiting
- Prod answers on
DOMAIN and on OLD_DOMAIN (kept for older app builds), dev on dev.DOMAIN. Dev has its own image (service-hub-dev), database, files and cookie keys volumes
- Production: https://polis.lics.cz/, dev:
https://dev.polis.lics.cz/. The old ediveplus.phil.muni.cz still serves prod
- Subdomains:
livekit. (streaming signaling), turn. (TURN over TLS), files. (shared files for signed-in apps), glitchtip. (crash reports), grafana., arcane. (containers) and pgadmin. (database). The tools sign in with the hub account and show in Service Hub → Tools and on Home for the people allowed. TeamCity (teamcity.) runs on its own server, not in this deploy, and signs in with the hub too
Compose files