Databases and add-ons
Attach managed services and open a database shell through a private tunnel.
stackblaze connect
Opens an interactive database client (psql, mysql or redis-cli) for an add-on attached to the linked app. [addon] is postgres, mysql or redis, and can be left out when the app has exactly one database add-on.
stackblaze connect [addon] [--instance <name>] [--local | --tunnel] [--port <port>] [--print-only]By default the client runs inside the app, using the connection details the app already has; the client program must exist in the app's image. With --local the client runs on your machine through a private tunnel. With --tunnel the tunnel stays open and the CLI prints host, port, user and database for GUI tools.
The tunnel listens on 127.0.0.1 only and carries each connection over an authenticated connection to the StackBlaze API, so the database is never exposed publicly. It needs write access to the app, closes after 30 minutes idle, and Ctrl-C closes it. With --local the password is passed to the client through its environment, never on the command line.
| Flag | Description |
|---|---|
--instance <name> | Which add-on instance, when several match |
--local | Run the client on this machine through a private tunnel (needs psql, mysql or redis-cli installed) |
--tunnel | Keep a private tunnel open for GUI tools and print host, port, user and database |
--port <port> | Local port for --local or --tunnel (default: a free port) |
--print-only | Open the tunnel and print its connection string instead of launching a client |
Also accepts the scope flags (-p, --pipeline, --phase, -a, --app), plus --token and --api-url. Common flags
Examples
stackblaze connect postgres # psql inside the app
stackblaze connect postgres --local # psql on this machine, via the tunnel
stackblaze connect mysql --local --instance orders # pick one of several add-ons
stackblaze connect postgres --local --port 15432 --print-only
stackblaze connect redis --tunnel --port 16379 # host/port/user/db for a GUI toolstackblaze addons
Alias: addon
Add-ons are managed services, such as PostgreSQL or Redis, attached to an app. list shows the kinds you can attach (with --attached, the ones on the app); add attaches one; delete detaches one.
stackblaze addons list [--attached]
stackblaze addons add [kind] [--wait] [--timeout <seconds>]
stackblaze addons delete [kind] [--instance <name>] [-y]Use addons list for the exact kind names. With add --wait --json, stdout carries one JSON document with the readiness check under wait; a wait that ends without the app and add-on running exits 1.
| Flag | Description |
|---|---|
--attached | list: list the add-ons attached to the app |
--kind <name> | add, delete: same as the positional kind |
--wait | add: wait until the app and the add-on are running |
--timeout <seconds> | add: maximum --wait time (default 600; a new database can take several minutes) |
--instance <name> | delete: which instance, when several match |
-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 addons list
stackblaze addons add <kind> --wait # kind names from addons list
stackblaze addons list --attached -o json