Deployment and operations
Production runs on the MacLustr cluster, placed by the cluster orchestrator mld.
| Item | Value |
|---|---|
| URL | https://clip.spboucher.ai (DNS A → 51.161.112.61, Caddy + Let's Encrypt on the tunnel gateway) |
| Node | M2M32c, ~/apps/clip-spboucher-ai (this directory is the git source of truth, origin spbgit) |
| Processes | PM2 clip-web (port 8640), clip-worker |
| Database | PostgreSQL 17, database clip, role clip_app |
| Queue | Redis 8, logical DB 5, key prefix clip |
| Assets | ~/data/clip-spboucher-ai (content-addressed) |
| Backups | ~/backups/clip-spboucher-ai nightly at 04:20 (pg_dump + asset rsync), copied to a second node |
| Secrets | ~/apps/clip-spboucher-ai/.env (mode 600), never in git |
Deploy
bash
# first deployment (from the operator laptop)
mld stage ~/Desktop/Cluster/projets/clip-spboucher-ai clip-spboucher-ai
mld deploy clip-spboucher-ai --node M2M32c
# afterwards: edit on the node
ssh M2M32c
cd ~/apps/clip-spboucher-ai && git pull # or edit in place
pnpm install --frozen-lockfile && pnpm migrate && node_modules/.bin/next build
pm2 restart clip-web clip-worker && git commit -am "…" && git pushThe post-sync hooks install dependencies, apply migrations, seed the editorial taxonomy, bootstrap the owner (idempotent) and build.
Runbook
| Situation | Action |
|---|---|
| Stop all spending now | /studio/settings → Kill switch, or pnpm tsx scripts/kill-switch.ts on |
| A film must come down | /studio/films → Unpublish (media stops being served immediately) |
| A job is stuck | /studio/jobs shows state, attempts and the provider error; "Retry stage" re-enqueues it (idempotent: finished paid calls are reused) |
| Worker crashed mid-video | Nothing to do: on restart the job resumes polling the stored request_id |
| Health | GET /api/health (database, Redis, asset store, worker heartbeat, ffmpeg) |
| Logs | pm2 logs clip-web, pm2 logs clip-worker (JSON lines) |
| Restore | scripts/restore.sh <backup-dir> into a scratch database, verify, then swap (drill documented in PROGRESS.md) |
| Rotate the xAI key | edit .env, pm2 restart clip-web clip-worker --update-env |
Docker Compose
docker-compose.yml runs web, worker, PostgreSQL and Redis on a Linux host. It is provided for portability and
is not what production uses.