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.
stackblaze init [options]| Flag | Description |
|---|---|
-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, --yes | Accept the defaults without prompting |
Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze init
stackblaze init -y
stackblaze init --pipeline shop --phases staging production --phase stagingstackblaze link
Writes .stackblaze/project.json so later commands in this directory and its subdirectories default to that project, environment and app. In a terminal, anything you do not pass is picked from a list; without a terminal, pass at least --pipeline.
stackblaze link [-p <project>] [--phase <env>] [-a <app>]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 link # pick interactively
stackblaze link -p shop --phase production -a webstackblaze unlink
Deletes .stackblaze/project.json in the current directory. A link in a parent directory is not touched.
stackblaze unlinkAlso accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
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.
stackblaze contextAlso 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.
stackblaze pipelines list
stackblaze pipelines create -p <name> [--phases <names...>] [--domain <host>]
stackblaze pipelines delete [name] [-y]| Flag | Description |
|---|---|
--phases <names...> | create: environments to create (default production) |
--domain <host> | create: wildcard domain for the project's apps |
-y, --yes | delete: 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
stackblaze pipelines create -p shop --phases staging production
stackblaze pipelines delete shop-old -ystackblaze 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.
stackblaze phases list
stackblaze phases create <name>
stackblaze phases delete <name> [-y]
stackblaze phases use [name]| Flag | Description |
|---|---|
-y, --yes | delete: 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
stackblaze phases create staging
stackblaze phase use staging
stackblaze phases delete preview -ystackblaze 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.
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.
| Flag | Description |
|---|---|
--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 |
--worker | create: 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) |
--wait | create: wait until the app is running |
--tag <tag> | redeploy: deploy this image tag |
-y, --yes | delete: 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
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 -ystackblaze 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.
stackblaze open [--app-url] [--no-browser]| Flag | Description |
|---|---|
--app-url | Open the app's public URL instead of the dashboard |
--no-browser | Only 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
stackblaze open
stackblaze open --app-url
stackblaze open --no-browser -o json | jq -r .url