Skip to content

feat(maat): deploy the judge on the shared VPS - #67

Open
Omar-Mohamed24 wants to merge 2 commits into
mainfrom
maat-deploy
Open

Omar-Mohamed24 wants to merge 2 commits into
mainfrom
maat-deploy

Conversation

@Omar-Mohamed24

@Omar-Mohamed24 Omar-Mohamed24 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What changed

Adds deploy/maat/ to run Ma'at, an online judge, at maat.project-graphite.com: frontend, backend, worker, MongoDB, Redis, MinIO and verified hourly database dumps for the nightly backup.

IMAGE_TAG=REPLACE_WITH_SHA_TAG in deploy/maat/values is replaced with IMAGE_TAG=sha-a665a99, whose three images are published. Please don't roll back to an older tag: earlier worker images cannot start this judge. After the merge, CI updates the tag by itself.

Ma'at runs untrusted C++ and Python, so it never gets the host's Docker socket. Its worker uses a separate rootless daemon and refuses to start on any other kind.

Draft: merging deploys, so please don't merge before the list below is done.

Needed from an owner before merging

  • Approve an exception to "Untrusted third-party workloads do not belong on this shared Docker host" in the handbook.
  • Run Sync registry, so projects/maat.yml says kind: compose. The PR checks fail until then.
  • Create the judge's Docker on the VPS:
    • user maat-judge, uid and gid 1500, with subordinate ids and linger
    • rootless Docker run by that user, socket at /srv/maat-judge/run/docker.sock
    • /srv/maat-judge/jobs, owned by 1500:1500
    • cgroup delegation of cpu cpuset io memory pids, with the slice limited to 1 core and 1 GB
    • gcc:13-bookworm and python:3.12-slim pulled on it, so the first rollout doesn't time out
  • Allow two mounts in host/agent.py, only for project maat, service worker: /srv/maat-judge/run (read-only) and /srv/maat-judge/jobs, each to the same path. Please don't add maat to HOST_ACCESS.
  • Install the agent change by copying agent.py to /srv/graphite/bin/ and restarting graphite-agent. Re-running bootstrap.sh would overwrite /etc/graphite/agent.env and lose DEPLOY_REPORT_SECRET.
  • Raise system in deploy/host.yaml from 700M to 1724M for the judge. Projects would then reserve 1728M of 1976M.
  • Enter the secrets under /maat/, or give me access to:
    • random hex: MONGO_PASSWORD, REDIS_PASSWORD, JWT_SECRET, MINIO_ROOT_PASSWORD, S3_SECRET_KEY
    • SMTP: EMAIL_HOST, EMAIL_FROM, EMAIL_USERNAME, EMAIL_PASSWORD
  • Give me "operate" on Maat in the console, to create the admin and run restores.

Verification

  • With this tag and a compose registry entry, deploy.py check, check-memory.py and check-values.py pass.
  • The agent's current compose check refuses only the two mounts above.
  • A local rehearsal behind Traefik, with images built from the same changes, passed 25 end-to-end checks.
  • A backup and restore using the functions in edge/backup.py brought back data, pictures and standings.
  • Not tested: real rootless Docker (the rehearsal used a rootful daemon with that check bypassed), the agent exception and the VPS itself.

After merging

  • Create the admin, following Maat's README
  • Test every verdict, especially Memory Limit
  • Check that the backend log shows visitors' public IPs
  • Run a backup and confirm it is verified

Rollback and restore

  • Undo the first deploy: set ENABLED=false. Volumes are kept.
  • Later rollbacks: set IMAGE_TAG to sha-a665a99 or newer. Database changes are not undone.
  • Restore: the console restores dump files but doesn't load them. Within two hours:
    1. Stop backend and worker.
    2. In mongo-backup, run bash /mongo-backup.sh list, then bash /mongo-backup.sh restore <dump> with the newest dump older than the archive.
    3. In redis-backup, do the same with sh /redis-backup.sh.
    4. Start backend and worker.
  • Don't set PROXIED=true: visitors would share Cloudflare's IPs and rate limits.

Checklist

  • The change is focused and contains no credentials or generated secrets.
  • Documentation and tests were updated when behavior changed. (Setup and restore steps are in this description for now.)
  • Deployment or rollback considerations are described when relevant.

Omar-Mohamed24 and others added 2 commits November 22, 2026 22:06
Add Docker Compose configuration for Maat services, MinIO storage, databases, backups, judge worker startup, and deployment values.
@Omar-Mohamed24
Omar-Mohamed24 requested a review from a team as a code owner November 22, 2026 20:22
Copilot AI balanced review requested due to automatic review settings November 22, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot added the size/l 201-600 changed lines, excluding lockfiles label Nov 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l 201-600 changed lines, excluding lockfiles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants