The pl up demo
This page shows how to run the full pl up journey on your own machine, and what that run proves. npm run test:pl-up-demo (scripts/pl-up-demo-e2e.sh, also in test:all) takes an ordinary web-only checkout to a URL and back down, with the real binaries.
Run the demo
export CARGO_BUILD_JOBS=4
nice -n 15 bash scripts/pl-up-demo-e2e.sh
You need Docker, the dev PostgreSQL (compose.dev.yaml, 127.0.0.1:55432), jq, openssl, python3, git and network access to Docker Hub for the pinned base images.
Every name is per run:
- a disposable database
pushleft_plup_<run>, - containers
plup-<run>-registry/-caddy/-acme, - a DNS stub process,
- networks labelled
com.pushleft.e2e=<run>, - free loopback ports.
PUSHLEFT_PLUP_E2E_REGISTRY_PORT, PUSHLEFT_PLUP_E2E_HTTP_PORT and PUSHLEFT_PLUP_E2E_HTTPS_PORT override the registry and Caddy ports. On failure, the script prints the last log lines, the jobs, the instances and the events. It keeps its temporary directory.
On the development Mac (Docker Desktop, warm Cargo and image caches), a run takes about 6 minutes. Two consecutive runs took 369 s and 366 s. Most of the time goes to the BuildKit builds, including the five attempts of the broken build. The two 60-second health deadlines of the failed start and failed health cases take most of the rest.
Components
| Component | How |
|---|---|
| PostgreSQL | A fresh database. bootstrap-owner and the API apply the migrations. |
| API | PUSHLEFT_AUTH_MODE=production, behind scripts/fixtures/forwarded-https-proxy.py (trusted proxy 127.0.0.1/32). The proxy relays text/event-stream responses chunk by chunk, so pl up can follow events through it. |
| Registry | zot v2.1.22 (scripts/fixtures/registry-token.sh) on a fixed loopback port. Token auth is verified with the gateway’s per-run signing certificate. The script signs its own reads with the same test key. |
| Scheduler | PUSHLEFT_PREVIEW_BASE_DOMAIN=pl<run>.localhost. Retention is not configured, because it has its own suite. |
| Agent gateway | mTLS with a per-run CA, source root, registry token signing key and realm. |
| Build agent | A node in the build pool with its own certificate. Rootless BuildKit (moby/buildkit v0.25.1-rootless, digest-pinned). |
| Application agent | A node in the application pool with its own certificate. Docker runtime, --caddy-admin to the ingress Caddy, and the lock-file probe image. Its DOCKER_CONFIG holds no registry login: it pulls only with the per-pull token that the gateway issues for its placement. |
| Ingress | A digest-pinned Caddy that runs the HTTPS-only config from pushleft-agent ingress-caddy-config (bucket, terminal 404, port 80 only redirects and answers ACME). The application agent loads a per-run wildcard *.pl<run>.localhost (--ingress-wildcard-cert-file/-key-file). The scheduler runs with PUSHLEFT_INGRESS_HTTPS=1 and PUSHLEFT_DOMAIN_VERIFY_NAMESERVER pointing at scripts/fixtures/dns-stub.py. A second pinned Caddy runs acme_server as a local ACME CA, rooted in the same per-run CA. That Caddy runs on a Docker network where the custom domain resolves to the ingress Caddy. |
| CLI | target/debug/pl, with credentials that pl login stores. |
A node has one pool, so the demo uses two agent processes. Both nodes are shared (no owner_org_id), so the second organization is placed on the same hosts.
Stubs and gaps
- Network admission. A background loop writes the same evidence for every environment segment as
scripts/application-lifecycle-e2e.sh. It writes a ready coordinator on a mesh-pool node, and fresh gateway, firewall, route and mesh-route rows for the application node. It also creates an internal Docker network named like the environment bridge (pl_<segment>) and connects Caddy to it. No Headscale, Tailscale gateway, nftables or host routes run. Everything else goes through the real code: the build, the registry push and pull, placement, health, ingress, supersession and teardown. This includes the network-lane teardown job, which finds nothing it owns to remove. - The second organization is inserted in SQL with a hashed token. The platform operator’s path is
pushleft-api create-organization --email <owner> --org-name <name>, which prints the owner’s token.scripts/staging/staging.sh isolationuses it for the second sample app’s organization. - Docker Desktop, not native Linux. Containers run in the Docker Desktop VM. The run proves nothing about host-kernel hardening, rootless BuildKit on a Linux host or nftables.
- Local CA and DNS stub. The URL is
https://<branch>--<project>.pl<run>.localhost/. Caddy serves it with a per-run wildcard, and the script reaches it withcurl --cacert <run CA> --resolveon the Caddy HTTPS port. The custom domain’s certificate comes from a real ACME HTTP-01 exchange, against a local ACME CA. Its ownership TXT record comes from a DNS stub. The run does not use public DNS, Let’s Encrypt/ZeroSSL or 80/443 reachable from the internet. - Single host. One build node and one application node on one machine. The run does not prove multi-host placement, packet transport or failover.
- One database role. Every service connects as the
pushleftsuperuser. So the run cannot find missing grants for the separate service roles.
Evidence, step by step
-
pl login.bootstrap-ownerprints a token.pl loginstores it and prints[email protected] · Demo org. -
pl up, following events. The checkout isscripts/fixtures/web-onlyin a git repo on branchdemo, with no.pl.yaml. Inference gives onewebrole on port 8080 with health/healthz(how Pushleft reads the manifest). The CLI printsbuild_queued,source_verified,build_completed,application_ready,ingress_publishing,ingress_route_activeanddeployment_url_ready. It ends withlive https://demo--demo-app--<org handle>.pl<run>.localhost/and exits 0. The hostname returned 404 before the deployment. -
The URL serves the build over HTTPS.
curl --cacertthrough Caddy returnspushleft build fixture, so the handshake verified the wildcard for that name. Another name under the base domain returns 404. Plain HTTP answers only308to thehttps://URL. The artifact is<registry>/organizations/<org>/projects/<project>@sha256:…, built by the build node. The container runs that digest read-only, withCapDrop ALL, no mounts and no published ports. -
pl listshows the deploymentlivewith the URL. -
Restart replay. The script kills the application agent and the scheduler with SIGKILL. The route keeps serving while they are down. After the restart, the deployment is still
live, the container has the same ID and start time, and no job was added for the deployment. -
Second release, with a crash mid-rollout. The checkout changes and is committed. The application agent is down while the release builds and is targeted.
- After its restart, the agent starts the new container. The script kills the agent again before it reports health (the instance is still
deploying). The scheduler is killed with it. The old release keeps serving. - After the restart,
ensure_applicationis leased again (attempt 2) and adopts the same container (same ID). pl upexits 0 with the same URL, which now returnspushleft demo release 2.- The old route is
removed, and Caddy holds onlypl-ingress-<host>-g2-o<org>. The old deployment issuperseded. Since 2026-11-05 the agent removes a stopped release’s container, and its image when nothing else uses it. Its artifact row and registry manifest remain. The script checks that the old container is gone. pl listshows the new deploymentlivewith the URL, and the old onesupersededwithout one.
- After its restart, the agent starts the new container. The script kills the agent again before it reports health (the instance is still
-
Tenant isolation. A second organization’s owner token gets
404for the first organization’s deployment on GET, the SSE stream, source upload and teardown.pl down <id>fails withnot_found, andpl listshows nothing. The deployment stayslive, noteardown_requestedevent exists, and the URL still serves. -
Viewer and revocation. A viewer onboarded with a login code cannot
pl up(forbidden), and no deployment row is created. A token that worked forpl listfails on the next call afterDELETE /v1/auth/tokens/{id}(revoked). See authentication. -
Failed build. A Dockerfile whose
RUNexits 3 endspl upnon-zero atbuild_failed, after the five attempts that the job allows. The CLI prints the log tail with the output of the failing step. The deployment isfailed, with no artifact and no route row. -
Failed start. An image whose process exits at once ends
pl upatapplication_failed. The deployment isfailedand has no route row. -
Failed health. An image whose
/healthzreturns 500 endspl upatapplication_failed, with the same result. -
No hostname squatting. The second organization deploys the same checkout (same project and branch).
- It goes live on its own name,
demo--demo-app--<its handle>, owned by it. The first organization’s name, owner and content do not change. - The second organization then runs
pl down. Its deployment reachesdestroyed, and the first organization’s route does not change. - Registry tokens. After that teardown, the application node gets a
pull-only token for the first organization’s live release. It gets 403 for the second organization’s repository, because nothing of it is placed there now. The build node, between builds, gets 403. - With the application node’s token, the registry serves the first organization’s manifest. It answers 401 to a read of the second organization’s repository, a blob upload and a manifest delete. The application node’s Docker config holds no login. See registry tokens.
- It goes live on its own name,
-
Tampered source. With the build agent stopped, the script queues a deployment and changes one byte of its verified source object on disk. When the build agent comes back, the gateway refuses the download (
500, integrity check). Every attempt fails, the build ends with a terminalbuild_failed, and no artifact exists.In steps 9 to 12, the failing release goes into the live environment. Each time, the script checks that the live deployment is still
liveand that Caddy’s routes did not change. It also checks that the URL still returns the second release. -
Custom domain. See custom domains on an environment.
- A viewer’s
pl domain addisforbidden. - The owner’s
pl domain add www.demo-<run>.testprints the claim with the TXT_pushleft-challenge.…token and the CNAME target (the preview hostname). A duplicate claim is refused, and the other organization’spl domain listis empty. - With no DNS record, the scheduler records a failed check. The claim stays
pending_verification, no route row exists, Caddy’sautomatelist is empty and the name gets no TLS certificate. - When the stub serves the TXT record, the claim becomes
verified. The scheduler attaches it to the live release, and it becomesactive. - Caddy gets the certificate by HTTP-01 from the local ACME CA.
curl --cacertreturnspushleft demo release 2on the custom name. The release staysliveon its preview URL. scripts/ops-alerts.shprobes both names through the ingress. It reports the 12-hour ACME leaf as expiring under a 1-day threshold, and neither name as invalid.pl domain showlistscustom_domain_added,_check_failed,_verified,_routingand_route_active.pl domain removedrains the route. Caddy is back to the single preview route, andautomateis empty.
- A viewer’s
-
pl down.pl downprintsTeardown queued.- The routes become
removed, Caddy has no routes, and the URL returns Caddy’s 404. - No container of the deployment exists, the instance is
removed, and itsdeployment_roleallocation is released. - The artifact, the snapshot and the events (including
application_removed) remain. - No other deployment of the environment is still active (release 1 is
superseded, the failing releases arefailed). So the scheduler queues oneremove_environment_gatewayjob on the app node’s network lane. - Its receipt releases the attachment:
gateway_status='removed',released_at, evidencegateway: absentandbridge: foreign_retained, androutes/firewall: not_applicableon macOS. The bridge isforeign_retainedbecause the agent does not own the stub bridge and Caddy is attached to it. - The receipt also releases the membership (the subnet slot stays burned) and the gateway capacity. It marks the segment
destroyed, and the deploymentdestroyedwith adeployment_destroyedevent.pl listshows itdestroyed.
- The routes become
-
pl upagain into the torn-down environment. The API creates a new segment for the environment. Placement gets a new membership with a higher subnet slot. The URL serves release 2 again. -
Deploy by digest of a
plr_-pushed image. An operator allows the organization to deploy images (pushleft-api org external-images). Aplr_push token copies the release image intoorganizations/<org>/tools/demo. A.pl.yamlwithimage:and that digest deploys with no build:pl upprintsimage_resolvedand nobuild_completed, and the URL serves the image. See deploy an image by digest.
Integration bugs found
- Build retries reused the workspace of the previous attempt. The name was
pl-build-<job>-<first 8 hex of the lease token>. Lease tokens are UUIDv7, so those 8 hex digits are the millisecond timestamp, and they stay the same for about 65 seconds. A retry inside that window recreated the same path, and Docker Desktop refused the bind mount (bind source path does not exist). Four infrastructure failures then hid the first real failure, and the CLI printed the wrong log tail. The suffix now uses the random tail of the token (crates/pushleft-agent/src/build.rs,workspace_name; testretries_get_a_fresh_workspace_name). - A failed health check was retried five times. The agent reported an image that never became healthy as a retryable failure. So the gateway leased it four more times, with a 60-second deadline each.
pl upwaited about six minutes for a result that could not change. A missed health deadline is now a permanent failure with codeunhealthy. Docker and pull errors stay retryable (crates/pushleft-agent/src/application.rs,unhealthy; testa_failed_health_deadline_is_a_permanent_failure). - The test proxy buffered SSE.
forwarded-https-proxy.pyread the whole upstream response, sopl upcould never follow events in production mode. It now streamstext/event-stream. - The web-only fixture served nothing. Its image had no command (busybox
shexits at once), so it could build but never pass health. It now serves/wwwwith busyboxhttpdon 8080, including/healthz.
Before production
scripts/staging/staging.sh smoke (staging runbook) runs the same journey on five Ubuntu 24.04 amd64 VMs. It covers Kata builds, the host Caddy reaching the bridge and a managed database on another host. It also covers the real network admission chain (Headscale, Tailscale gateways, firewall, host and mesh routes). staging.sh isolation adds nftables between tenants and reboots. Neither covers these items:
- A native Linux run of this exact flow. It needs rootless BuildKit on a Linux host, the host Caddy reaching the bridge address, nftables and the environment firewall.
- Real network admission (Headscale, Tailscale gateways, firewall and route evidence) in this demo, in place of the SQL stub. Multi-host placement, transport and failover.
- Public wildcard DNS (a
*.<base>record) and DNS-01 for the wildcard. A public CA (Let’s Encrypt/ZeroSSL) for custom domains with 80/443 reachable from the internet. DNS-01 needs a Caddy build with a DNS provider module, and the pinned image has none. - Separate database roles per service with least-privilege grants.
- Organization creation in the demo, so that tenant tests do not need SQL.
- Environment network teardown on a real host. The demo bridge is a stub that the agent correctly refuses to remove, and no Tailscale gateway, nftables table or host route exists to remove.
npm run test:application-lifecycleremoves a labelled gateway stand-in container and the bridge. nftables and route removal run only on Linux, and no suite exercises them yet. - Garbage collection of the role capacity that the instances of
faileddeployments still hold.
Related
- Handbook: where this demo fits in the verification ladder.
- Architecture: the delivery slices this demo verifies.
- Isolated build executor: how the build step runs.
- Staging fleet: the same journey on real Linux VMs.
- The .pl.yaml manifest: what a checkout with a manifest adds.