Contester ships as two images (contester-api, contester-web) plus
off-the-shelf images (PostgreSQL, Piston, Caddy, Prometheus, Grafana). One
Docker host runs everything with Compose.
flowchart LR
user((Browser)) -->|443| caddy[Caddy<br/>TLS, HSTS]
caddy --> web[web<br/>nginx + SPA]
web -->|/api| api[api<br/>Spring Boot]
api --> db[(PostgreSQL)]
api -->|judge network| piston[Piston<br/>privileged]
prometheus --> api
prometheus --> exporter[nginx-exporter] --> web
grafana --> prometheus
- Linux host with Docker Engine and the Compose plugin (v2.24+ for
!reset). - Piston needs a privileged container: it creates isolate sandboxes with cgroups. Platforms that forbid privileged containers (most PaaS offerings) cannot run the judge.
- cgroup v2 (default on current Ubuntu and Debian).
- 2 vCPU and 4 GB RAM are enough for a small contest. The judge is CPU bound; see performance.md.
- A domain whose A/AAAA record points at the host, with ports 80 and 443 open.
- An SMTP account for verification and password reset mails.
Copy .env.example to .env (mode 600, owned by the deploy user) and set
at least:
| Variable | Example |
|---|---|
DB_PASSWORD |
openssl rand -base64 24 |
DOMAIN, ACME_EMAIL |
contester.example.com, ops@example.com |
IMAGE_PREFIX |
ghcr.io/<owner> |
APP_VERSION |
1.0.0 |
SMTP_HOST, SMTP_PORT, SMTP_USERNAME, SMTP_PASSWORD, SMTP_AUTH=true, SMTP_STARTTLS=true, MAIL_FROM |
from the mail provider |
GRAFANA_ADMIN_PASSWORD |
random, if the observability profile is used |
compose.prod.yml turns on COOKIE_SECURE, turns off Swagger, removes every
host port except Caddy's 80/443, and runs the released images.
- Update
CHANGELOG.md: move the items under Unreleased to the new version. - Tag and push:
git tag v1.0.0 && git push origin v1.0.0. release.ymlbuilds both images with SBOM and provenance, pushes them to GHCR as:1.0.0and:1.0, and creates the GitHub release from the changelog section.
GHCR packages are private by default. Either make them public in the package
settings, or run docker login ghcr.io on the host with a token that has
read:packages.
git clone https://github.com/<owner>/Contester.git && cd Contester
cp .env.example .env && chmod 600 .env && $EDITOR .env
APP_VERSION=1.0.0 scripts/deploy.sh
# optional demo data:
docker compose -f compose.yml -f compose.prod.yml --profile seed run --rm seeddeploy.sh does the following:
- Backs up the database, if it already exists.
- Pulls the images and starts the stack.
- Installs the judge runtimes with
piston-install. This is idempotent; the first run downloads about 1 GB. - Waits for readiness and runs
scripts/smoke.shagainsthttps://$DOMAIN.
To create the first real admin, register normally and then run:
docker compose -f compose.yml -f compose.prod.yml exec db \
psql -U contester -c "UPDATE users SET role='ADMIN' WHERE email='you@example.com'"If you loaded demo data, delete the seeded admin@contester.dev account or
change its password.
- Update:
APP_VERSION=1.1.0 scripts/deploy.sh. - Rollback without schema changes:
APP_VERSION=1.0.0 scripts/deploy.sh. - Rollback across a migration: Flyway migrations are forward-only, so restore
the backup that
deploy.shtook before the update (runbook.md).
Prometheus, Grafana and the nginx exporter are in the observability profile
(docker compose --profile observability up -d). In production they have no
host ports. Reach Grafana through an SSH tunnel to the container network, or
add a separate Caddy site protected by authentication. Dashboards and alerts
are described in runbook.md.
These settings cannot be configured from the repository, and none of them is set up yet:
- Branch protection on
main: require pull requests, thebackend,frontend,e2eandgitleakschecks, and linear history. - Secret scanning and push protection (Settings → Code security).
- Dependabot alerts and security updates.
- Package visibility for
contester-apiandcontester-webin GHCR.