pushleft
Deploy your first app
Manual contents
Handbook
HandbookPushleftArchitecture
Operate
Install the control planeYour own serversFleetOperations and alertsAuthenticationAccess gateDomains and DNSUsage and budgetsScheduled jobsAbuse controlsAI provider proxyCustomer mailErrors and performanceLogs and metricsRetentionObject storageContainer registryGit server
Develop
The .pl.yaml manifestOnboard with an AI agentThe pl up demoBuild executorSource ingestionAgent gatewayManaged databasesSecurity findingsTunnels and shellsDev workspacesPrivate hostnamesMesh coordinatorsDesign baseline
Runbooks
Control-plane host failoverControl-plane PostgreSQL failoverControl-plane PostgreSQL restoreCustom domains and certificatesGateway key compromiseIngress host failureNode busyNode disk fullNode drain and replacementNode lostRegistry outageHetzner Robot hostsSecret rotationSecurity incidentStaging fleet on ProxmoxStaging build cacheStuck deploymentVault/OpenBao backup and recovery
More
CI pipelines
Manual · docs/pl-up-demo.md

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.

Console Every deployment of an environment, with its source, services and status.
Console The project overview after a deployment goes live.

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

ComponentHow
PostgreSQLA fresh database. bootstrap-owner and the API apply the migrations.
APIPUSHLEFT_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.
Registryzot 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.
SchedulerPUSHLEFT_PREVIEW_BASE_DOMAIN=pl<run>.localhost. Retention is not configured, because it has its own suite.
Agent gatewaymTLS with a per-run CA, source root, registry token signing key and realm.
Build agentA node in the build pool with its own certificate. Rootless BuildKit (moby/buildkit v0.25.1-rootless, digest-pinned).
Application agentA 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.
IngressA 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.
CLItarget/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 isolation uses 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 with curl --cacert <run CA> --resolve on 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 pushleft superuser. So the run cannot find missing grants for the separate service roles.

Evidence, step by step

  1. pl login. bootstrap-owner prints a token. pl login stores it and prints [email protected] · Demo org.

  2. pl up, following events. The checkout is scripts/fixtures/web-only in a git repo on branch demo, with no .pl.yaml. Inference gives one web role on port 8080 with health /healthz (how Pushleft reads the manifest). The CLI prints build_queued, source_verified, build_completed, application_ready, ingress_publishing, ingress_route_active and deployment_url_ready. It ends with live https://demo--demo-app--<org handle>.pl<run>.localhost/ and exits 0. The hostname returned 404 before the deployment.

  3. The URL serves the build over HTTPS. curl --cacert through Caddy returns pushleft build fixture, so the handshake verified the wildcard for that name. Another name under the base domain returns 404. Plain HTTP answers only 308 to the https:// URL. The artifact is <registry>/organizations/<org>/projects/<project>@sha256:…, built by the build node. The container runs that digest read-only, with CapDrop ALL, no mounts and no published ports.

  4. pl list shows the deployment live with the URL.

  5. 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.

  6. 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_application is leased again (attempt 2) and adopts the same container (same ID).
    • pl up exits 0 with the same URL, which now returns pushleft demo release 2.
    • The old route is removed, and Caddy holds only pl-ingress-<host>-g2-o<org>. The old deployment is superseded. 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 list shows the new deployment live with the URL, and the old one superseded without one.
  7. Tenant isolation. A second organization’s owner token gets 404 for the first organization’s deployment on GET, the SSE stream, source upload and teardown. pl down <id> fails with not_found, and pl list shows nothing. The deployment stays live, no teardown_requested event exists, and the URL still serves.

  8. Viewer and revocation. A viewer onboarded with a login code cannot pl up (forbidden), and no deployment row is created. A token that worked for pl list fails on the next call after DELETE /v1/auth/tokens/{id} (revoked). See authentication.

  9. Failed build. A Dockerfile whose RUN exits 3 ends pl up non-zero at build_failed, after the five attempts that the job allows. The CLI prints the log tail with the output of the failing step. The deployment is failed, with no artifact and no route row.

  10. Failed start. An image whose process exits at once ends pl up at application_failed. The deployment is failed and has no route row.

  11. Failed health. An image whose /healthz returns 500 ends pl up at application_failed, with the same result.

  12. 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 reaches destroyed, 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.
  13. 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 terminal build_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 live and that Caddy’s routes did not change. It also checks that the URL still returns the second release.

  14. Custom domain. See custom domains on an environment.

    • A viewer’s pl domain add is forbidden.
    • The owner’s pl domain add www.demo-<run>.test prints the claim with the TXT _pushleft-challenge.… token and the CNAME target (the preview hostname). A duplicate claim is refused, and the other organization’s pl domain list is empty.
    • With no DNS record, the scheduler records a failed check. The claim stays pending_verification, no route row exists, Caddy’s automate list 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 becomes active.
    • Caddy gets the certificate by HTTP-01 from the local ACME CA. curl --cacert returns pushleft demo release 2 on the custom name. The release stays live on its preview URL.
    • scripts/ops-alerts.sh probes 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 show lists custom_domain_added, _check_failed, _verified, _routing and _route_active.
    • pl domain remove drains the route. Caddy is back to the single preview route, and automate is empty.
  15. pl down. pl down prints Teardown 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 its deployment_role allocation 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 are failed). So the scheduler queues one remove_environment_gateway job on the app node’s network lane.
    • Its receipt releases the attachment: gateway_status='removed', released_at, evidence gateway: absent and bridge: foreign_retained, and routes/firewall: not_applicable on macOS. The bridge is foreign_retained because 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 deployment destroyed with a deployment_destroyed event. pl list shows it destroyed.
  16. pl up again 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.

  17. Deploy by digest of a plr_-pushed image. An operator allows the organization to deploy images (pushleft-api org external-images). A plr_ push token copies the release image into organizations/<org>/tools/demo. A .pl.yaml with image: and that digest deploys with no build: pl up prints image_resolved and no build_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; test retries_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 up waited about six minutes for a result that could not change. A missed health deadline is now a permanent failure with code unhealthy. Docker and pull errors stay retryable (crates/pushleft-agent/src/application.rs, unhealthy; test a_failed_health_deadline_is_a_permanent_failure).
  • The test proxy buffered SSE. forwarded-https-proxy.py read the whole upstream response, so pl up could never follow events in production mode. It now streams text/event-stream.
  • The web-only fixture served nothing. Its image had no command (busybox sh exits at once), so it could build but never pass health. It now serves /www with busybox httpd on 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-lifecycle removes 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 failed deployments still hold.
Rendered from the repository at build time. Edit docs/pl-up-demo.md to change it.