SPB Git

Repository Public

deployment.md 2.3 KB 49 lines markdown

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

Theme