Deploy and builds
Deploy a folder, a git repository or an image, follow builds, and roll back.
stackblaze up
Deploys a folder (default: the current directory) to the linked project and environment. If the app does not exist yet, up creates it; if it does, up updates it with the flags you pass and deploys again.
stackblaze up [path] [options]Git checkout: when the folder has a git remote, the app is built from that remote and the current branch. Unpushed local changes are not deployed, so push first.
Local folder: with no git remote, or with --local, up packs the folder, uploads it and builds it. .gitignore, .stackblazeignore and .railwayignore are honoured; .git, node_modules and .env* files are always left out, and a warning names every .env file it skipped. The limit is 200 MB compressed. An unchanged folder is not uploaded twice, and variable changes and redeploys rebuild the last upload for 7 days.
Image: --image runs a container image; git and local files are not used. Without --port, up reads the image's EXPOSE port; when the image declares none, it deploys a web service on port 3000 and prints a warning. --worker deploys a background process with no port and no public URL.
Re-running up is safe, so CI can run it on every push: git and local-folder apps build again, image apps re-pull (or switch to the new --tag). Settings detected on the first run, such as the Dockerfile port or build strategy, are not rewritten later. An existing app keeps its kind: up --image only updates image apps.
After the deploy starts, up streams the build log live and exits when the build finishes: 0 on success, 1 when the build fails or times out. --detach skips the stream. In a terminal without credentials, up starts stackblaze login first.
Commit pinning: rebuilding an existing git app builds the exact commit being deployed. In CI that is GITHUB_SHA (the pull request's head commit on pull_request events), CI_COMMIT_SHA on GitLab or BUILDKITE_COMMIT; locally it is HEAD when that commit is pushed. On a detached HEAD the branch is read from GITHUB_HEAD_REF, GITHUB_REF_NAME, CI_COMMIT_REF_NAME or BUILDKITE_BRANCH. A brand-new app's first build uses the head of the branch.
--ci writes one JSON record per line to stdout (deploy, build, log, status, error); notices and upload progress go to stderr. An image deploy without --wait ends with a status record whose state is submitted. --json without --ci prints one JSON document when up finishes.
| Flag | Description |
|---|---|
--name <name>, -a, --app <name> | App name (default: the linked app, else the folder name) |
--local | Upload the folder instead of building its git remote |
--image <repo> | Run this container image (skips git and local files) |
--tag <tag> | Image tag (default latest) |
--repository <url> | Git repository URL (default: the folder's git remote) |
--branch <name> | Git branch (default: the current branch) |
--buildstrategy <s> | nixpacks, dockerfile, buildpacks or plain. A new app with a Dockerfile uses dockerfile, otherwise nixpacks |
--build-context <dir> | Build context inside the repository (monorepos) |
--dockerfile-path <path> | Dockerfile path |
--path <dir> | Deploy a subdirectory (monorepos) |
--path-as-root | Treat --path as the build root, so Dockerfile paths are relative to it |
--port <n> | Container port |
--worker | Background worker: no port, no public URL |
--replicas <n> | Replica count |
--domain <host> | Custom domain |
--env <KEY=value> | Environment variable (repeatable) |
--wait | After the build, wait up to 90 seconds for the app to be running |
--ci | CI mode: stream NDJSON records and exit when the build finishes |
-d, --detach | Start the deploy and exit without following the build |
-y, --yes | When the directory is not linked, create or reuse a project named after the directory |
--new | Create a new project named after the directory |
--resume | Resume the paused app instead of deploying (same as stackblaze resume) |
--verbose | Print extra deploy diagnostics |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze up # git checkout: build; otherwise upload this folder
stackblaze up ./api --local # upload ./api even though it is in git
stackblaze up -y # unlinked: create a project named after the directory
stackblaze up -p shop --phase staging --name api --env NODE_ENV=production --wait
stackblaze up --image nginx --tag 1.27 # port read from the image's EXPOSE
stackblaze up --image registry.example.com/acme/jobs --worker
stackblaze up --path services/api --name api # monorepo subdirectory
stackblaze up --ci --wait # CI: NDJSON, exit 1 on failurestackblaze deploy
Without flags, the same as stackblaze redeploy, and it warns about staged changes it is not shipping. With --apply-pending, applies every change staged with --skip-deploy as one release.
stackblaze deploy [--tag <tag>]
stackblaze deploy --apply-pending [-m <text>]| Flag | Description |
|---|---|
--apply-pending | Apply every staged change (see stackblaze pending list) as one release |
-m, --message <text> | Release message shown in the deployment history |
--tag <tag> | Deploy this image tag instead (not with --apply-pending) |
--skip-deploy | Stage the change instead of deploying it; ship it later with stackblaze pending apply |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze variables set FOO=1 --skip-deploy
stackblaze scale web=3 --skip-deploy
stackblaze deploy --apply-pending -m "Bump FOO and scale up"
stackblaze deploy --tag 1.4.3stackblaze redeploy
Starts a new deployment of the linked app. A git or local-folder app builds again from its configured source; an image app re-pulls its image and tag (useful for moving tags such as latest). Same as stackblaze apps redeploy.
stackblaze redeploy [--tag <tag>]| Flag | Description |
|---|---|
--tag <tag> | Deploy this image tag instead |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze redeploy
stackblaze redeploy && stackblaze builds logs -f
stackblaze redeploy --tag 1.4.3 -a apistackblaze restart
Restarts the linked app with the same image. Nothing is built or pulled. Same as stackblaze apps restart.
stackblaze restartAlso accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze restart -a apistackblaze wait
Polls every 5 seconds until the app and all its add-ons are running, the deploy fails, or the timeout passes. Exits 0 when ready and 1 otherwise.
stackblaze wait [--timeout <seconds>]| Flag | Description |
|---|---|
--timeout <seconds> | Maximum wait (default 90) |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze wait --timeout 300 && curl -fsS "$(stackblaze apps get -o json | jq -r .url)"stackblaze builds
Alias: build
Build jobs of an app built from source.
stackblaze builds list
stackblaze builds trigger [options]
stackblaze builds logs [build] [-f] [--ci]list shows the app's builds, newest first. trigger starts a build with the app's settings, optionally overridden. logs follows a build until it finishes (default: the newest build) and exits 1 when the build fails.
With -f, each line is printed as the build writes it, in order: fetch, build, push, deploy. Joining a running or finished build replays the earlier lines first, and a dropped connection reconnects on its own. Set STACKBLAZE_BUILD_STREAM=poll to always poll instead.
| Flag | Description |
|---|---|
--commit-sha <sha> | trigger: build this commit |
--reference <ref> | trigger: branch or tag (default: the app's branch) |
--repository <url> | trigger: repository URL override |
--buildstrategy <s> | trigger: buildpacks, dockerfile, nixpacks or plain |
--dockerfile-path <path> | trigger: Dockerfile path (dockerfile strategy) |
-f, --follow | logs: follow the build live |
--ci | logs: write NDJSON build, log and error records instead of text |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze builds logs -f # follow the latest build
stackblaze builds logs web-x7k2 -f # follow a named build
stackblaze builds logs -f --ci # NDJSON for CI
stackblaze builds trigger --commit-sha "$GITHUB_SHA"
stackblaze builds list -o jsonstackblaze deployments
Alias: deployment
list shows the app's deploy history: git builds, image deploys and configuration releases, with status, trigger and ref. rollback returns to an earlier deploy.
stackblaze deployments list [-n <limit>]
stackblaze deployments rollback [deploy-id] [--wait] [-y]<deploy-id> is an ID from deployments list (a history entry or a build name). Image deploys and builds roll back to their image tag, which works for image apps too; configuration releases (variable and scale changes) roll back the configuration. Without an ID, rollback picks the newest successful deploy that is not the one running now.
With --wait --json, stdout carries one JSON document: the rollback with the readiness check under wait. The exit code is 1 when the app does not come up.
| Flag | Description |
|---|---|
-n, --limit <n> | list: maximum entries (default 100) |
--build <name> | rollback: build name to roll back to (same as the positional ID) |
--wait | rollback: wait up to 90 seconds until the app is running again |
-y, --yes | rollback: skip the confirmation prompt |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze deployments list -n 20
stackblaze deployments rollback -y --wait
stackblaze deployments rollback web-1a2b3c -ystackblaze inspect
Reports what stackblaze up would detect in the current directory, a local path, or a public git URL: repository type, deployable apps, build context, Dockerfile and port. Runs locally and needs no sign-in; git URLs are shallow-cloned, so git must be installed.
stackblaze inspect [path-or-git-url] [--branch <name>]| Flag | Description |
|---|---|
--branch <name> | Branch to inspect (git URLs) |
Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze inspect
stackblaze inspect ./services/api
stackblaze inspect https://github.com/acme/shop --branch develop -o json