You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zero-downtime deployments are difficult when both the backend and Soroban contracts must be updated atomically. A blue-green deployment pipeline maintains two production environments (blue = current, green = next), shifts traffic via a feature flag, runs automated smoke tests on green before committing, and rolls back with a single command if smoke tests fail.
What to build
GitHub Actions workflow blue-green-deploy.yml triggered on push to main:
Build and push Docker image to registry, tagged :{sha}
Deploy to green environment (ECS/K8s replica set); green runs alongside blue on a separate port
Run smoke test suite (Playwright + k6 single-user test against green's health endpoints)
If smoke tests pass: update the load balancer to shift 100% traffic to green; tag previous blue for teardown after 10-min drain
If smoke tests fail: tear down green; notify via Slack webhook; create a GitHub issue automatically
Smoke test suite (tests/smoke/):
GET /healthz returns 200
POST /api/v1/auth/login with a test user succeeds
GET /api/v1/escrows returns a 200 with the expected schema
Rollback script (scripts/rollback.sh): shifts traffic back to blue, tears down green, sends a Slack alert
DEPLOYMENT.md: documents the blue-green process, manual override steps, and rollback procedure
Acceptance Criteria
Blue environment receives 0 interruption during green deployment and smoke test phase
Traffic shift is atomic at the load balancer level (no partial split during cutover)
Smoke test failure triggers rollback automatically within 2 minutes of failure detection
A GitHub issue is created on smoke test failure with: commit SHA, environment, failed test names, and logs URL
Feature flag check is a hard gate — pipeline exits 0 (not an error) and leaves green running when flag is off
Rollback script is idempotent — running it twice when already on blue is a no-op
DEPLOYMENT.md covers: normal flow, flag-gated cutover, manual rollback, drain period
Technical notes
Load balancer abstraction: use AWS ALB target group weights or an nginx upstream weight; abstract behind a scripts/shift-traffic.sh {blue|green|split:N} helper
Green environment URL is deterministic: green.{base_domain} configured via env var
Overview
Zero-downtime deployments are difficult when both the backend and Soroban contracts must be updated atomically. A blue-green deployment pipeline maintains two production environments (blue = current, green = next), shifts traffic via a feature flag, runs automated smoke tests on green before committing, and rolls back with a single command if smoke tests fail.
What to build
blue-green-deploy.ymltriggered on push tomain::{sha}tests/smoke/):GET /healthzreturns 200POST /api/v1/auth/loginwith a test user succeedsGET /api/v1/escrowsreturns a 200 with the expected schemaGET /api/v1/contracts/statusreturns{ connected: true }enable_blue_green_cutoverfeature flag (feat(backend): build per-tenant feature flag service — flag definitions with rollout percentages, user-segment overrides, kill-switch support, and REST management API #1528); if the flag is off, pipeline stops after green deployment and waits for manual approvalscripts/rollback.sh): shifts traffic back to blue, tears down green, sends a Slack alertDEPLOYMENT.md: documents the blue-green process, manual override steps, and rollback procedureAcceptance Criteria
DEPLOYMENT.mdcovers: normal flow, flag-gated cutover, manual rollback, drain periodTechnical notes
scripts/shift-traffic.sh {blue|green|split:N}helpergreen.{base_domain}configured via env var