Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
6.3 KiB
Runbook — One-Shot Deploy (menivor / ReelForge)
Goal: once the owner hands over credentials, go from creds in hand to live read-only pilot in a single clean, gated flow — then flip launch flags stage-by-stage as later credential phases land.
This runbook chains the pieces that already exist:
- Credential contract:
deploy-credentials.md(phases + where to get each secret). - CI/CD mechanics:
deploy.md+.github/workflows/deploy.yml. - Readiness preflight:
scripts/deploy-preflight.py(this runbook's gate). - Launch-flag gate + smoke:
scripts/reelforge-release-gate.sh,apps/api/tools/ops/preflight.py,apps/api/tools/ops/deploy_smoke.py. - Infra:
infra/terraform,infra/k8s(kustomize overlays),docker-compose.reelforge.yml.
The golden rule: never flip a launch flag before that phase's credentials pass preflight and the phase's one-time real-world verification is done.
0. Set env (creds in hand)
cp .env.reelforge.example .env.reelforge
# Paste Phase 0 (Neon + Redis + R2 + CORS + Sentry) and Phase 1 (Claude,
# ElevenLabs, HeyGen) values. Leave Phase 2-4 blank + all launch flags false
# (the safe pilot posture the template already ships).
Provisioning order for Phase 0 infra: Neon project → Upstash/Redis → Cloudflare
R2 bucket + API token → Sentry project. See deploy-credentials.md for exact
sources. Terraform can provision these (infra/terraform/envs/prod); the outputs
are the values you paste.
Redis note: populate BOTH the
REDIS_HOST/PORT/DB/PASSWORDfamily (API + Celery worker) ANDREDIS_URL(KEDA GPU autoscaler). See the drift note indeploy-credentials.md.
1. Preflight — MUST pass (no secrets, no external calls)
# Phase 0 + Phase 1 are required; later phases report as PENDING until their flags flip.
python3 scripts/deploy-preflight.py --env-file .env.reelforge
Exit 0 = ready. Exit 1 = a required var is missing/misshaped or a launch flag is incoherent — fix and re-run. Optional live connectivity sanity check (opt-in, needs psycopg/redis/boto3 on PATH):
python3 scripts/deploy-preflight.py --env-file .env.reelforge --check-connectivity
2. Migrate the database (alembic → head)
Idempotent; a no-op when already at head. In CI this is the pre-deploy
reelforge-migrate Job (infra/k8s/base/migrations-job.yaml). Locally / one-off:
# Route the repo cloud profile's env (maps DATABASE_URL → NEON_DATABASE_URL, etc.)
python3 scripts/cloud-runtime-env.py reelforge --env-file .env.reelforge -- \
alembic upgrade head
alembic check # must be clean: no model/migration drift before tagging
Destructive DDL is rejected by the deploy pipeline unless the revision carries
safe: destructive (expand → migrate → contract). See deploy.md §Gotchas.
3. Deploy (build → migrate → canary → verify → promote)
Deployment is the existing pipeline — do not hand-roll kubectl apply in prod:
git tag vX.Y.Z && git push --tags # triggers .github/workflows/deploy.yml
deploy.yml runs: build+sign image (SBOM/provenance) → migration safety-class
gate → apply migration Job (waits) → canary set-image on a prod slice →
infra/scripts/verify-slos.sh (5xx rate + wallet success-only-billing invariant)
→ promote by pinning the overlay digest. SLO failure ⇒ auto rollback (re-pin
previous digest). Watch #deploys.
The release gate that runs with prod env injected:
# Runs deploy-preflight (phase table) → ops/preflight.py --production
# → architecture/contract checks → external post-deploy smoke.
REELFORGE_DEPLOY_URL="https://api.menivor.com" ./scripts/reelforge-release-gate.sh
4. Golden smoke — one real render
Confirm the deployed stack renders end-to-end before opening any door:
# HTTP liveness/readiness + launch-mode visibility against the live API.
python3 apps/api/tools/ops/deploy_smoke.py \
--base-url "https://api.menivor.com" --expect-mode internal_pilot
# One real golden render (needs Phase 1 provider keys + libass ffmpeg).
make -f Makefile.reelforge golden
make golden runs the REAL 10-job set when ANTHROPIC_API_KEY +
ELEVENLABS_API_KEY + HEYGEN_API_KEY are present, else the synthetic suite.
For a single golden render you can scope to one manifest job.
5. Flip launch flags — stage-by-stage (each gated by its phase)
Re-run preflight after each flag flip; it enforces the coherence rules below.
| Step | Precondition (must be true first) | Flip |
|---|---|---|
| Public pilot | Phase 0+1 pass, one golden render green | keep internal_pilot; verify read/create |
| Auth on | Phase 2 (Clerk) passes preflight | REELFORGE_SIGNUP_ENABLED=true |
| Go public | Phases 0-2 verified | REELFORGE_LAUNCH_MODE=public + REELFORGE_PUBLIC_LAUNCH_APPROVED=true |
| Checkout on | Phase 3 rail passes and one real paid webhook + one real settlement done | REELFORGE_CHECKOUT_ENABLED=true |
| Publishing on | Phase 4 OAuth apps approved + SOCIAL_TOKEN_KEY set |
REELFORGE_PUBLISHING_ENABLED=true |
Coherence rules enforced by scripts/deploy-preflight.py and
apps/api/tools/ops/preflight.py (they never disagree):
checkout/publishingmay be enabled only in approved public mode.publicmode requiresREELFORGE_PUBLIC_LAUNCH_APPROVED=true.SIGNUP_ENABLED=truerequires Clerk keys (Phase 2).CHECKOUT_ENABLED=truerequires a complete payment rail (Phase 3).PUBLISHING_ENABLED=truerequiresSOCIAL_TOKEN_KEY+ an OAuth app (Phase 4).
Rollback
Re-pin the overlay to the previous image digest (no rebuild); last-known-good
digest is in the prior deploy's step summary. See deploy.md §Rollback.
One-shot summary (what the owner runs)
cp .env.reelforge.example .env.reelforge # paste Phase 0 + Phase 1 creds
python3 scripts/deploy-preflight.py --env-file .env.reelforge # must exit 0
python3 scripts/cloud-runtime-env.py reelforge --env-file .env.reelforge -- alembic upgrade head
git tag vX.Y.Z && git push --tags # deploy.yml: build→migrate→canary→SLO→promote
python3 apps/api/tools/ops/deploy_smoke.py --base-url https://api.menivor.com --expect-mode internal_pilot
make -f Makefile.reelforge golden # one real render
# then flip launch flags per the table above, re-running preflight after each.