Commands assume the project directory on the host and one of:
COMPOSE="docker compose -f compose.yml -f compose.prod.yml" # production
COMPOSE="docker compose" # local| Check | Command |
|---|---|
| Everything | scripts/smoke.sh (in production, with BASE_URL=https://$DOMAIN) |
| Containers | $COMPOSE ps |
| API health | $COMPOSE exec api wget -qO- localhost:8080/actuator/health |
| Judge queue | $COMPOSE exec db psql -U contester -c "select status, count(*) from submissions group by 1" |
| Logs | $COMPOSE logs -f --tail 200 api (JSON; filter by requestId) |
When a user reports an error, the problem response contains a requestId.
Search the API log for it.
These need the observability profile. Grafana runs at localhost:3201
locally and has two dashboards:
- "Contester — Golden Signals & SLO": traffic, latency, errors and JVM.
- "Contester — Judge": queue, judge time and verdicts.
Alert rules are in alerts/alert_rules.yml:
| Alert | Meaning | First steps |
|---|---|---|
ContesterBackendUnreachable |
Prometheus cannot scrape the API | $COMPOSE ps api, $COMPOSE logs api; is the DB reachable? |
ContesterElevated5xxRate |
More than 0.5 % of requests are 5xx | Find the errors in the logs by requestId; after a recent deploy, roll back |
ContesterJudgeBacklog |
More than 20 submissions queued | Is Piston up? Check JUDGE_WORKERS; see below |
ContesterJudgeInternalErrors |
Submissions ended as INTERNAL_ERROR |
Piston is down or runtimes are missing; rejudge afterwards |
ContesterSlowJudging |
p95 judge time above 30 s | CPU saturation on the host; too many workers |
Alertmanager is not part of the stack, so alerts show only in Prometheus and Grafana. For paging, add Alertmanager or Grafana contact points.
- Run
$COMPOSE ps pistonand$COMPOSE logs --tail 100 piston. - Check that the runtimes are installed:
$COMPOSE run --rm piston-install(idempotent). - Run
$COMPOSE restart piston. Queued submissions are picked up automatically, and rows stuck inRUNNINGare requeued after 5 minutes. - For submissions that ended as
INTERNAL_ERRORduring the outage, an admin rejudges the affected problems: admin UI → problem → Rejudge, orPOST /api/v1/admin/problems/{id}/rejudge.
- Raise
JUDGE_WORKERS. - Set
PISTON_MAX_CONCURRENT_JOBSincompose.ymltoworkers × JUDGE_PARALLEL_TESTS. - Give the host more CPUs.
Running more parallel jobs than there are CPU cores makes each run slower, and correct solutions can then fail with time limit exceeded.
Fix the tests in the admin UI, then rejudge the problem. Standings are computed from verdicts, so they update immediately.
Reset the password through "Forgot password", which revokes every session.
Alternatively, end the sessions directly:
delete from spring_session where principal_name = '<email>'.
- Rotate the secret at its source: for the DB password, run
ALTER USERand update.env; for the SMTP password, change it at the provider. - Restart the affected services.
- Check the access logs.
- Run
APP_VERSION=<previous> scripts/deploy.sh. - If the newer version ran a migration that the old version cannot handle,
restore the backup made by the failed deploy with
scripts/restore.sh backups/<file>(withCOMPOSEset for production). Data written since that backup is lost, so prefer a forward fix when the outage is small.
| When | Task |
|---|---|
| Daily (cron) | Run scripts/backup.sh, then copy backups/ off the host |
| Monthly | Restore drill (disaster-recovery.md) |
| On Dependabot PRs | Review, let CI pass, merge, release |