SPB Git

Repository Public

OPERATIONS.md 5.0 KB

# Operations

Two processes (PM2): atlas-web (next start, port 8840) and atlas-worker (scripts/worker.ts, media encodes). State: ATLAS_DATA_DIR (database atlas.db, media/, masters/, resources/, uploads/, work/, backups/). Deployment and upgrade: DEPLOYMENT.md. As of 2026-11-22 only Phases 0–3 are deployed; what follows describes this version as run locally.

# Health

Check Answer
GET /api/health (public) 200 {"status":"ok","mode":"production","sessions":N,"published":M}; 503 {"status":"error"} if the course cannot be loaded (database unreadable, no valid plan). No internal detail.
GET /api/health/details with Authorization: Bearer $ATLAS_HEALTH_TOKEN 200 when everything is ok, 503 otherwise; JSON with database (schema, integrity), content (source, published, scheduled), storage (used, free, budget), worker (heartbeat age, queue), ffmpeg (versions, reason when unusable). 404 without the token.
pnpm studio health (on the node) same JSON, exit 1 unless ok
Studio dashboard same, in words

degraded = the public site is fine but the studio cannot do part of its job (no worker, no ffmpeg, storage low). error = database or plan unusable.

# Logs

One JSON object per line on stdout (pm2 logs atlas-web, pm2 logs atlas-worker): ts, level, msg, fields. Tokens, cookies, CSRF values, authorization headers, challenges and secrets in URLs are redacted by field name and by shape before writing (src/server/log.ts, tested). Events: studio.write (actor, method, path), job.started|succeeded|queued|failed|released, worker.started|stopped|ffmpeg_unavailable, import.prepared, api.unhandled. The authoritative record of changes is the audit log in the database (Journal), not these logs. No log shipping, error monitoring or alerting is set up.

# Routine commands (pnpm studio …, on the node)

Task Command / place
Enrolment link, editors enrol [--name … --role … --editor … --recovery --ttl …], editors
Create/upgrade the database (also automatic) migrate
Backup, restore, export backup, restore, export — see BACKUP_RESTORE.md
Prepare an import from a checkout import --from <dir> (then review and confirm in the studio)
Link and integrity check links [--deep] — or Outils
Validate every caption file captions — or Outils
Rebuild the search index Outils → Reconstruire l’index (it is also rebuilt at every publication; kept in memory per content revision, one minute at most)
Stop / start pm2 restart atlas-web; pm2 restart atlas-worker (the running encode is given back to the queue)

# Incidents

Symptom Likely cause Action
Dashboard: « ffmpeg n’est pas utilisable » ffmpeg absent, or not on PM2's PATH install; set ATLAS_FFMPEG/ATLAS_FFPROBE; pm2 restart atlas-worker --update-env; Traitements → Relancer
Dashboard: « Le processus de traitement ne donne pas signe de vie » worker stopped pm2 logs atlas-worker; pm2 restart atlas-worker — jobs resume by themselves
A job stays « En cours » after a crash worker died mid-encode nothing: it is re-queued 90 s after its last heartbeat
Encode failed message on the capsule and in Traitements fix the cause, « Relancer »; a file that is not a video must be replaced
Upload refused type/size/content mismatch, or no room the message says which; storage: free space, raise ATLAS_QUOTA_GB
« Trop de tentatives » at sign-in 5 refused sign-ins from one address in an hour wait (1 min, then 5 min, then 1 h); pnpm studio enrol --recovery if the passkey is lost
Passkeys stop working after a domain change ATLAS_RP_ID/origin changed restore the former values, or re-enrol everyone with recovery links
/api/health 503 database unreadable or no plan pnpm studio health; restore the last backup if integrity is not ok
Something public by mistake — session → Publication → « Retirer du site… » (immediate), or « Remettre en ligne… » an earlier version
Health says mode: preview on the public site started with ATLAS_PREVIEW=1 unset it, restart; the studio is closed in that mode

# Costs — what to watch (no real measurement exists)

  • Storage: masters dominate (4K ≈ 20–45 GB per hour); renditions ≈ 5 GB per hour at the default ladder's ceiling. The dashboard shows usage per category and warns at 80 % of ATLAS_QUOTA_GB or under ATLAS_MIN_FREE_GB free. Old encodes and replaced resource versions are kept (no purge tool yet).
  • Bandwidth: ≈ 1.3 GB per learner-hour at 720p, through the tunnel and the gateway; segments are cacheable for an hour.
  • Transcoding: CPU on the node only; one encode at a time by default, so the web process keeps its share.
  • No paid AI API, no third-party service.

# Not built

Scheduled backups, off-node copies, log shipping, error monitoring, uptime checks, alerting, load tests, purge of unreferenced media, metrics.

Files main
Menu

Theme