- Blue: Stable (port 3001)
- Green: New version (port 3002)
- Router: Load balancer (port 3000), proxies to ACTIVE_COLOR based on state.
- State: .deployment-state.json (local, gitignored)
- Health checks (/health/live, /health/ready) before switch.
- No secrets in state; env vars for ports.
- Proxy logs requests, errors 502 on backend fail.
- Threat: Port scan (mitigate by firewall), state tampering (local only).
- Start blue:
npm run blue - Deploy green: Start green instance,
npm run deploy:switch-green - Test traffic via router: curl http://localhost:3000/api/v1/contracts
- Rollback:
npm run deploy:rollback - Status:
npm run deploy:status
After deploy:switch-green, an automatic post-switch soak watches the HTTP
error rate and rolls back on its own if a threshold is breached. See
auto-rollback.md.
95%+ coverage on router/deploy. Run npm test.
Edge cases: Unhealthy green (no switch), rollback from green.