Mendora
Documentation · Operations runbook

Operations runbook

Processes

ProcessCommandHealth
PostgreSQLmake dbpg_isready; data in the mendora-db docker volume
APImake apiGET /api/health (503 when the database is unreachable)
Workermake worker (run two or more for failover)heartbeat in the operator console (alive if within 30 s)
Webmake web-start after make web-buildthe home page loads

Logs and metrics

  • API: one JSON-ish line per request with path, status, duration and a request id (x-request-id header). Errors return {"detail": {"code": "internal_error", "request_id": ...}}; search the log for the id.
  • Worker: JSON lines (job.claimed, job.succeeded, job.failed, customer_job.interrupted, champion.transition).
  • Metrics: GET /api/metrics (Prometheus text): request and error counters, jobs by state, customer jobs by state. Readable by operators, or by a scraper sending Authorization: Bearer $MENDORA_METRICS_TOKEN; never public.

Jobs and retries

Jobs are rows in job_queue, claimed with FOR UPDATE SKIP LOCKED and leased (MENDORA_JOB_LEASE_SECONDS, 60 s). A worker renews its lease every third of that. If a worker dies, its job is reclaimed when the lease expires; round evaluation skips case-trials already stored. Failed jobs retry with exponential backoff up to max_attempts, then become dead. Retry a failed or dead job from the operator console (Queue) or POST /api/operator/jobs/{id}/retry.

Backup and restore

docker compose -f deploy/docker-compose.yml exec -T db pg_dump -U mendora -Fc mendora > mendora.dump
tar czf mendora-var.tgz var/                    # private cases, traces, submissions, public evidence
# restore
docker compose -f deploy/docker-compose.yml exec -T db pg_restore -U mendora -d mendora --clean < mendora.dump
tar xzf mendora-var.tgz

Back up the database and var/ together: rows reference files by path and SHA-256.

Rollback

  • Code: deploy the previous tag; migrations are forward-only in production. alembic downgrade -1 exists for development.
  • Customer release: roll back from Operator console → Release review (the previous pinned release applies to new recovery runs; runs in progress finish on the release they started with).
  • Round: a decided round that has not been published can be left unpublished; a published round is final and disputes remedy it going forward.

Key separation

The API and worker never hold wallet keys, coldkeys or GitHub credentials. Submitted programs run without secrets, network or access to the database. Weight commits belong to a separate process with only a validator hotkey.

Incidents

SymptomFirst checks
Evaluations stuckOperator console → Queue: running job with an expired lease is reclaimed automatically; check worker logs; start another worker
Customer job stays interrupteda worker must be running; see recover_customer_job jobs and their stderr_tail
Round voidmore than 5% of cases hit operator-wide faults; the reasons are on the round; fix the harness and open a new round
Suspected leaked private casesstop intake, rotate private templates, open a dispute record, publish a notice
Critical outcome in customer operationhalt autonomy for the release, roll back, find the root cause (whitepaper Section 12)