Skip to content

1. Install & first run

pstack ships as one static binary (Go, CGO_ENABLED=0) for Linux and macOS, amd64 and arm64, on GitHub Releases. Nothing else is installed: no runtime, no package manager, no dependencies. docker with the Compose v2 plugin must be on the PATH of whatever box runs up / down / init, but not to validate or dry-run a spec.

Terminal window
curl -fsSL https://github.com/samishal1998/preview-stacks/releases/latest/download/install.sh | sh
pstack --help

The installer downloads pstack_<os>_<arch>, verifies it against the release’s checksums.txt, and moves it atomically into /usr/local/bin (override with PSTACK_INSTALL_DIR; pin with PSTACK_VERSION=0.29.0). It never edits your PATH and never uses sudo — run it as a user that can write the target directory. Alternatives: download the binary from the release page by hand, or go install github.com/samishal1998/preview-stacks/packages/pstack/cmd/pstack@latest.

Terminal window
$ which pstack
/usr/local/bin/pstack
$ pstack --help
pstack — declarative lifecycle for ephemeral preview stacks
Usage: pstack <up|down|verify|status|validate|init|serve> [flags]
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
--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
init flags: --domain <preview.example.com> --acme-email <you@example.com>
--challenge http01|dns01 (default http01 — no DNS credential needed)
--dns-provider <lego-code> (dns01 only; token via PSTACK_DNS_TOKEN)
--logging none|loki (default none — Loki log shipping)
--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)
serve env: PSTACK_TOKEN (required to bind off-loopback) · PSTACK_PORT (7878)
PSTACK_HOST (127.0.0.1) · PSTACK_DATA (/var/lib/pstack)
Exit: 0 ok · 1 failed · 2 leaked · 3 bad spec/usage

One file, ~17 MB, statically linked. The web UI, the share page, the control-stack compose template and the cloud-init template are embedded (//go:embed), so nothing is read from a path relative to a source tree at runtime — the whole class of bug where a tool works from a checkout and 404s once installed cannot occur. The version is read from the embedded package.json, which is the lockstep version of record for the three packages in this repo.

Until 0.28.0 pstack was a Bun/TypeScript package on npm; @samyx/preview-stacks is deprecated there and stops at that release. The one-time move for an existing host is in Upgrading a host. The three npm packages that remain are the advanced UI (@samyx/preview-stacks-ui) and the Hearth UI (@samyx/preview-stacks-ui-hearth), both fetched inside the image build, and the client SDK (@samyx/preview-stacks-client).

Terminal window
$ git clone <this-repo> && cd preview-stacks
$ go build -o packages/pstack/bin/pstack ./packages/pstack/cmd/pstack
$ packages/pstack/bin/pstack --help
$ go test -race -timeout 120s ./... # the Go suite, every package
$ bun install && bun run check # everything: Go, the conformance suite, the UI, the client

go run ./packages/pstack/cmd/pstack <command> is equivalent to pstack <command> — the contributor path, not the user path. The conformance suite (packages/conformance) is the black-box specification: it spawns the built binary and compares every CLI transcript and API response against checked-in goldens, and it is what a change to the contract is reviewed against.