CLI
This is pstack --help for 0.46.1, word for word. A test compares it with what the binary
prints, so it cannot drift. The HTTP API reference lists the pstack api commands,
one per route.
pstack 0.46.1 — declarative lifecycle for ephemeral preview stacks
Usage: pstack <up|down|verify|status|validate|cloud-init|dockerfile|build-image|init|upgrade|ui|logging|swarm|pull|push|route|forward|migrate|scaler|serve|api|completion> [flags]
Any command's own flags: pstack <command> --help
Flags: -f, --file <path> spec file (default: preview.yml) -n, --dry-run print what would run, change nothing -v, --verbose echo commands and their output -q, --quiet suppress per-step chatter -V, --version print the version and exit --set K=V override/define a variable (repeatable) --no-verify down: skip the post-teardown leak check --force down: allow tearing down a `kind: shared` deployment
dockerfile: --ui [hearth] print the advanced (or hearth) UI Dockerfile instead
build-image: --tag <name:tag> (default pstack:local, = PSTACK_IMAGE) --ui [hearth] build the advanced (or hearth) UI image instead --ui-dist <path> use a built UI dist from a specific path
init flags: --domain <preview.example.com> --acme-email <you@example.com> --challenge http01|dns01 (default http01 — no DNS credential needed) --ui basic|advanced|hearth (default basic — embedded, no extra container) --dns-provider <lego-code> (dns01 only) --extra-domain <host> also answer on this domain (repeatable). For a primary whose DNS still points elsewhere: its routers wait, this one works now, and /api/domains drops it later. --dns-token-file <path> the DNS-01 credential, or PSTACK_DNS_TOKEN. A path, never the token: argv is world-readable. --orchestrator swarm|compose (default swarm — one manager; workers join from the Swarm page) --logging none|loki (default none — Loki log shipping) --scaler on|off (default off — swarm: add and remove workers) --ingress-subnet <cidr> swarm: preview-ingress's range (default 10.250.0.0/16) --shared-subnet <cidr> swarm: preview-shared's range (default 10.251.0.0/16). Given, a network with another range is re-created — previews must be off it. --previews-on workers|any swarm: workers keeps previews off this manager (node label pstack.previews=off); it runs only the control stack. Unset keeps it as is.
cloud-init: --domain --acme-email [--distro ubuntu|debian|fedora|suse|arch|alpine] [--ssh-key] [--password] [--challenge] [--ui] [--orchestrator] [--logging] [--previews-on] [--scaler] [--config-repo <git-url>] [-o file] [-y] (-y = never prompt) --admin-user <name> [--admin-password <pw>] the first UI account, created on first boot --api-token <PSTACK_TOKEN> default: `init` generates one on the host and prints it once Both land in the rendered file, which the provider stores as instance metadata. --config <sealed-file> apply a `pull config` export on first boot. The file AND its passphrase both land in instance metadata. --config-url <https://…> fetch it at boot instead — only the passphrase is embedded, so the payload stays off metadata. Either way the passphrase comes from PSTACK_CONFIG_KEY, or a no-echo prompt when it is unset and you are on a tty. There is no flag for it (see pull/push below).
upgrade: --to <version|latest> (default latest) [-n to print the plan and change nothing] [--ui basic|advanced|hearth to override what it detects] [--orchestrator swarm|compose to switch — previews must be down] Reads control/.env for the token, domain and email so NOTHING rotates, rebuilds the image and re-runs init. Over SSH — never from inside the control stack.
ui: pstack ui <basic|advanced|hearth> switch which UI control.<domain> serves. Reuses the stored token and domain; builds the SPA image when switching to advanced. No version change — that is `upgrade`.
logging: pstack logging <loki|off> Loki on this host, or off. Reuses the stored token and domain.
swarm: pstack swarm [status] the nodes previews run on (exit 1 if this is not a manager) pstack swarm join what a new worker runs — a SECRET --format command|script|cloud-config|token (default command) --distro ubuntu|debian|fedora|suse|arch|alpine (cloud-config only) -o <file> write it to a file instead of stdout pstack swarm previews workers|any workers keeps previews off this manager; any undoes it
pull/push: pstack pull config -o <file> seal EVERY credential on a host into one file pstack push config -i <file> apply one onto this host — creates, never overwrites env: PSTACK_API_URL (e.g. https://api.<domain>) · PSTACK_TOKEN (root token only) PSTACK_CONFIG_KEY — the passphrase; prompted (no echo) when unset and on a tty. There is no passphrase FLAG on purpose: argv is world-readable through `ps`. `push` names every registry and notifier URL it is about to trust and asks first; -y applies without asking and prints counts instead (a log is not a terminal).
route: pstack route ls every route: name, stack, hosts pstack route create <name> [<deployment>] [--force] pstack route assign <name> <deployment> [--force] --force moves a held route pstack route unassign <name> pstack route rm <name> --json prints the API's body. env: PSTACK_API_URL · PSTACK_TOKEN
forward: pstack forward where this host forwards, if anywhere pstack forward set <url> [--via <ip[:port]>] send deploys and unserved visitors there pstack forward off env: PSTACK_API_URL · PSTACK_TOKEN · PSTACK_FORWARD_TOKEN (a user token on <url>)
migrate: pstack migrate --from <API URL> --to <API URL> [<id>...] [--sleep-source] copy deployments and their state; newest wins, so a re-run catches up --sleep-source sleep pass: no copy; sleep each source copy the target holds env: PSTACK_FROM_TOKEN · PSTACK_TO_TOKEN
api: pstack api <group> <command> every HTTP route as a command, generated from packages/pstack/api/openapi.yaml. `pstack api --help` lists the groups. env: PSTACK_API_URL · PSTACK_TOKEN (the host's, or a personal one)
serve env: PSTACK_TOKEN (required to bind off-loopback) · PSTACK_PORT (7878) PSTACK_HOST (127.0.0.1) · PSTACK_DATA (/var/lib/pstack) PSTACK_ORCHESTRATOR (compose) · PSTACK_DOMAIN · PSTACK_TRAEFIK_METRICS (for sleep.idle) PSTACK_READINESS_POLL_MS · PSTACK_READINESS_TIMEOUT_MS · PSTACK_READINESS_RESTART_LOOP PSTACK_SSO_STATE_TTL_S · PSTACK_SSO_DISCOVERY_TTL_S PSTACK_MAX_JOBS (4) — lifecycle jobs running at once, across every stack
scaler env: PSTACK_TOKEN (required, root) · PSTACK_API_URL (http://pstack:7878) · PSTACK_SCALER_STATE (/state) the worker scaler, in the control stack's scaler container (pstack init --scaler on)
healthcheck: GET /api/health on PSTACK_PORT, exit 0 or 1 — the container HEALTHCHECK.
completion: pstack completion bash|zsh|fish a script for your shell; each prints where to put it.
Exit: 0 ok · 1 failed · 2 leaked · 3 bad spec/usage