Deployment pipeline
Traced at commit ffe4e48 ·
tools/deploy/{stage-autodeploy,build-and-push,gate-dry-run,promote,release-watch}.sh ·
infra/{stage,prod}/*.compose.yml
Summary
- A job on the stage machine finds a merge to
mainwithin 5 minutes. - The job polls the repository. The platform uses no webhook.
- The job builds 6 images and pushes them to a private registry.
- The job deploys stage, then runs a full rehearsal against it.
- A passing rehearsal records the commit as promotable.
- A failing rehearsal stops the commit there.
- Production is a separate step. A person tags a release.
- Production pulls images. Production never builds.
Workflow 1 — merge to stage
- A merge lands on
main. - A job on the stage machine polls every 5 minutes and notices the new commit.
- The job builds 6 images.
- The job pushes the images to a private registry.
- The job deploys stage from the compose project that serves it.
- The job runs a full rehearsal: about 1,125 dials and 10,000 events.
- A passing rehearsal writes a marker that records the commit as promotable.
- A failing rehearsal writes nothing. The commit stops there.
Workflow 2 — tag to production
- A person tags a release.
- The tag states the intent. The tag does not grant the release.
- If the tagged commit has not passed a rehearsal, the platform rehearses it first.
- The platform promotes the commit only if that rehearsal passes.
- Production pulls the images that were already proved.
- The platform then polls the production health endpoint.
Production never builds. The production machine has 2 GB of memory. A build of this stack passes 3.6 GB and takes the deployment tool down with it. Stage is the build machine. Production only pulls.
Design choices
- The job polls instead of receiving a webhook.
- A webhook needs a public endpoint, a shared secret and a way to rotate that secret.
- This path is not sensitive to a delay of 5 minutes.
- The job finds its deployment target from the labels of the running containers.
- The job does not use a stored name. A stored name goes stale when somebody recreates the app.
- A stale name deploys successfully to a stack that serves nobody.
Known gap
- A separate job builds the documentation site.
- The site is not one of the 6 images.
- A merge does not rebuild the documentation site.
- Run
tools/deploy/deploy-docs.shto publish a documentation change.
Rehearsals — what the gate actually runs, and what it cannot prove.