Projects & apps

Projects and apps

Create and link projects, manage environments, and manage apps directly.

In the CLI, a project is called a pipeline (--pipeline) and an environment is a phase (--phase).

stackblaze init

Alias: new

Creates a project and writes .stackblaze/project.json in the current directory, linking it to that project and environment. If a project with that name exists, it is linked instead. init does not link an app; stackblaze up adds it.

usage
stackblaze init [options]
FlagDescription
-p, --pipeline <name>Project name (default: the directory name)
--phase <name>Environment to link (default: the first of --phases, else production)
--phases <names...>Environments to create on a new project (default production)
--domain <host>Wildcard domain for the new project
-y, --yesAccept the defaults without prompting

Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags

Examples

terminal
stackblaze init
stackblaze init -y
stackblaze init --pipeline shop --phases staging production --phase staging

stackblaze context

Prints what the CLI would use here: the API URL and the project, environment and app after applying flags, STACKBLAZE_* variables and .stackblaze/project.json. Makes no API call.

usage
stackblaze context

Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags

stackblaze pipelines

Alias: pipeline

Manages projects. list shows projects and their environments (also stackblaze list or stackblaze ls). delete removes a project and all its apps (default: the linked project) and asks you to type its name unless -y; when it was the linked project, the link is removed.

usage
stackblaze pipelines list
stackblaze pipelines create -p <name> [--phases <names...>] [--domain <host>]
stackblaze pipelines delete [name] [-y]
FlagDescription
--phases <names...>create: environments to create (default production)
--domain <host>create: wildcard domain for the project's apps
-y, --yesdelete: skip the confirmation

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

terminal
stackblaze pipelines create -p shop --phases staging production
stackblaze pipelines delete shop-old -y

stackblaze phases

Alias: phase

Manages a project's environments, such as staging and production. delete does not delete the apps in the environment, and you cannot delete a project's only environment. use switches the environment in this directory's link; without a name you pick from a list.

usage
stackblaze phases list
stackblaze phases create <name>
stackblaze phases delete <name> [-y]
stackblaze phases use [name]
FlagDescription
-y, --yesdelete: skip the confirmation

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

terminal
stackblaze phases create staging
stackblaze phase use staging
stackblaze phases delete preview -y

stackblaze apps

Alias: app

Manages apps directly. list shows apps across your projects, filtered to the scope; get shows one app's URL, status, instance count and variable count; create makes an app from an image or a git repository; update changes an existing app; restart, redeploy and scale are the same as the top-level commands; delete asks you to type the app name unless -y.

usage
stackblaze apps list
stackblaze apps get
stackblaze apps create [name] --mode docker|git [options]
stackblaze apps update [options]
stackblaze apps restart
stackblaze apps redeploy [--tag <tag>]
stackblaze apps scale [web=N] [worker=N] [--autoscale <process=min:max>]
stackblaze apps delete [-y]

create needs a project; the environment defaults to production. An image app created without --port, --domain or --worker uses the image's EXPOSE port, or port 3000 with a warning. update needs at least one change.

FlagDescription
--mode <mode>create: docker or git (required)
--name <name>create: app name (or pass it positionally)
--image <repo>, --tag <tag>create, update: image and tag (tag default latest)
--repository <url>create: git URL
--branch <name>create, update: git branch (create default main)
--buildstrategy <s>create, update: buildpacks, dockerfile, nixpacks or plain
--build-context <dir>, --dockerfile-path <path>create, update: monorepo build context and Dockerfile path
--port <n>create, update: container port
--workercreate: background worker, no port and no public URL
--replicas <n>create: replicas (default 1)
-r, --replicas <n>, --worker-replicas <n>update: web and worker replicas
--podsize <name>update: instance size, by name
--domain <host>create, update: custom domain (update replaces the existing hosts)
--addon <name>create: attach an add-on by kind or name (repeatable)
--env <KEY=value>create, update: variable (repeatable)
--waitcreate: wait until the app is running
--tag <tag>redeploy: deploy this image tag
-y, --yesdelete: skip the confirmation

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

terminal
stackblaze apps list -o json | jq -r '.[] | "\(.pipeline)/\(.phase)/\(.app)"'
stackblaze apps create api --mode docker --image registry.example.com/acme/api --tag 1.4.2 --port 8080 -p shop --wait
stackblaze apps update --env FEATURE_X=on
stackblaze apps delete -a old-api -y

stackblaze open

Prints the URL of the linked app's dashboard page and opens it in your browser. With no app in scope, it opens the project page. The browser opens only when stdout is a terminal and JSON output is off.

usage
stackblaze open [--app-url] [--no-browser]
FlagDescription
--app-urlOpen the app's public URL instead of the dashboard
--no-browserOnly print the URL

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

terminal
stackblaze open
stackblaze open --app-url
stackblaze open --no-browser -o json | jq -r .url