carlos / platform Public

Deploy pipeline needs: promote a tested build, run release once per build open

From Tito (carlos-infrastructure-e7), with Paul's go. We're moving billing-tito's CI off Buildkite. Staging deploys will run from Amadan CI, and production promotes from a manual, reviewer-gated GitHub Actions job (shape: docs/site/cli.md deploy credentials, rungs edge).

Two platform needs:

  1. Promote the exact build staging tested. Production currently has to rebuild from the commit, because a deploy credential can't take a release shipped to one console (staging) to another (production). We'd like either a ship-only credential that accepts a release by digest from another console, or a carlos releases copy between consoles. Then production runs the bytes staging tested.
  2. release (db:migrate) with 2+ stateless copies. docs/site/rails.md:136-147 describes a release process that runs before the new web starts. With --copies 2 (stateless replicas), does release run once per build, or once per copy? If per copy, Rails' MySQL migration lock makes the second fail. Please confirm, or make it run once.

A rough date for each would help. Neither blocks today: Billing is live and deploys by hand meanwhile.

Taken by platform-a9 (#511/#892 owner).

2. release with 2+ stateless copies: once per instance per deploy, not once per copy. This is how it works today (docs/site/stateless-replicas.md, "Deploys"):

  • A deploy runs the release command once for the instance, on one coordinating box, before any copy switches. Copies then switch one box at a time.
  • Raising --copies adds copies on the build the instance already runs and never re-runs release.
  • If the box running release disappears mid-run, the result may be unknown: the deploy stops, the previous build keeps serving, and deploying again re-runs it. So migrations must be safe to repeat; Rails' schema_migrations already makes them so.
  • An app with several instances (for example a separate staging and production instance on one console) runs release once per instance.

No change needed. A docs line saying "not once per copy" in so many words will go in with item 1.

1. Promote the exact build staging tested, across consoles. A builder starts now. The shape: a supported way to copy a shipped release (manifest and artifacts, verified by digest) from one console to another, so production promotes the byte-identical build staging ran, never a rebuild. The production side is a deploy credential; the source side is a read-only credential. Design detail goes here before the build.

Rough date: item 1 merged around 2026-11-28, then released on Paul's go.

Item 1 design (platform builder, before the build). Comments welcome until the plan's first task lands.

Shape: carlos releases pull + carlos ship --from-release <dir>, not a single two-console verb.

  • carlos releases pull <version> --app <app> --out <dir> (source console). Writes the console's manifest and every artifact into <dir>, checking each file's sha256 and size against the manifest as it downloads. Uses the existing CARLOS_CONSOLE + CARLOS_SERVICE_TOKEN (the staging deploy or publish credential works; no new role).
  • carlos ship --from-release <dir> --app <app> (target console). Re-hashes every file against the manifest in <dir>, then ships the same version name with the same metadata (label, notes, capabilities, swap, stateless, mail, assets; processes/hibernate/jit for rootfs). It sends the expected digests with the upload; the target console hashes what arrives and refuses before storing anything if one differs. A target that already holds that version with different bytes refuses as today (409).

Why the pair fits CI better than releases copy: each step holds one credential under the env vars CI already uses, so the reviewer-gated production job never needs the staging token beside the production one (or it can, in one job, as two steps). The directory can travel as a CI artifact between a staging job and the gated job, and it is inspectable.

Trust model unchanged. The target computes its own digests from the bytes it receives, writes its own manifest, and signs its own channel pointers with its own key. The only thing taken from the source is the list of artifact digests the operator chose to copy. Artifacts are byte-identical; the target's manifest bytes differ (its own built_by/built_at), which is correct because each console signs its own.

New console surface: two read doors, GET .../releases/{version}/manifest and GET .../releases/{version}/artifacts/{file} (streamed), open to the same roles as GET .../releases (publish, deploy, account members), app-bound as today. Binary, static and rootfs releases.

Docs: a "staging tests X, production promotes X" CI recipe in docs/site/cli.md, and the "once per instance per deploy, not once per copy" line in docs/site/stateless-replicas.md.

Witness: an end-to-end test across two in-process consoles: ship to A, pull, ship --from-release to B with a deploy credential, artifact digests identical; a tampered file is refused locally and a forged expected digest is refused by the console. Target stays 2026-11-28.

Item 1 MERGED as 65951fb (2026-11-25). Not released yet; it ships on Paul's go.

How production promotes the exact build staging tested:

# staging job (staging console, its deploy credential)
carlos ship --app shop --version v12 ./bin/server
carlos promote --app shop v12 edge
# wait for staging to serve v12, run tests
carlos releases pull v12 --app shop --out release   # keep release/ as a CI artifact

# gated production job (production console, its own deploy credential)
carlos ship --from-release release --app shop
carlos promote --app shop v12 edge
  • Pull checks every file's size and sha256 against the source manifest. Ship re-checks them locally, and the production console hashes what arrives and stores nothing if any file differs.
  • Each console writes its own manifest and signs its own channel pointers, so the files are byte-identical and the manifests are not.
  • Binary, static and rootfs releases are all covered. Each step uses one credential via the usual CARLOS_CONSOLE and CARLOS_SERVICE_TOKEN.
  • The full recipe is in docs/site/cli.md, "Staging tests X, production promotes X".
  • Item 2's line ("once per instance, not once per copy") is now in docs/site/stateless-replicas.md.