Skip to content

Blue/green: run a real two-colour cutover in the ci namespace (the acceptance criterion never exercised) #656

Closed

Description

@athvin

The blue/green stack shipped across 14 PRs (#437 #445 #443 #452 #451 #456 #461 #468 #472 #474 #541 #590 #607, plus #624/#610 for the probe). Every PR was verified by content on main after merging, and the chart/Rust/CI halves each have their own gate. What has never been run is the end-to-end acceptance criterion the plan specified, against the ci namespace on er-dev.

The mechanism is Helm-native: color.active is what svc/er-api and svc/er-web select, each colour's digests are pinned independently, and er-{api,web}-preview select the inactive colour. The three-phase deploy job in images.yml reads the live colour from the Service selector rather than from Helm's state.

The four things to run

  1. Zero-downtime, measured. curl in a loop against svc/er-web through a port-forward for the entire cutover window. Zero non-2xx is the criterion — not "it looked fine".
  2. Rollback. Flip color.active back and run the loop again. The old colour never stopped running, so this should be seconds.
  3. The expand case. A release that adds a nullable column, proving the old colour keeps serving correctly against an ahead store. er-server migrate --plan on the old digest must report ahead, not breaking. This is the property the whole design rests on (er-entity-diff's third verdict, and E011 forbidding SELECT * anywhere), and it has only ever been tested at the unit/e2e layer, not across a live cutover.
  4. The negative path. Push a branch that retypes a column and confirm the preflight refuses and deploys nothing — live colour untouched, no hook run, no DDL written. pg_reconcile.rs:169 already asserts "a refusal writes no ledger row"; this proves the same at the deploy layer.

Two measured constraints to watch while doing it

  • Aurora connection establishment. er-server has no connection pool — handlers connect per request — so two colours double connection establishment against an Aurora Serverless v2 instance that may be at 0 ACU. Watch DatabaseConnections through the first cutover.
  • The namespace quota. limits.cpu is 40 and a two-colour cutover costs ~5 (dispatcher 1.0 + blue 1.5 + green 1.5 + a weight-ordered hook 0.5 + the drift CronJob 0.5 if it fires). Fine at two concurrent L task pods (24 + 5 = 29). See docs(infra): the quota's cpu sum stopped adding up when colours landed #633 for why the comment that used to say "+2 for the app" was wrong, and the trap it set.

Known residual risk — expected, not a bug

A browser holding the old colour's HTML that makes a client-side navigation requests /_next/static/<old-build-id>/…, which 404s once the Service moves. The App Router recovers with a hard navigation, so it is degraded, not broken. frontend/next.config.ts sets no generateBuildId, so the id is per-build. The real fix is per-target-group stickiness on the ALB, which D-BLUEGREEN defers and which the edge (task 1.4) is blocked on anyway. Do not treat a single 404 for a stale static asset as a cutover failure; do treat a non-2xx on a document or /v1 request as one.

Activity

  1. added
    ci-backlog
    on Nov 6, 2026
  2. self-assigned this
    on Nov 7, 2026
  3. athvin commented on Nov 7, 2026

    @athvin
    OwnerAuthor

    Claimed — working in #811 (draft). Closing that PR releases the claim.

  4. athvin commented on Nov 7, 2026

    @athvin
    OwnerAuthor

    Criteria 1 and 2 are proven; 3 and 4 split to #813

    #811 measures the two criteria that were achievable, against ci on er-dev:

    cutover requests non-2xx helm upgrade
    blue → green 116 0 35s
    green → blue 98 0 29s

    Both colours were pinned to identical digests, so the only variable was the
    selector move. scripts/ci/bluegreen-acceptance.sh makes it re-runnable, with a
    guard that aborts rather than reporting a number if deploy.yml moved the
    release mid-window.

    Both stated constraints checked: Aurora DatabaseConnections 7 → 9 with
    ServerlessDatabaseCapacity never leaving 0.5 ACU (the second colour costs ~2
    connections); quota 2500m used of 40.

    Why 3 and 4 moved rather than being finished here

    Neither can be exercised from a branch — images.yml is
    push: branches: [main] and deploy.yml fires on workflow_run after it, so
    there is no branch path to a ci deploy. Both need a release merged to main,
    which is a materially different act from running a loop against a namespace.
    Criterion 4 is worse than that: make check has no Postgres, so a retype passes
    the PR gate cleanly and can only be refused at the deploy preflight — meaning the
    test leaves main's deploy path refusing until reverted. Not something to do
    while other sessions have PRs in flight. #813 carries both with the reasoning
    and a cheaper alternative for 4.

    One correction to this issue's text

    Flip color.active back and run the loop again. The old colour never stopped
    running, so this should be seconds.

    Right in magnitude, wrong in mechanism. That holds only between cutover and
    retire; deploy-retire-colour.sh scales the old colour to zero afterwards, which
    is the steady state this namespace was found in. A real rollback is therefore a
    scale-up, not a selector move — measured at 7s to ready from replicas=0,
    because that script scales rather than deletes and the image stays cached on the
    node. Both paths are seconds; the reasons differ, and the difference matters if
    the image ever stops being cached.

  5. added 2 commits that reference this issue on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ci-backlog

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions