Skip to content

4. Up, status, down

Terminal window
$ PR=123 pstack up
stack: pr-123
→ up: database
→ compose up (backend, frontend)
✓ up database
✓ assert_live database
✓ compose (compose)

The → lines are progress, printed as work happens. The ✓ block is the step report, printed once at the end. In a long deploy the arrows are what you watch; the report is what you read.

Add -v to see the actual commands and their output:

Terminal window
$ PR=8 pstack up -v
stack: pr-8
→ compose up (backend)
$ docker compose -p 'pr-8' -f 'compose.generated.yml' -f 'docker-compose.preview.tls.yml' --profile 'backend' up -d --remove-orphans

That is the whole Compose contract, visible: -p <stack> for namespacing, one -f per file (compose.file then each compose.overlays entry, in order), the selected profiles, and --remove-orphans so relabelling from backend+frontend to backend actually stops the frontend instead of orphaning it.

The first -f is compose.generated.yml, which pstack writes beside compose.file and never over it. It does this whenever a service needs routing labels or has no logging: key. Such a service gets a json-file log cap (10m × 3), or the loki driver on a host that runs Loki. Add compose.generated.yml to your repository’s .gitignore.

✓ assert_gone database
│ │ └─ axis name, or `(compose)` for the compose step
│ └─ phase: up · assert_live · down · assert_gone · compose · capacity
└─ mark
Mark Meaning Where it comes from
✓ step passed any phase
? unverifiable — the axis defines no assert_gone, so nothing was checked. Not a pass. assert_gone phase only
✗ step failed. On assert_gone this is a leak. any phase

A trailing summary line counts what matters: 1 leaked resource(s), 1 unverifiable axis/axes.

A down step can pass and carry a message — teardown is best-effort by design, so a failed down hook is recorded as non-fatal rather than failing the run. Here the whole Compose teardown failed (this host has no docker at all) and the run still continued, exactly as intended:

Terminal window
✓ compose (compose) — non-fatal: bash: docker: command not found

A ✓ with a non-fatal: message means this step errored and we carried on deliberately. Read those messages — they are how you notice a down hook that has been silently failing for weeks. The thing that would actually fail the run is the assert_gone that follows.

And here is ? in the wild — the three-axis spec from section 3, whose dns-record axis has no assert_gone:

Terminal window
$ PR=123 pstack verify -f warn.yml
stack: pr-123
→ verify (asserting resources are gone)
? assert_gone dns-record — unverifiable: no assert_gone defined
✓ assert_gone queue-namespace
✓ assert_gone images
1 unverifiable axis/axes
$ echo $?
0

Exit 0 with a ? means: everything I could check was clean. It does not mean the host is clean. Every ? is a resource class you are trusting on faith.

Terminal window
$ PR=123 pstack status
stack: pr-123
(nothing running)

status passes docker compose ps through unmodified — when containers exist you get Compose’s own table verbatim. Two synthetic replies stand in for an empty result: (nothing running) when ps produces no output, and (no compose section in spec) when the spec has no compose: block at all.

Verify (before teardown, as a sanity check)

Section titled “Verify (before teardown, as a sanity check)”

Run it against a live stack and it should fail. If it passes while the stack is up, your assert_gone is lying — go back to section 3.

Terminal window
$ PR=123 pstack verify
stack: pr-123
→ verify (asserting resources are gone)
✗ assert_gone database — LEAKED: resource still present after teardown
1 leaked resource(s)
$ echo $?
2
Terminal window
$ PR=123 pstack down
stack: pr-123
→ compose down (all profiles)
→ down: database
→ verify (asserting resources are gone)
✓ compose (compose)
✓ down database
✓ assert_gone database
$ echo $?
0

Order: Compose down first (every profile), then axes in reverse declaration order, then verify — which runs by default, because a teardown that half-worked is precisely what you need to hear about. Confirm with -v:

Terminal window
$ PR=456 pstack down -v
stack: pr-456
→ compose down (all profiles)
$ docker compose -p 'pr-456' -f 'docker-compose.preview.yml' --profile 'backend' --profile 'frontend' down -v --remove-orphans

All profiles from the spec appear, whatever you brought up. Compose treats a service whose profile isn’t enabled as absent, so tearing down with fewer profiles than you deployed leaves that profile’s resources behind — most visibly one dead <stack>_default network per PR, forever. Enumerating every profile costs nothing (a profile with no matching service is a no-op).

down -v also removes volumes, but never images. That is an axis, not Compose’s job.