Deploy

durable-sdk deploy uploads your tree in parts, the platform builds it, checks a production build and promotes it; previews per branch, the states, --json, CI with a key.

Open in CursorView as Markdown

This page says what durable-sdk deploy does from your working directory to a promoted production deployment, and how to read, promote, cancel, redeploy and roll back one. It teaches durable-sdk deploy, durable-sdk deployments list|get|events|promote|cancel|redeploy, durable-sdk rollback and durable-sdk environments list|rm.

The command#

durable-sdk deploy [--target production|preview] [--prod] [--branch <name>]
  [--message <text>] [--app <slug>] [--dir <path>] [--no-follow] [--json]
  • --prod is --target production. Without a target the deploy is a preview on the current git branch.
  • --app <slug> wins; else .durable-sdk/app.json in the directory; else the verb is refused plane.cli.no_app with the remedy durable-sdk apps link <slug>.
  • --dir deploys another tree. --no-follow returns after the upload with the deployment's id. --message is shown in the list.

What is uploaded#

The CLI reads the tree, honouring .gitignore, refuses node_modules, .git, .env* and any file over 10 MB, packs it as a gzipped tarball (at most the tier's upload_mb: 50 on Free, 100 on Pro) and computes its SHA-256. The upload goes in parts:

  1. POST /apps/:slug/uploads { bytes, sha256 } opens it: the answer carries id, partBytes (4 194 304) and expiresAt (an hour).
  2. PUT /uploads/:id/parts/:n for n from 1, every part but the last exactly partBytes, the raw bytes with Content-SHA256. The same part sent twice with the same digest is 200; a different digest is 409 plane.upload.part_conflict. A resume reads GET /uploads/:id for the parts received.
  3. POST /uploads/:id/complete { sha256 } judges the whole (plane.upload.incomplete names the missing parts, plane.upload.sha_mismatch a digest that differs).
  4. POST /apps/:slug/deployments { uploadId, target, branch?, message? } with an Idempotency-Key minted per invocation and resent on its retries, so a retried request is the same deployment.

The platform inflates the tarball as a stream and refuses, at the entry that crosses it, more than 10 000 entries (plane.upload.too_many_files), more than 100 MB unpacked (plane.upload.too_large), a file over 10 MB (plane.upload.file_too_large), a link, or a path that leaves the root. Nothing is written to a disk; the parts are deleted once the deployment exists. API reference has the routes in full.

The states#

State Meaning Next
queued the deployment exists; the build has not started building, cancelled
building the build runs: the migrations, then the compile; its lines are readable checking, ready, failed, cancelled
checking a production build is aliased and the platform check runs against it ready, promoted, failed
ready a preview's end; or a production build checked green and waiting for its promotion (rule manual) promoted (production), swept after preview_days
promoted production points at it rolled_back
failed the build broke, the check was red, or the build ran past build_minutes; error carries the code and remedy redeploy or a new deploy
cancelled cancelled while queued or building, or a preview swept —
rolled_back production moved back off it —

The state moves at the platform's probe, at most a minute after the build's; the CLI follows the lines every five seconds and the state every fifteen. A build past the tier's build_minutes is cancelled and failed with plane.deploy.build_timeout; a red check is plane.deploy.check_failed with the build left on its alias to read.

Previews#

durable-sdk deploy --branch feature-x

A preview answers at <slug>-git-feature-x.durablesdk.com and ends ready. What a preview shares and what it does not:

  • One database branch. Every preview deployment of an app runs on the one preview branch of its database (copy-on-write from main, its own compute at the tier's suspend). A branch per preview is coming (DS-036).
  • No scheduled tick. The minute cron runs on production alone, so a preview's tick is request-only: a timer wake there resumes at the next request to the preview's hostname. durable-sdk environments list says so per environment.
  • Its own variables target. secrets set --target preview writes a value the preview sees and production does not.
  • A lifetime. A preview older than preview_days (7 on Free, 30 on Pro) is swept to cancelled and its hostname removed; durable-sdk environments rm <name> removes one now. production cannot be removed (plane.environment.production). The live count is bounded by previews_live (2 on Free, 20 on Pro).

Staging#

--target staging is refused plane.tier.staging: the staging environment (its own branch, variables and <slug>-staging.durablesdk.com, Pro and up) is coming (DS-035).

Reading, promoting, cancelling, redeploying#

durable-sdk deployments list [--target production|preview]
durable-sdk deployments get <id>
durable-sdk deployments events <id> [--since <instant>]
durable-sdk deployments promote <id>
durable-sdk deployments cancel <id>
durable-sdk deployments redeploy <id>
durable-sdk rollback <id>
  • events prints the build's lines, redacted and masked, at most 2 000 per deployment.
  • promote moves production to a ready production deployment (rule manual).
  • cancel works while queued or building; once ready it is 409 plane.deploy.not_cancellable.
  • redeploy builds the same files again under the project's current variables and answers a new deployment; secrets set --redeploy does the same from the current production deployment.
  • rollback points production back at a deployment at once; a schema down is refused plane.deploy.down_pending until DS-008 (Hosting).

--json and the exit grammar#

--json prints the final Deployment row alone on stdout, exactly as GET /deployments/:id answers it; progress goes to stderr. A refusal under --json is { "error": { "code", "message", "remedy", "docs" } } on stdout.

Exit Meaning
0 ready or promoted
1 failed or cancelled; the sentence and the remedy printed
2 a refused request (4xx) or a bad flag
3 the platform unreachable or a 5xx

CI with a key#

A person mints a key of scope deploy on the dashboard (/dashboard/keys) and the job holds it in DURABLE_API_KEY; nothing else is needed.

name: deploy
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - run: npm ci
      - run: npx durable-sdk doctor --host
      - run: npx durable-sdk test
      - run: npx durable-sdk deploy --prod --message "$GITHUB_SHA" --json > deployment.json
        env:
          DURABLE_API_KEY: ${{ secrets.DURABLE_API_KEY }}

A push on another branch with --branch "$GITHUB_REF_NAME" makes a preview. The GitHub App deploys on every push with no key in the job, a check on the commit and a preview per branch (GitHub).

Idempotency#

Every mutating route takes an Idempotency-Key header ([A-Za-z0-9_-]{1,64}, 24 hours). The same key with the same body answers the first run's row; the same key with a different body is 409 plane.idempotency.mismatch; a reuse of a request whose answer carried a one-time value answers it null with plane.value_shown_once. The CLI mints one per deploy invocation; a script against the API should too.