Architect: connect

Architect and the deploy flow

Run an app’s code and what it runs on from one board: Deploy, Promote, and Roll back for the code, plans you approve for its infrastructure, on the same staging and production. How to set both up, in order, and keep them in agreement.

breakaway has two lanes for one app. The deploy flow ships its code: every merge deploys staging, Promote takes it to production, and Roll back takes it back. Architect runs what the code runs on: its Worker’s settings and bindings, and the databases, namespaces, buckets, queues, containers, routes, and custom domains around it, by plans you approve. Set up together, they share one staging and one production, one set of tokens, and one freeze.

#Which lane does what

The deploy flowArchitect
ChangesThe Worker’s code, its variables and secrets, Durable Object classes, containers’ images, and the database migrations you run before a deployThe resources around the code, and the Worker settings its file manages
Written inThe code, the wrangler config, and .github/breakaway-pipeline.json.github/breakaway-infra/<environment>.json
On mergeDeploys stagingPlans; the plan waits for you
To productionPromote to production…A plan for production, which you approve
Going backRoll back… to a versionThe board rolls back a plan whose health check failed; for the rest, a new plan
Its workflowsdeploy.yml, promote.yml, rollback.ymlbreakaway-infra.yml
Its tokenCLOUDFLARE_API_TOKEN in the GitHub environments staging and productionThe same one, widened

#Set it up, in order

Start from a repository that deploys a Worker with wrangler. Each step ends in a check.

#1. Move it to the deploy flow

On the GitHub view, Deploy with breakaway, then Move to breakaway’s deploy flow: an agent writes .github/breakaway-pipeline.json and the workflows npx breakaway pipeline init renders, in a pull request. Before you merge it, do your part: the staging and production Workers, the GitHub environments staging and production, each limited to the default branch with its token as CLOUDFLARE_API_TOKEN, the variable CLOUDFLARE_ACCOUNT_ID, and the App’s Actions and Variables (GitHub: move a repository to the deploy flow).

Merge it, then press Turn on deploys.

Check: the GitHub view shows Live now, with staging deployed from the merge.

#2. See staging and production on Infrastructure

Once deploys are on, the board adds two environments for the repository at its next sync, staging and production, pointing at the pipeline’s Workers. There’s nothing to add by hand. Their deploys show on their pages, and on the GitHub view as before.

Connect Cloudflare’s read-only token on Connections, if you haven’t (Tokens, GitHub, and the apply workflow).

Check: each environment’s map shows its Worker and what it uses, with health and cost, and its recent deploys.

#3. Describe both as code

On each environment’s page, Describe it as code, then Propose it; or have an agent run npx breakaway infra adopt staging and infra adopt production in one pull request. The files say what already runs, so their plans change nothing (Describe it as code).

Check: both pages show their desired state, and no drift.

#4. Widen the tokens, and add the apply workflow

The deploy flow’s GitHub environments are Architect’s too: same names, same secret. Don’t add a second token. Widen each environment’s existing one with the writes its file needs (Each environment’s write token). Then:

Check: the repository’s Infrastructure tokens checklist on Connections reads All in place.

#5. Change staging, then production

Make a small change on staging’s console and approve it, then the same on production (Get started with Architect). Production has production gates: every plan there waits for you.

Check: both plans read Applied, and each environment’s audit trail has the plan, your approval, and the apply.

#Day to day

#Freeze is the deploy pause

Freezing production is one switch for both lanes:

Without the App’s Variables permission the freeze still holds on the board, and the board still refuses Promote, but the workflows don’t know; Connections shows Deploy pause with the fix (Freeze, gates, and locks).

#Keep the wrangler config and the file in agreement

A few Worker settings are in both lanes’ files: its bindings, compatibility date and flags, Workers Logs, placement, and cron triggers. Each deploy sets them from the wrangler config; each plan sets them from the environment’s file. When the two disagree, every deploy puts back what the wrangler config says, and the board shows the difference as drift.

#Add a resource the code uses: make it first, bind it second

A deploy fails when the code binds something that doesn’t exist yet. So adding, say, a queue the Worker sends to takes two pull requests, in this order:

  1. Make it. Add the queue to staging’s file, from the console’s Add resource, or with npx breakaway infra add queue staging name=exports worker=widgets-api-staging and a pull request. Approve its plan. The queue now exists.
  2. Bind it. A pull request that adds the binding to the wrangler config and the code that uses it, and the same binding to the file if it manages the Worker’s bindings. Merging deploys staging with the binding.

Then the same for production: its file in one pull request, approved; Promote takes the code there. Removing works the other way round: stop using it and deploy, then remove it from the file.

#Without the deploy flow

Architect works on a repository with no pipeline too. You deploy its code your own way, and Architect runs what it runs on: add its environments with Add an environment, and every step above from step 2 on applies, except that a freeze stops plans only, and there’s no Promote or Roll back. A new project can get both from the start (Patterns).