CLI & APICommand reference
stackblaze phases
Manage a project's environments
Usage: stackblaze phases|phase [options] [command]
Manage a project's environments
Options:
-h, --help Print help
Commands:
list [options] List a project's environments
create [options] <name> Add an environment to a project (--from <env>
duplicates an existing one with its apps)
delete [options] <name> Remove an environment from a project
use [options] [name] Switch the linked environment (interactive when name
omitted)
help [command] Print this message or the help of the given
subcommand(s)phases list
Usage: stackblaze phases list [options]
List a project's environments
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print helpExample
List a project's environments and the cluster each one runs on:
stackblaze phases list -p github-demo-cw8z┌─────────────┬─────────┬─────────────────────┐
│ Environment │ Enabled │ Context │
├─────────────┼─────────┼─────────────────────┤
│ dev │ yes │ cloud-dev-central-1 │
├─────────────┼─────────┼─────────────────────┤
│ stage │ yes │ cloud-dev-central-1 │
├─────────────┼─────────┼─────────────────────┤
│ production │ yes │ cloud-dev-central-1 │
└─────────────┴─────────┴─────────────────────┘Get just the names in a script:
stackblaze phases list -p github-demo-cw8z --json | jq -r '.[].name'dev
stage
productionphases create
Usage: stackblaze phases create [options] <name>
Add an environment to a project (--from <env> duplicates an existing one with
its apps)
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
--from <env> Duplicate this environment: same placement and
settings, every app cloned (empty data, own URLs)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print help
Examples:
$ stackblaze phases create qa # empty environment
$ stackblaze phases create qa --from staging # staging's settings + a copy of each app
--from clones every app of the source environment under its own name: same
spec, env vars and add-ons, but empty data, a fresh URL each and autodeploy
off. Pull-request preview apps are not copied. Requires the Preview
environments platform switch (same as `previews`).Example
Add an empty qa environment to a project:
stackblaze phases create qa -p github-demo-cw8z
stackblaze phases list -p github-demo-cw8zOK Created environment qa in project github-demo-cw8z
context: cloud-dev-central-1
┌─────────────┬─────────┬─────────────────────┐
│ Environment │ Enabled │ Context │
├─────────────┼─────────┼─────────────────────┤
│ dev │ yes │ cloud-dev-central-1 │
├─────────────┼─────────┼─────────────────────┤
│ stage │ yes │ cloud-dev-central-1 │
├─────────────┼─────────┼─────────────────────┤
│ production │ yes │ cloud-dev-central-1 │
├─────────────┼─────────┼─────────────────────┤
│ qa │ yes │ cloud-dev-central-1 │
└─────────────┴─────────┴─────────────────────┘--from staging would instead copy an existing environment's settings and every app in it (with empty data and new URLs).
phases delete
Usage: stackblaze phases delete [options] <name>
Remove an environment from a project
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
-y, --yes Skip confirmation prompt (default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print helpExample
Remove an environment. To confirm, type the environment's name (or pass -y):
stackblaze phases delete qa -p github-demo-cw8z! This will DELETE environment qa from project github-demo-cw8z (no apps).
Type the environment name to confirm deletion: qa
OK Deleted environment qa from project github-demo-cw8zphases use
Usage: stackblaze phases use [options] [name]
Switch the linked environment (interactive when name omitted)
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print helpExample
Switch a folder linked to github-demo-gv35 / dev over to the stage environment, then check the result:
stackblaze phases use stage
stackblaze contextOK Using environment stage of github-demo-gv35
saved to /tmp/shop/.stackblaze/project.json
Context
api: https://api-dev.stackblaze.cloud
project: github-demo-gv35
environment: stage
app: (none)
file: .stackblaze/project.json