SPB Git

Repository Public

OPERATIONS.md 5.0 KB 58 lines markdown

1# Operations23Two 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.45## Health67| Check | Answer |8|---|---|9| `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. |10| `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. |11| `pnpm studio health` (on the node) | same JSON, exit 1 unless `ok` |12| Studio dashboard | same, in words |1314`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.1516## Logs1718One 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.**1920## Routine commands (`pnpm studio …`, on the node)2122| Task | Command / place |23|---|---|24| Enrolment link, editors | `enrol [--name … --role … --editor … --recovery --ttl …]`, `editors` |25| Create/upgrade the database (also automatic) | `migrate` |26| Backup, restore, export | `backup`, `restore`, `export` — see `BACKUP_RESTORE.md` |27| Prepare an import from a checkout | `import --from <dir>` (then review and confirm in the studio) |28| Link and integrity check | `links [--deep]` — or *Outils* |29| Validate every caption file | `captions` — or *Outils* |30| 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) |31| Stop / start | `pm2 restart atlas-web`; `pm2 restart atlas-worker` (the running encode is given back to the queue) |3233## Incidents3435| Symptom | Likely cause | Action |36|---|---|---|37| 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* |38| 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 |39| A job stays « En cours » after a crash | worker died mid-encode | nothing: it is re-queued 90 s after its last heartbeat |40| Encode failed | message on the capsule and in *Traitements* | fix the cause, « Relancer »; a file that is not a video must be replaced |41| Upload refused | type/size/content mismatch, or no room | the message says which; storage: free space, raise `ATLAS_QUOTA_GB` |42| « 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 |43| Passkeys stop working after a domain change | `ATLAS_RP_ID`/origin changed | restore the former values, or re-enrol everyone with recovery links |44| `/api/health` 503 | database unreadable or no plan | `pnpm studio health`; restore the last backup if `integrity` is not `ok` |45| Something public by mistake | — | session → *Publication* → « Retirer du site… » (immediate), or « Remettre en ligne… » an earlier version |46| Health says `mode: preview` on the public site | started with `ATLAS_PREVIEW=1` | unset it, restart; the studio is closed in that mode |4748## Costs — what to watch (no real measurement exists)4950- **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).51- **Bandwidth**: ≈ 1.3 GB per learner-hour at 720p, through the tunnel and the gateway; segments are cacheable for an hour.52- **Transcoding**: CPU on the node only; one encode at a time by default, so the web process keeps its share.53- No paid AI API, no third-party service.5455## Not built5657Scheduled backups, off-node copies, log shipping, error monitoring, uptime checks, alerting, load tests, purge of unreferenced media, metrics.58
Files main
Menu

Theme