Skip to content

Deployments

Stratum deploys a commit after it merges. There are two ways to say how, and a project can use either or both:

Static targets (deploys:)Deploy pipelines (deploy:)
Declared in.stratum/policy.yaml.stratum/ci.yaml
What runsStratum uploads the tree as committed to a providerYour own commands, in a container, on the instance’s CI executor
Build step, database migrations, smoke testsNoYes: they are steps
Ordered environments (staging, then production)No: entries are independentYes
Where the provider credential livesStratum’s database, encrypted, as a project secretThe executor’s own secret store. Not in Stratum at all
NeedsDEPLOY_SECRET_KEY, the deploy queueThe deploy queue, plus the CI executor with a deploy target for the project

Static targets are the small option: a static site, a Worker with no build. Nothing about them has changed, and the first half of this page is about them. A project that needs npm ci, a bundler, wrangler d1 migrations apply, or a staging environment that must pass before production uses a deploy pipeline.

Both kinds share one history, one approval gate, one retry and one rollback action. Neither gives you a preview environment for an unmerged change. Read Limitations before you point production at either.

Zero to a live deploy with a static target. (For a pipeline, start at Setting it up.) Step 1 is once per instance, steps 2–4 once per project; after that merging is the whole workflow. Each step links to its reference section for the detail this skips.

1. Confirm the instance can deploy — once, by whoever runs it

Section titled “1. Confirm the instance can deploy — once, by whoever runs it”

Two things the application cannot provision for itself, and neither failure is obvious from the UI:

MissingWhat you see
DEPLOY_SECRET_KEYStoring a secret fails; every deploy fails with DEPLOY_SECRET_KEY is not configured on this instance…
the DEPLOY_QUEUE bindingNothing at all — a merge never enqueues a deploy, so no row is written and no error is shown
Terminal window
wrangler secret put DEPLOY_SECRET_KEY --env production
wrangler queues create stratum-deploys
wrangler queues create stratum-deploys-dlq

On an instance you do not operate, ask its operator — there is no way to check from the UI. Detail, including why rotating the key is destructive: Operating a Stratum instance.

The secret names are fixed — the deploy reads these exact names from the project store.

Cloudflare (cloudflare-pages and cloudflare-workers):

SecretWhere to get it
CLOUDFLARE_API_TOKENdash.cloudflare.com/profile/api-tokens → Create Token → Custom token. One permission is enough: Account ▸ Workers Scripts ▸ Edit. Shown once — copy it immediately.
CLOUDFLARE_ACCOUNT_IDThe id in any dashboard URL: dash.cloudflare.com/<account-id>/…
CLOUDFLARE_WORKERS_SUBDOMAINWorkers & Pages → your <subdomain>.workers.dev. Optional, but without it the deploy succeeds and records no URL.

Vercel:

SecretWhere to get it
VERCEL_TOKENVercel → Account Settings → Tokens.
VERCEL_PROJECT_IDThe Vercel project’s Settings → General → Project ID, or vercel project ls.
VERCEL_TEAM_IDOptional, but required in practice for a team-scoped token — without it the API resolves against your personal account.

Project → Settings → Deploy secrets, or:

Terminal window
curl -X PUT https://app.usestratum.dev/api/projects/@acme/site/secrets/CLOUDFLARE_API_TOKEN \
-H "Authorization: Bearer $STRATUM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"value":"…"}'

Must be a project admin, and not an agent — agent tokens are refused on every secret route. There is no read path: nothing returns a stored value. More: Storing a secret.

Commit one of these as .stratum/policy.yaml. The evaluators: block is not optional — a policy file without it is malformed, and a malformed policy blocks every merge in the project, with an error about evaluators that will not obviously point back here. See Before you start.

# Static site: publishes ./public as committed.
evaluators:
- type: diff
deploys:
- name: site
target: cloudflare-pages
dir: public
secrets: [CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID]

Do not add CLOUDFLARE_WORKERS_SUBDOMAIN to that secrets: list. Naming a secret there makes it required, which turns the optional “no URL on the row” outcome into a failed deploy. The target loads it anyway when it is stored.

# Worker script: uploads the .js/.mjs files in the tree.
evaluators:
- type: diff
deploys:
- name: api
target: cloudflare-workers
secrets: [CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID]
# Vercel: uploads the source; Vercel builds it. Human approval before it ships.
evaluators:
- type: diff
deploys:
- name: production
target: vercel
requiresApproval: true
secrets: [VERCEL_TOKEN, VERCEL_PROJECT_ID]

Remember a static target has no build step: Cloudflare targets publish the tree as committed, so commit your built output (or use a deploy pipeline). vercel is the exception — it uploads the source and Vercel builds it.

Deploys run after a merge survives the post-merge check — not on the merge event itself, so a change that gets auto-reverted never deploys. Watch it at Project → Deploys. First run reaches succeeded, failed, or pending_approval if you set requiresApproval.

Matched against the exact text a deployment records, so you can search for what you actually see.

What you seeWhat it meansFix
No deployment row at allThe merge never enqueued: the post-merge check reverted or failed the merge, or the instance has no DEPLOY_QUEUE bindingCheck the post-merge check passed (or is not configured); then step 1
No deployment row, but the merge looks fineA bound DEPLOY_QUEUE can still fail on send. The request is then written to the event outbox, which a five-minute cron sweeps and forwards, so the row appears late rather than neverWait out one sweep. If the outbox write failed too the request is genuinely gone, and the log says so: Post-merge deploy request could not be made durable and is lost. There is no row to retry, so merge again or deploy out of band
One deployment for several changes merged through merge-batchExpected. A batch is one push, so it gets one deploy: of the batch’s final commit, recorded against the last change that landed. See Batch mergesNothing to fix. The changes that landed earlier in the batch have no deployment of their own, and their commits are included in the one that ran
Status skippedThere was nothing configured to deploy at that commit — no policy file, or a policy with no deploys: entriesCheck .stratum/policy.yaml is committed on the default branch and declares deploys:. skipped never means an error
Missing project secret: X — add it in project settingsThe policy names a secret the store doesn’t haveAdd it (step 3); names are case-sensitive
DEPLOY_SECRET_KEY is not configured on this instance…Instance prerequisite missingStep 1
Could not decrypt project secret… may have been rotatedDEPLOY_SECRET_KEY changed after the secret was storedRe-enter every secret for the project — there is no re-encryption path
Policy file … is present but invalidYAML didn’t parse, or evaluators: is missingFix the file; note this also blocks merges
Could not read the tree at <sha>The merge commit is unreachable — force-push, auto-revert, or re-importMerge again; the commit is pinned, so Stratum will not deploy a different tree
403/401 from the providerToken lacks permission, or is scoped to the wrong account/teamCloudflare: Workers Scripts ▸ Edit. Vercel: set VERCEL_TEAM_ID for a team token
503 DEPLOY_QUEUE_UNAVAILABLE on Approve or RetryNo DEPLOY_QUEUE bindingStep 1
succeeded but no URL on the rowCLOUDFLARE_WORKERS_SUBDOMAIN isn’t storedStore it — the deploy itself worked
succeeded but the site is unchanged (Vercel)succeeded means accepted for build; Stratum does not pollCheck the build in Vercel — a post-handoff build failure is invisible here

Before you start: your policy still needs evaluators:

Section titled “Before you start: your policy still needs evaluators:”

A .stratum/policy.yaml that has a deploys: block but no top-level evaluators: array is treated as malformed, and a malformed policy blocks every merge in the project. The policy parser requires evaluators to be present and to be an array; anything else is a parse failure, and a parse failure fails the merge gate closed:

Policy file .stratum/policy.yaml is present but invalid (missing or non-array ‘evaluators’); merges are blocked until it is fixed.

That is intended behaviour for the merge gate, but it means “I only want deploys” is not a configuration you can write. If you have no opinion about evaluation, declare the cheap default explicitly:

# The minimum viable deploy-only policy. `evaluators:` is REQUIRED — a policy
# file without it is malformed and blocks all merges.
evaluators:
- type: diff
deploys:
- name: site
target: cloudflare-pages
dir: public

The secret scanner runs on every change regardless of what this file says, so a lone diff evaluator is not “no gate at all”.

The same rule applies to the JSON form, stratum.config.json. Stratum reads .stratum/policy.yaml first and, only if it is absent, stratum.config.json. A file that is present but broken is an answer — Stratum does not fall through to the other one.

  1. A change merges.
  2. The post-merge smoke check runs (if the policy configures one). A failing check auto-reverts the merge.
  3. Only if the post-merge check did not revert or fail, Stratum enqueues a deploy of the merge commit. A deploy is never triggered from the change.merged event, because that event fires before the check runs.
  4. The deploy consumer reads the tree at the pinned merge commit and parses the policy out of those bytes. Configuration and code are therefore always from the same commit: a policy change that lands after your merge cannot retroactively change how your merge deploys.
  5. One deployments row is created per deploys: entry, and each entry is run in turn. If the commit’s .stratum/ci.yaml has a deploy: section, one row is created for its first environment as well — see Deploy pipelines.

Things that do not trigger a deploy:

  • A merge that the post-merge check reverted.
  • A push straight to the project’s default branch (deploys hang off the change merge path).
  • An instance with no DEPLOY_QUEUE binding configured.

Before it runs, the deploy re-reads the change’s status and the project’s deletion state. A change that was reverted between the merge and the deploy is refused, and so is a project that is being deleted.

POST /api/projects/{name}/changes/merge-batch merges many changes in one push, and triggers one deploy: of the commit the push left the default branch at. That commit contains every change in the batch that landed, so deploying each change’s own commit in turn would publish a series of intermediate trees to arrive at the same place.

  • The deployment is recorded against the last change that landed (its changeId). The other changes in the batch have no deployment row.
  • It runs after the changes are recorded as merged, like any other deploy.
  • A batch runs no post-merge check, so there is no auto-revert that could stop it.
  • A batch in which nothing landed (every change conflicted or was skipped) deploys nothing.
  • This applies to static targets and pipelines alike. Before this, a batch merge deployed nothing at all.

A pipeline is a list of environments, in order, each with the steps that deploy a commit to it. It lives in the deploy: section of .stratum/ci.yaml, beside the CI steps that gate the merge.

.stratum/ci.yaml
steps:
- name: test
run: npm test
deploy:
environments:
- name: staging
steps:
- name: install
run: npm ci
- name: migrate
run: npx wrangler d1 migrations apply my-app-staging --remote --env staging
- name: deploy
run: |
export WRANGLER_OUTPUT_FILE_PATH=/tmp/deploy.ndjson
npx wrangler deploy --env staging
# Record the Worker version id, so this deployment can be rolled back to.
jq -r 'select(.type == "deploy") | .version_id' "$WRANGLER_OUTPUT_FILE_PATH" \
> "$STRATUM_DEPLOY_VERSION_FILE"
- name: smoke
run: curl -sfS --retry 5 https://my-app-staging.example.workers.dev/health
- name: production
requiresApproval: true
steps:
- name: install
run: npm ci
- name: migrate
run: npx wrangler d1 migrations apply my-app --remote --env production
- name: deploy
run: npx wrangler deploy --env production
rollback:
- name: install
run: npm ci
- name: rollback
run: npx wrangler rollback "$STRATUM_ROLLBACK_VERSION" --env production --message "rollback"

What happens when a change merges:

  1. Stratum reads .stratum/ci.yaml from the merged commit and creates one deployment, for the first environment (staging). Nothing exists yet for production.
  2. The deployment is handed to the CI executor, which checks out that commit in a fresh container and runs the environment’s steps in order.
  3. If every step passes, the deployment is succeeded, and Stratum creates the deployment for the next environment. Because production says requiresApproval: true, it is created at pending_approval and waits.
  4. Someone approves it. It runs the same way.

Why the file is read from the merged commit

Section titled “Why the file is read from the merged commit”

The CI half of .stratum/ci.yaml is read from the base branch, because a change must not be able to choose the gate it is judged by. The deploy half is read from the merged commit, for a different reason with the same effect: by the time a deploy runs, that commit has passed every gate the project has. .stratum/ci.yaml is protected configuration, so a change that edits the pipeline needs an independent approval before it merges. The pipeline that deploys a commit is the one a second person approved, and it is always the pipeline that commit itself carries — configuration and code are one commit, as with static targets.

A deploy job is never started for an unreviewed change. Deploy jobs run only for a commit on the default branch, in a different container class from CI jobs, and CI jobs have no way to obtain a deploy credential.

FieldRequiredRules
environmentsyes1 to 8 environments, in promotion order.
environments[].nameyes^[a-z][a-z0-9-]{0,31}$, unique. This is the deployment’s name: what history, supersession and serialization group by. It must not be the name of a deploys: entry in the policy file at the same commit.
environments[].requiresApprovalnoBoolean, default false. A quoted "false" is rejected, not coerced. true creates the deployment at pending_approval.
environments[].stepsyes1 to 16 steps. Each has name (the check-name rule), run (a bash script, run with set -eo pipefail at the repository root, at most 4000 characters) and optional timeoutMinutes (default 10, at most 120).
environments[].rollbacknoSteps a rollback runs instead of steps, when the deployment being rolled back to has a recorded version. Same shape as steps.
timeoutMinutesnoWall-clock limit for one environment’s job, default 30, at most 120, and never more than the executor’s CI_MAX_JOB_MINUTES.
instancenoContainer size, as for CI.
network.allownoUp to 16 exact hostnames the job may reach, e.g. the deployed site for a smoke test. The executor’s operator can turn this off (CI_ALLOW_PROJECT_HOSTS) and list hosts per target instead.

Unknown fields are rejected, not ignored, at every level. requireApproval (missing the “s”) fails the whole section rather than being dropped, which would have turned a gated production deploy into an ungated one.

A broken deploy: section deploys nothing, and does not block merges. It is recorded as one failed deployment named (pipeline) with the reason, at the commit that carries it. This is the same rule a bad deploys: entry follows: deploys run after a merge, and are reported where you will see them rather than turned into a second merge gate. A project whose .stratum/ci.yaml has a deploy: section and no steps at all is a project with no CI steps; its merges are not gated on first-party checks.

Every step runs in one checkout of the merged commit, in one container, so a file written by one step is there for the next. Environment variables are not carried from step to step.

VariableMeaning
STRATUM_ENVIRONMENTThe environment’s name.
STRATUM_COMMIT_SHAThe commit being deployed.
STRATUM_DEPLOYMENT_IDThe deployment’s id in Stratum.
STRATUM_DEPLOY_VERSION_FILEWrite the deployed version here (one line). It is stored on the deployment and is what a rollback is given.
STRATUM_DEPLOY_URL_FILEWrite the deployed URL here (one https:// line) to have it shown on the deployment.
STRATUM_ROLLBACK, STRATUM_ROLLBACK_VERSIONSet only during a rollback.
Anything the executor’s operator put in the target’s envPlain configuration such as CLOUDFLARE_ACCOUNT_ID. Never a secret.
CLOUDFLARE_API_TOKENA fixed placeholder, not a token, set when the target has a credential for api.cloudflare.com. Wrangler refuses to run non-interactively without the variable; see below.

The job holds no credential. A request the job makes to a host the executor has a credential for — the Cloudflare API, typically — leaves the container without one. The executor attaches its own credential to it outside the container, after checking that the request is HTTPS and for exactly that host, and it never follows a redirect with the credential attached. Whatever Authorization header the job sent is replaced. So npx wrangler deploy, curl -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" https://api.cloudflare.com/... and anything else that talks to that host simply work, and nothing the job runs — a dependency’s install script included — can read the token, because it is not there.

The network is denied by default, as for CI: the package registries, the target’s credentialed hosts, the target’s allowHosts, and the pipeline’s network.allow.

Deployments of one environment never run at the same time. If a second merge lands while the first is still deploying to staging, the second waits at queued; it is not handed to the executor until the first has finished, successfully or not. Two pipelines interleaved against one environment could leave the newer schema under the older code.

A later merge is never overtaken by an earlier one:

  • When the running deployment finishes, the newest waiting one runs next, and any older ones still waiting become superseded. The environment goes straight to the latest commit.
  • A deployment that arrives after a newer commit has already succeeded in the same environment is superseded, not run.

Different environments are independent: staging of a new merge can run while production of an earlier one is running.

The pipeline stops at the failing step. The steps after it do not run, the deployment is failed, and nothing is promoted: the next environment’s deployment is never created, so there is nothing for anyone to approve by mistake. The deployment records which step failed and why, how each step ended, and the end of the failing step’s output; the full log of every step is on the deployment page (Full log) and at GET /api/deployments/{id}/log, for project writers.

A failed step is not rolled back. A pipeline whose migrate step passed and whose deploy step failed has migrated the database and not deployed the code. That is the state the environment is left in, and the reason migrations have to be compatible with the version already running (see Rollback).

Retry re-runs the environment’s steps from the first one, at the same commit, as a new attempt. Promotion continues from a retry that succeeds — unless the next environment already has a deployment for that commit, in which case that one is left as it is, for you to retry or approve.

If the executor never reports back — it was redeployed mid-job, or lost — the deployment is failed when its time runs out (the job’s limit, plus the wait for a slot, plus two minutes), with a reason saying that its steps may have run in part or in full. Stratum does not re-run it on its own: check the environment, then retry.

Deploy jobs count against the executor’s one concurrency cap (CI_MAX_CONCURRENT_JOBS); there is no slot reserved for them. A deploy job that has to wait takes the next slot that frees ahead of waiting CI jobs, and waits in its own short queue (DEPLOY_MAX_QUEUED_JOBS, default 4), so a burst of CI jobs can neither refuse a deploy nor stand in front of a rollback. The longest a deploy waits is the time left on the shortest job already running.

Three things, the first two once per instance.

1. The instance has the CI executor. A pipeline runs on it; without it a pipeline deployment fails with a reason saying so. See Self-hosting: deploy the executor. The main Worker also needs APP_URL set to its public origin (the executor reports back to it) and the deploy queue from Operating a Stratum instance. DEPLOY_SECRET_KEY is not needed for pipelines: Stratum stores no credential for them.

2. The executor has a deploy target for the project and environment. This is done by whoever operates the executor, on the executor’s Worker, not in Stratum. In the executor’s wrangler.toml:

[vars]
DEPLOY_TARGETS = '''
{
"prj_0123456789abcdef": {
"staging": {
"credentials": [{ "host": "api.cloudflare.com", "secret": "DEPLOY_CRED_MYAPP_STAGING" }],
"env": { "CLOUDFLARE_ACCOUNT_ID": "0123456789abcdef0123456789abcdef" },
"allowHosts": ["my-app-staging.example.workers.dev"]
},
"production": {
"credentials": [{ "host": "api.cloudflare.com", "secret": "DEPLOY_CRED_MYAPP_PRODUCTION" }],
"env": { "CLOUDFLARE_ACCOUNT_ID": "0123456789abcdef0123456789abcdef" },
"allowHosts": ["my-app.example.workers.dev"]
}
}
}
'''

and then, once per secret named there, in the ci-executor/ directory:

Terminal window
npx wrangler secret put DEPLOY_CRED_MYAPP_STAGING
npx wrangler secret put DEPLOY_CRED_MYAPP_PRODUCTION
npx wrangler deploy
FieldMeaning
top-level keyThe project’s id (prj_…), from GET /api/projects/{namespace}/{slug}. An id, not a name: a name can be reused by a different project.
second-level keyThe environment name, exactly as in the pipeline.
credentials[].hostOne exact hostname. The credential is sent there and nowhere else.
credentials[].secretThe name of a Wrangler secret on the executor. It must start with DEPLOY_CRED_. The value is sent as Authorization: Bearer <value>.
envPlain variables for the steps. Not for secrets: they are passed into the container. CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_BASE_URL, STRATUM_* and a few others cannot be set here.
allowHostsHostnames the job may reach without a credential.

How the credential is scoped:

  • To the executor. It is a Wrangler secret on the executor Worker. It is never sent to Stratum, never stored in Stratum’s database, and never part of the request Stratum sends, which says only “deploy this commit to this environment”.
  • To deploy jobs. Only the deploy profile’s own job class can register the handler that attaches it. A CI job — code from a change nobody has reviewed — runs in a different class that is built without it.
  • To one project and one environment. A deploy job for a project or environment with no entry is refused. A staging job cannot use the production secret: use a separate token per environment, and scope each token at the provider as narrowly as it allows.
  • To one host. And to requests that are HTTPS, on the default port, with no redirect followed.

For a Cloudflare Worker with D1, the token needs to be able to deploy Workers and edit D1 for the account in question (the Edit Cloudflare Workers template plus D1 ▸ Edit is a reasonable start; scope it to the one account), plus whatever else your steps do — creating queues, for example.

A deploy job dispatched to an executor with no matching target, or whose secret is not set, is refused, and the deployment is failed with a reason naming what is missing (never a value). GET /health on the executor reports a malformed DEPLOY_TARGETS without taking CI down with it.

3. The project commits a deploy: section, as above.

A deployment that succeeds records a version if a step wrote one to $STRATUM_DEPLOY_VERSION_FILE: a short label (letters, digits and ._:@/+-, at most 128 characters; anything else is ignored). For a Cloudflare Worker, record the Worker version id. wrangler deploy prints it as Current Version ID, and writes it to the file named by WRANGLER_OUTPUT_FILE_PATH as the version_id of the deploy record, which is the reliable way to read it in a script (see the example above). That id is what wrangler rollback <version-id> takes.

A static target records the commit as its version, since the tree as committed is what it published.

deploys: is a top-level list in .stratum/policy.yaml. Each entry is a mapping:

deploys:
- name: marketing-site # required
target: cloudflare-pages # required
dir: dist # optional
secrets: # optional
- CLOUDFLARE_API_TOKEN
- CLOUDFLARE_ACCOUNT_ID
requiresApproval: false # optional, default false
FieldRequiredRules
nameyes^[a-z][a-z0-9-]{0,31}$ — lowercase letters, digits and dashes, max 32 characters. It is this deploy’s stable identity across merges, and it is what supersession and the deployments list group by. Must be unique within the file.
targetyesOne of cloudflare-pages, cloudflare-workers, vercel.
dirnoRepo-relative directory to publish. Must be relative (no leading /), contain no .. segment and no null byte, max 255 characters. The prefix is stripped, so dir: dist publishes dist/index.html as index.html. Omit it to publish the whole tree.
secretsnoUp to 16 secret names, each ^[A-Z][A-Z0-9_]{0,63}$. Naming a secret here makes it required: a declared name that is not stored fails the deploy. You do not have to list the target’s own secrets — they are loaded either way.
requiresApprovalnoBoolean (a quoted "false" is rejected, not coerced). true holds the deployment at pending_approval until someone approves it.

A policy file may declare at most 16 deploys: entries. Anything beyond the sixteenth is not run and is reported as a single failed deployment row naming how many were declared — siblings run sequentially inside one Worker invocation, so an unbounded list would be an unbounded merge.

Unknown fields are rejected, not ignored. An entry containing requireApproval (missing the “s”) is refused with a reason naming the field, rather than being silently rebuilt without it — which would turn a deploy you gated behind an approval into one that ships straight to production.

A rejected entry becomes a visible failed deployment

Section titled “A rejected entry becomes a visible failed deployment”

Bad deploys: configuration does not block your merge, and it is not dropped in silence either: each rejected entry is recorded as a failed deployment row carrying the reason (deploys[0]: unknown target "netlify" (expected one of cloudflare-pages, cloudflare-workers, vercel)). A deploy that was written and never runs means production quietly stopped updating, so it is reported where you will see it — on the project’s Deployments page.

The malformed-policy row is a post-merge fallback, not the merge block

Section titled “The malformed-policy row is a post-merge fallback, not the merge block”

A policy file that fails to parse at all produces one failed deployment row (named (unresolved)) pointing at the file. That row is not the merge gate reporting itself — it is a separate, later check, and the distinction matters because the two look at different commits:

  • Before the merge, the gate parses the project’s current policy. A file that does not parse blocks the merge outright, and no deployment row exists because no merge happened.
  • After a merge, the deploy runner re-parses the policy out of the pinned merge commit’s tree, so configuration and code always come from the same commit. If that commit’s policy is the unparseable one, there is nothing to deploy and nothing to name, so the failure is recorded as an (unresolved) row reading Policy file .stratum/policy.yaml is present but invalid (…); no deploy configuration could be read from it. rather than being dropped in silence.

The two reads happen at different times against different trees, so they can disagree — which is exactly when this row shows up. Treat it as “the commit that was deployed had a broken policy”, not as a second copy of the merge error. Fixing the project’s current policy unblocks merges; it does not retroactively change a row already recorded against an older commit, and it does not re-run that deploy. Retry it once the fix is merged.

All three targets are first-class. Secrets are read from the project’s secret store by these exact names.

cloudflare-pages — a static site on Cloudflare

Section titled “cloudflare-pages — a static site on Cloudflare”
SecretMeaning
CLOUDFLARE_API_TOKENrequiredAPI token with Workers Scripts edit permission on the account.
CLOUDFLARE_ACCOUNT_IDrequiredThe account that owns the Worker.
CLOUDFLARE_WORKER_NAMEoptionalScript name to publish as. Defaults to the deploy’s name.
CLOUDFLARE_WORKERS_SUBDOMAINoptionalYour account’s workers.dev subdomain. Without it the deployment succeeds with no URL (see below).

This target is implemented against Workers Static Assets, not Pages Direct Upload. The target: name is the user-facing name for “publish my static site on Cloudflare” and is unchanged, but the implementation uploads an asset manifest and publishes a Worker with an assets binding and no main_module. Two reasons: Pages Direct Upload’s asset endpoints (the upload-token, check-missing and asset-upload calls Wrangler drives) are not in Cloudflare’s public API reference, so implementing it would mean guessing at a surface that carries a production credential; and Cloudflare itself steers new projects to Workers rather than Pages. The practical consequences are that the deployment appears in your Cloudflare account as a Worker, not as a Pages project, and that Pages-specific features (preview branches, the Pages dashboard) do not apply.

Content types are set at upload time from the file extension, which is what visitors are served. An unrecognized extension is uploaded as application/octet-stream.

SecretMeaning
CLOUDFLARE_API_TOKENrequiredAs above.
CLOUDFLARE_ACCOUNT_IDrequiredAs above.
CLOUDFLARE_WORKER_NAMEoptionalScript name. Defaults to the deploy’s name.
CLOUDFLARE_WORKER_MAIN_MODULEoptionalEntry-point path within the deployed tree.
CLOUDFLARE_WORKERS_SUBDOMAINoptionalYour workers.dev subdomain; without it the deployment succeeds with no URL.

Only .js and .mjs files are uploaded, as ES modules. Everything else in the selected tree (a README, a lockfile) is skipped, and the count of skipped files is reported on the deployment. If no module is found, the deploy fails.

Without CLOUDFLARE_WORKER_MAIN_MODULE, the entry point is the first of worker.js, worker.mjs, index.js, index.mjs, src/index.js, src/index.mjs present in the tree; if none is, the deploy fails and names the candidates. When you do set it, it is validated against the tree — a typo fails with a reason instead of deploying some other file.

The upload sends a pinned compatibility_date (currently 2026-08-20) rather than the current date, so redeploying the same commit cannot silently change its runtime behaviour.

SecretMeaning
VERCEL_TOKENrequiredVercel API token.
VERCEL_PROJECT_IDrequiredThe Vercel project to deploy into.
VERCEL_TEAM_IDoptionalRequired in practice for a team-scoped token — without it the API resolves the token against your personal account.

The whole tree is inlined (base64) into a single POST /v13/deployments with target: production, rather than uploaded file-by-file: one provider request instead of one per file, which is what the Worker’s subrequest budget can afford. Base64 inflates the payload by about a third, so the 25 MB tree limit becomes roughly a 33 MB request body — that is this target’s binding constraint.

A vercel deployment recorded as succeeded means “accepted for build”. Vercel answers as soon as it has queued the deployment (readyState: QUEUED) and builds asynchronously; Stratum does not poll for the result, because polling would hold a queue message open for the length of somebody else’s build. The provider’s state at hand-off and its deployment id are recorded in the row’s reason, e.g. provider state at hand-off: QUEUED (the provider finishes asynchronously; Stratum does not poll it); provider deployment dpl_…. A build that fails after hand-off is visible in Vercel, not in Stratum. If the API returns ERROR, CANCELED or BLOCKED outright, the deployment is recorded as failed.

The Cloudflare targets derive the deployment URL from CLOUDFLARE_WORKERS_SUBDOMAIN, because the account’s workers.dev subdomain is not part of the API surface these targets were written against and inventing a lookup for it would be a guess. If you do not store that secret, the deploy still succeeds — it just records no URL. Store it if you want a clickable link on the deployments page.

Note that CLOUDFLARE_WORKERS_SUBDOMAIN lives in the secrets table for uniformity, but it is not confidential: it is a public hostname component, written verbatim into the deployment’s url. Treat it as configuration that happens to be stored beside your credentials, not as a credential.

Secrets are per project, encrypted at rest (AES-GCM, with the project id and secret name bound as additional authenticated data), and there is no read path — no API, UI or CLI surface returns a stored value. Three things decrypt them: the deploy runner, the llm evaluator when a project brings its own model key (Getting started), and the webhook evaluator when its secretRef names the secret it signs requests with.

  • In the UI: Project → Settings → Deploy secrets. Add by name and value; delete by name. Values are never rendered back.

  • Over the API:

    Terminal window
    curl -X PUT https://app.usestratum.dev/api/projects/@acme/site/secrets/CLOUDFLARE_API_TOKEN \
    -H "Authorization: Bearer $STRATUM_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"value":"…"}'

Rules:

  • Names must match ^[A-Z][A-Z0-9_]{0,63}$.
  • Values are capped at 4096 bytes. The storage layer imposes no minimum, but an empty value is not useful: the settings form rejects it outright, and a target reads an empty required secret as missing and fails the deploy.
  • Writing an existing name replaces it.
  • Every write and delete is recorded in the audit trail (secret.written, secret.deleted).
  • The same store holds a webhook evaluator’s signing key, named from the policy with secretRef (CI Integration).

Only a project admin who is not an agent may manage secrets. An agent token is refused on every secret route, even when the agent’s owner is the project owner: deploy credentials are the one thing an agent identity is never trusted with. Deleting the project deletes its secrets and its deployment history.

With requiresApproval: true — on a deploys: entry or on a pipeline environment — the deployment is created at pending_approval and nothing runs. Someone then presses Approve on the deployment page, or calls POST /api/deployments/{id}/approve; the row moves to queued, is enqueued, and runs.

For a pipeline, the gate sits between environments: a production environment with requiresApproval: true gets its pending_approval deployment only after staging has succeeded for that commit. What you are approving has already been deployed and smoke-tested one environment earlier. If a newer commit reaches the same gate first, approving it supersedes the older one still waiting.

Approving requires project write access and a user identity. An agent token (stratum_agent_…) sets no user id and is refused.

Be precise about what that buys you. The guarantee is “not an agent identity” — exactly the same guarantee, and the same limitation, as a human review verdict. A user’s scoped API token and an MCP OAuth grant both authenticate as the user and are both accepted. It is therefore not evidence that a human was at a keyboard: an automation running under your token can approve a deploy. If your threat model needs a real human, this gate does not provide one.

Approval is single-use and safe to double-click: the status flip is a conditional update, so a second approver gets 409 DEPLOYMENT_NOT_PENDING rather than a second deployment of the same commit.

A finished deployment can be re-run from the Retry button or POST /api/deployments/{id}/retry. This creates a new attempt row for the same commit with attempt incremented, and enqueues it; the original row is kept, so the history shows both.

  • Only a terminal deployment (succeeded, failed, superseded, skipped) can be retried. Retrying a queued, running or pending_approval row is refused with 409 DEPLOYMENT_NOT_RETRYABLE — for pending_approval in particular, allowing it would route straight around the approval gate, because a retry row starts queued.
  • Retry requires project write access, and unlike approve it does accept an agent identity.
  • The originating change id is carried onto the retry, so the “was this change reverted?” check still applies. Retrying a change that has since been reverted is refused.
  • Two people retrying at once is safe: the second gets 409 DEPLOYMENT_RETRY_EXISTS.
  • A retry counts as the newest intent for that deploy name, even when the commit it re-runs is old — an operator re-running an earlier commit is asserting that they want it live.

A retry is not a way round a pipeline environment’s approval gate. A user’s retry carries that user’s approval and runs. An agent’s retry carries none: for an environment with requiresApproval: true it waits at pending_approval for a user, whether the deployment being retried was approved, or failed, or was superseded while it was still waiting. The check is made when the deployment is about to run, against the pipeline at the commit being deployed, so it does not depend on how the retry came about. Static targets keep the behaviour described above.

One limit to know: the gate that applies to a retry is the one declared at the commit being retried. If production had no requiresApproval when an old commit merged, an agent can retry that old commit’s production deployment without approval even though the pipeline has since gained the gate. Projects that add a gate later and let agents retry should treat old ungated deployments accordingly.

To put an earlier deployment back, use Rollback, which is explicit about what it is doing and is restricted to people who may approve.

Roll back to this deploy, on the page of any succeeded deployment, starts a new deployment of the same environment that puts back what that one deployed. Over the API it is POST /api/deployments/{id}/rollback.

A rollback redeploys an earlier version. It does not undo a database migration. Migrations are forward-only. After a rollback, the earlier code runs against the schema as it is now, including every migration applied since. If a later migration dropped or changed something the earlier code relies on, rolling back will not bring it back, and the rolled-back version may fail. Stratum does not run, generate or reverse “down” migrations.

The practical rule: make every migration compatible with the version that is already deployed (add before you use, stop using before you remove), so that the previous version always runs against the new schema. Then a rollback is safe by construction.

What a rollback runs:

The deployment being rolled back toWhat runs
Pipeline environment with rollback: steps, and a recorded versionThe rollback: steps, with STRATUM_ROLLBACK_VERSION set to that version. For a Worker, wrangler rollback "$STRATUM_ROLLBACK_VERSION"
Pipeline environment without rollback: steps, or with no recorded versionThe environment’s ordinary steps, at the earlier commit. This re-runs its migrate step too, which applies nothing if the migrations of that commit are already applied
Static targetThe tree at the earlier commit is published again

Either way the pipeline definition comes from the earlier commit, the one being put back.

For a Cloudflare Worker, wrangler rollback creates a new deployment of the chosen Worker version and makes it live at once. Cloudflare’s own limits apply and are worth knowing before you need them: only the 100 most recent versions can be rolled back to; a rollback is refused if a Durable Object class migration happened between the two versions, or if the earlier version is bound to a queue, KV namespace or R2 bucket that no longer exists; and, in Cloudflare’s words, resources connected to the Worker are not changed by a rollback — which is the same statement about D1 as the one above.

A rollback follows the same rules as any deployment:

  • Who: exactly the people who may approve a deployment — a project writer with a user identity. An agent token is refused. The rollback is its own approval, so it does not then wait at pending_approval.
  • Confirmation: the button opens a page that says what will be put back and repeats the migration caveat; the rollback happens when that page’s form is submitted. It works with JavaScript disabled.
  • Ordering: it waits its turn for the environment like any deployment, and takes an executor slot like any deploy job. It is the newest intent for the environment, so deployments of it that are still queued or pending_approval become superseded. It rolls back one environment and never promotes to a later one.
  • Audit: recorded as deployment.rolled_back, with who, the environment, the commit and the version.
  • Record: the new deployment carries rollbackOf, the id of the deployment it put back, and on success the version that is now live.

The next merge deploys on top as usual. If the commit you rolled back from is still on the default branch, the next deploy includes it again: roll back, then fix or revert.

StatusMeaning
pending_approvalrequiresApproval: true and nobody has approved it yet. Nothing has been uploaded.
queuedWaiting for the deploy consumer to pick it up — or, for a pipeline, for the environment: another deployment of it is still running.
runningA consumer holds a lease on the row and is uploading. For a pipeline: the CI executor has the job, and the row stays here until it reports.
succeededThe provider accepted the deployment. For vercel, this means accepted for build, not “live” — see above.
failedAnything that went wrong, with a reason: a rejected deploys: entry, an unreadable tree, a missing or undecryptable secret, DEPLOY_SECRET_KEY unset, a limit exceeded, a provider 4xx/5xx, an unreachable provider. For a pipeline: a step that failed or timed out, an invalid deploy: section, no executor or no deploy target for the project, or an executor that never reported.
supersededA newer merge of the same deploy name took over. Either this row had not started when the newer one ran, or the newer one had already succeeded by the time this one reached the front of the queue — in which case this deployment is refused rather than published, so an out-of-order delivery cannot put the older commit back into production.
skippedOnly one thing: there was nothing configured to deploy — no policy file at that commit, or a policy with no deploys: entries. Every operator error is failed, never skipped.

succeeded, failed, superseded and skipped are terminal.

A deploy that hits a provider error also stores a log tail: the provider’s response, with every secret value substituted out, truncated to 16 KiB. Redaction always runs on the full text before truncation, so a secret cannot survive by straddling the cut. The log tail is served only to project writers — never on the public read path, and never in a list response for a reader who cannot write.

A pipeline deployment’s log tail holds one line per step saying how it ended, then the end of the last step’s output. Its full log, step after step, is at GET /api/deployments/{id}/log for project writers, while the job runs and afterwards.

Deployments also emit events you can subscribe to with a project webhook: deployment.requested, deployment.succeeded, deployment.failed.

Every limit is checked before the first provider request goes out — a deploy that uploaded half a tree and then failed would leave the site in a state nobody asked for. Limits are applied to the tree after dir narrowing, so they judge the bytes actually being uploaded.

LimitValue
Files per deployment2,000
Total bytes per deployment25 MiB
Bytes per file10 MiB
Provider HTTP requests per deployment2,048
Stored log tail16 KiB
Deployment lease / queue visibility timeout15 minutes
Secret value4,096 bytes
Secrets named per deploy entry16
deploys: entries per policy file16

Exceeding one is a failed deployment naming the number, e.g. too many files: 2431 exceeds the 2000-file deploy limit. An empty selection is also a failure (no files found under "dist" at this commit — check the deploy's "dir"), not a silent no-op.

Sibling deploys from one merge run sequentially, not concurrently: they share one Worker invocation’s CPU, memory and subrequest budget.

Operating a Stratum instance with deploys enabled

Section titled “Operating a Stratum instance with deploys enabled”

Self-hosters need three things beyond the default deployment:

  1. DEPLOY_SECRET_KEY must be set as a Wrangler secret. It is the master key every project secret is derived from. Without it, storing a secret fails and every deploy fails with DEPLOY_SECRET_KEY is not configured on this instance, so deploy secrets cannot be decrypted.

    Terminal window
    wrangler secret put DEPLOY_SECRET_KEY --env production

    Rotating it makes every stored secret undecryptable. There is no re-encryption path: after a rotation, deploys fail with Could not decrypt project secret… and every project must re-enter its values. That now reaches further than deploys — a project whose policy names an LLM provider reads its provider key from the same store, so a rotation blocks the merge gate on those projects until the key is re-entered, not just their deployments.

  2. The queues must exist, and the DEPLOY_QUEUE binding must be configured. Without the binding, merges simply never enqueue a deploy, and approve/retry answer 503 DEPLOY_QUEUE_UNAVAILABLE.

    Terminal window
    wrangler queues create stratum-deploys
    wrangler queues create stratum-deploys-dlq
  3. The dead-letter queue has no consumer. stratum-deploys-dlq is configured as the DLQ for stratum-deploys, but nothing reads it: a message that exhausts its retries lands there and sits for manual inspection. Nothing alerts, and no deployment row is written by the DLQ itself. This is a deliberate v1 choice, not an oversight — but it means “the queue is healthy” is something an operator has to check, not something Stratum reports.

    In practice a message only reaches the DLQ for an indeterminate failure (D1 or KV unavailable, the project unreadable). A failed deployment is a result, not a delivery failure, and is acked with a failed row rather than retried; a malformed message is acked and logged.

The staging environment uses stratum-deploys-staging and stratum-deploys-dlq-staging so its messages can never be handed to the production consumer.

RouteAccess
GET /api/projects/{namespace}/{slug}/secretsProject admin, agents refused. Names and metadata only — never values.
PUT /api/projects/{namespace}/{slug}/secrets/{name}Project admin, agents refused.
POST /api/projects/{namespace}/{slug}/secretsForm-friendly create/replace (name, value in the body).
DELETE /api/projects/{namespace}/{slug}/secrets/{name}Project admin, agents refused.
POST /api/projects/{namespace}/{slug}/secrets/{name}/deleteForm-friendly delete.
GET /api/projects/{namespace}/{slug}/deploymentsAnyone who can read the project. logTail is included only for writers. Filters: name, status, limit (default 50, max 200), offset.
GET /api/deployments/{id}Anyone who can read the deployment’s project; unknown or unreadable ids answer 404 alike.
POST /api/deployments/{id}/approveProject writer, user identity required.
POST /api/deployments/{id}/retryProject writer; agents allowed. An agent’s retry of a pipeline deployment whose environment requires approval waits for approval.
POST /api/deployments/{id}/rollbackProject writer, user identity required. Creates a new deployment that puts this one back.
GET /api/deployments/{id}/logProject writer. A pipeline deployment’s full step log, as plain text.
POST /api/deploy-reports/{id}The CI executor only. Authenticated by an HMAC signature made with CI_EXECUTOR_SECRET; no Stratum credential is accepted or needed.

A deployment carries two fields beyond the ones above: version (what it put live, when recorded) and rollbackOf (the deployment a rollback put back).

In the UI, deployments live at /{namespace}/{slug}/deployments, and secrets under Settings.

Full request and response schemas are in the OpenAPI specification; see also the endpoint reference.

Limitations (read this before you rely on it)

Section titled “Limitations (read this before you rely on it)”

These are design boundaries, not bugs:

  • Static targets have no build step. A deploys: entry publishes the tree exactly as committed: no npm install, no bundler, no framework build. If your site needs a build, use a deploy pipeline, commit the built output (and point dir: at it), or use a provider that builds for you — vercel builds the uploaded source remotely, the two Cloudflare targets do not.
  • No preview deploys. Only merged commits deploy. There is no way to publish an unmerged change for review.
  • A rollback does not undo a migration. It redeploys an earlier version against the schema as it is now. Migrations are forward-only. See Rollback.
  • A failed pipeline is not undone. A step that failed leaves the environment as the steps before it left it — migrated but not deployed, for example. Nothing is rolled back automatically.
  • A pipeline’s steps run with the deploy target’s authority. Whatever a step does to a credentialed host, it does with the executor’s credential. The control is that the pipeline and the code it runs have merged: gate the default branch accordingly (requiredApprovals, protected configuration).
  • One pipeline per project, and every environment in it is deployed in order. There is no way to deploy only some paths, to skip an environment, or to run two environments in parallel.
  • Pipelines need the CI executor. An instance without one cannot run them. Its capacity is shared with CI.
  • Pipeline credentials are Bearer tokens for exact hostnames. Other authentication schemes, and cloud SDKs that sign requests rather than send a token, are not supported.
  • A batch merge deploys once, for the batch’s final commit, not once per change. See Batch merges.
  • Netlify is not supported. The three targets above are the whole list.
  • The approval gate refuses agent identities, not automation. It accepts a user’s scoped API token and MCP OAuth grants. See The approval gate.
  • A deploy-only project still needs an evaluators: block, or every merge is blocked. See the top of this page.
  • Secret redaction is literal-substring matching. A provider that echoes a credential back in some encoded or transformed form (URL-encoded, hashed, split across a JSON boundary) would not be caught, which is part of why the log tail is writers-only.
  • No per-project deploy quota. Nothing rate-limits how often a project deploys beyond the limits table above.
  • Deployment history has no retention policy. Rows accumulate until the project is deleted.