ADR-0007: Retire stage.propflowai.co
- Status: Accepted
- Date: 2026-04-17
- Deciders: Fede
- Related: ADR-0004 (Lambda PR preview deploys), Phase 1 send-lock, Phase 3 CI/CD
Context
stage.propflowai.co was a PM2-managed Next.js instance on EC2 35.172.106.96
(port 3001) fronted by a Cloudflare Tunnel. It existed so we could build once,
deploy the artifact to stage, run integration + Playwright tests against a live
URL, and then promote the same build to prod.
Since Phase 3 landed (PR #154), every GitHub PR now gets an automatic Vercel preview deploy that:
- Runs the same Next.js build as prod.
- Points at the
propflow-stageDynamoDB table +propflow-inbound-processor-stageLambda (same backing infra stage has always used). - Gets a stable
https://propflowai-git-<branch>-propflow.vercel.appURL the CIapi-smokejob already targets.
That makes the EC2 stage instance redundant. Keeping it around costs:
- PM2 process on EC2 +
start-with-ssm.shcomplexity. - Cloudflare Tunnel (
com.cloudflare.propflow-stagelaunchd unit) + DNS record. - Two deploy scripts (
deploy-stage.sh,deploy-promote.sh) nobody uses now that merging to main auto-deploys prod. - Cognitive overhead: new agents reach for
npm run deploy:promote.
Decision
Retire stage.propflowai.co. Specifically:
- Drop
stage.propflowai.coas a default target from every caller. Replace with a mandatorySMOKE_TARGET_URLenv var (a Vercel preview URL) or--target local. - Delete
scripts/deploy-stage.shandscripts/deploy-promote.sh. - Remove the
propflowai-stagePM2 app fromecosystem.config.js. - Kill the PM2 process on EC2 (
pm2 stop propflowai-stage && pm2 delete propflowai-stage && pm2 save) — seescripts/retire-stage-pm2.sh. - Delete the Cloudflare Tunnel route for
stage.propflowai.coand the DNS record — seescripts/retire-stage-cloudflare.sh. - Remove the Cloudflare launchd unit on Fede's Mac (manual step once the tunnel is gone).
Explicitly kept:
propflow-stageDynamoDB table — Vercel previews still use it.propflow-inbound-processor-stageLambda +propflow-inbound-stage.fifoSQS queue — previews still use them.(Retired 2026-07-16 by ADR-0097: raw prod→stage copies are forbidden; useseed-stage.sh— still the way to backfill stage DynamoDB from prod for local dev + preview data hygiene.npm run seed:stagefor fixtures and thescripts/anon-backfill/pipeline for anonymized bulk data.)- EC2 instance
35.172.106.96itself — still hosts the prod app. Phase 7 will evaluate retiring the EC2 prod host now that Vercel hosts prod.
Migration
- Smoke/integration callers:
SMOKE_TARGET_URLenv var required; all defaults removed. - Playwright:
TARGET=stagepath removed;SMOKE_TARGET_URLis the only way to point at a hosted target. - Better Auth trusted origins:
stage.propflowai.coremoved; widened the Vercel preview regex to match*.vercel.app. - GitHub Actions:
STAGE_BASE_URL→SMOKE_TARGET_URL,--target stage→--target preview.
Consequences
Positive:
- One less hosted environment to keep healthy.
- Per-PR isolation: previews can't step on each other like a single stage instance does.
- No more "did someone deploy over my stage" debugging.
Negative / trade-offs:
- CI now depends on Vercel preview availability. Vercel outages block
preview-targeted tests. Mitigation:
api-smokeis alreadycontinue-on-error: true, and local dev + unit tests remain unaffected. - Agents that pasted
stage.propflowai.coURLs into debugging flows need to retrain on preview URLs. Mitigation: every error message that used to default to stage now points at ADR-0007.
Rollback
If we need stage back:
git revertthe Phase 6 commits on main.pm2 start ecosystem.config.js --only propflowai-stageon EC2 (after restoring the entry inecosystem.config.js).- Re-add the Cloudflare Tunnel route + DNS record.
- Restore the Cloudflare launchd unit on Fede's Mac.
The propflow-stage DynamoDB table + stage Lambda are preserved throughout,
so rollback is a config-only restore.