Handbook
Start here. This page tells you what Pushleft is and how its parts fit together. It also tells you how to run it on a laptop and on servers, and how we change and verify it. Each section links to a longer page. When this page and a longer page disagree, the longer page is correct and this page has a bug.
The full vertical slice (pl up → isolated HTTPS URL → pl down → destroyed) runs end to end in the pl up demo on one host. The staging fleet runs the same journey on Ubuntu VMs with the real network admission chain. Production runs on six Hetzner Robot servers since 2026-11-03 (Robot hosts). Section 6 lists what is still open.
1. The product
Pushleft is a self-hostable deployment platform for small teams. You run pl up in a checkout and get an isolated URL. The platform handles builds, private networking, managed PostgreSQL, ClickHouse and Valkey, backups, custom domains and telemetry.
Every change must keep the core invariants. They include:
- identity binding across retries,
- immutable history,
- fail-closed admission,
- no host Docker socket or secrets for tenant builds,
- subnet slots that are never reused.
Read those invariants before you change anything.
2. Architecture in one screen
Everything is Rust (edition 2024, sqlx on PostgreSQL 17 or newer, axum, rustls). The exceptions are the React/Vite console and the Fleet app (the same React components in a Tauri shell). One PostgreSQL database holds all state. Row-level security is keyed on app.org_id. History tables are append-only, and triggers enforce this.
| Crate | Role | Detail |
|---|---|---|
pushleft-core | Shared contracts: .pl.yaml manifest, plan, typed tasks for build, application, database, volume, network, ingress | manifest.md |
pushleft-api | Control plane HTTP API, auth (tokens, sessions, login codes, TOTP, rate limits), SSE event streams, migrations (pushleft-api migrate), bootstrap-owner, audit, usage and budgets, abuse reports and the org/abuse operator commands, object storage buckets, developer sessions (/v1/sessions) | authentication.md, source-ingestion.md, billing.md, abuse.md, storage.md |
pushleft-cli (pl) | login, up, list, down, logs, plan, project, secrets, config, db (including connect), tunnel, exec, volume, storage, domain, cloudflare, registry, security, ai, mail, errors, git, ssh-key, token, totp, whoami, console-code | pl-up-demo.md, developer-access.md |
pushleft-scheduler | Places work after admission evidence: builds, application roles, databases, volumes; ingress publication; retention GC and the purge of deleted projects; backups; lost-node reclaim; network teardown; custom-domain verification | architecture.md, retention.md |
pushleft-agent-gateway | The only service agents talk to: mandatory mTLS, node-targeted leases, heartbeats, fenced completions, enrollment and certificate renewal, PKI hot reload, the developer session relay | agent-gateway.md, fleet.md |
pushleft-agent | Runs on every node: BuildKit builds (one Kata VM per build in production), Docker application runtime with generation fencing, managed databases and backups, volumes, environment mesh gateway, nftables firewall and host routes, Caddy ingress routes, developer tunnels and shells, disk health, signed self-update | build-executor.md, managed-databases.md |
pushleft-mesh | Headscale coordinator per environment, route approval, Caddy admin client | mesh-coordinators.md |
pushleft-controller | Operator CLI: fleet provisioning and admission, drains, decommission, CA rotation, domain registration and DNS | fleet.md, domain-registration.md |
pushleft-admin | The fleet admin API for the Fleet app: nodes, placements, pipeline, deployments, backups, events, operator actions; passkey sign-in on the management tailnet | crates/pushleft-admin/README.md |
pushleft-ai-proxy, pushleft-mail, pushleft-errors | AI provider gateway, customer mail, Sentry-compatible error ingest | ai-proxy.md, mail.md, errors.md |
pushleft-telemetry-gateway, pushleft-ops | mTLS telemetry ingress; health, readiness and SIGTERM handling shared by all services | operations.md, logs.md |
pushleft-hetzner, pushleft-proxmox, pushleft-cloudflare, pushleft-openprovider, pushleft-secrets, pushleft-source, pushleft-blob, pushleft-seal, pushleft-webauthn | Provider clients, Vault/OpenBao secrets, verified source store, the S3/local blob store and pushleft-offsite (the R2 shipper), sealing, passkeys | retention.md |
The path of one deployment:
- The CLI uploads a verified source snapshot (source ingestion).
- The API records a deployment and resolves the plan.
- The scheduler queues a build only to a build node with the capability and admission evidence.
- The agent builds in rootless BuildKit from the exact archive that the gateway delivers, and pushes to the registry. The gateway publishes the digest under the lease fence. The build reports the image’s user. Under
root_role_policy = block, a production role that would run as root withoutrun_asfails it (effective user). - The scheduler places application roles only after the environment network is admitted.
- The agent starts containers with health checks and generation ownership.
- After durable health, the scheduler publishes Caddy routes. The deployment is
livewith an HTTPS URL. - A later release drains the old route.
pl downremoves routes, then containers, then the environment network, and ends indestroyed.
3. Infrastructure
deploy/README.md gives the production topology, ports, service users, database roles and migrations. In short:
- Control-plane host. It runs the API behind a TLS-terminating proxy that sets the trusted forwarding headers. It also runs the scheduler, agent gateway, controller, telemetry gateway, central collector and alert timer. Systemd units and env examples are in
deploy/systemd/. - Control-plane PostgreSQL. A primary plus a synchronous streaming replica, a WAL archive, a base-backup timer and manual fenced failover. See
deploy/postgres/and the failover runbook. The go-live layout (from 2026-11-02, until revenue) may run it on the control-plane host with no replica (deploy/README.md). - Mesh coordinators. One Headscale container per environment, on one of its own hosts, served by the control-plane Caddy (mesh coordinators).
- Node pools.
buildruns one Kata VM per build with BuildKit inside on Robot hosts, and rootless BuildKit in development.applicationruns Docker plus the host Caddy that is the ingress.databasehas an XFS data volume with project quotas.pushleft-controller fleet provisionprovisions Hetzner Cloud nodes, andfleet enroll-hostenrolls a Robot server you installed yourself (Robot hosts). A customer adds its own server with one command (your own servers). Cloud-init installs Docker, persistsbr_netfilterand the sysctls, downloads the signed agent and enrolls once. The node then renews its certificate (fleet). - Object storage and off-host copies. One Garage node on a database host serves customer buckets (object storage). Every host ships its sealed backups to R2 with
pushleft-offsite, and the Garage buckets are copied to R2 every night (operations). - External. Pushleft uses Vault/OpenBao and an OCI registry with token auth (the agent gateway issues the tokens). It also uses ClickHouse for telemetry, Cloudflare (DNS and R2), Openprovider, Amazon SES for platform mail, and Hetzner.
- Host preconditions on native Linux. Load
br_netfilterwithnet.bridge.bridge-nf-call-iptables=1. The agent refuses environment firewalls without it. You also need Caddy 2.7 or newer,psqlandjq. Container images are digest-pinned indeploy/images.lock.env.
4. Running it
Laptop (development). You need Rust 1.88+, Node 20+ and Docker with Compose.
- Run
herdr-pushleftto open the tmux workspace. dev/setupwrites a private.env.herdr.- The panes run
dev/api,dev/scheduler,dev/web,dev/siteanddev/docker.
Development auth is loopback-only, and it must stay so. The README has the manual steps.
Demo of the full slice. npm run test:pl-up-demo takes about 6 to 7 minutes. It runs real processes in production auth mode: CLI, build, registry, runtime, and Caddy with a per-run wildcard certificate and a local ACME CA. It covers crash replay, a second release, a custom domain, negative tenant, auth, build and health cases, teardown to destroyed, and a redeploy. The pl up demo page says what it proves and what it stubs.
The website and manual. site/ is an Astro static site with the marketing pages and the manual.
- The manual renders
docs/,deploy/README.mdand the README at build time, so it stays in step with the code. npm run sync-docscopies the manual’s sources tosite/content/.npm testinsite/fails when that copy differs from the repository, so a docs change ships with its sync.site/scripts/ascii-titles.py(pyfiglet, Pagga) pre-renders the section titles on the home page.- The two colour figures on the home page are real data.
npm run figuresregeneratessite/src/data/figures.json(lines per source file per crate), andnpm testfails when it is stale.site/src/data/demo-timeline.jsonis a dated record of one measured run. dev/site(orcd site && npm run dev) serves the site on port 4720, at https://pushleft-site.test through the local Caddy. Thesitepane of the herdr runtime tab runs it. The console is at https://pushleft.test.- The site runs on Cloudflare Pages (project
pushleft-site).cd site && npm run deploy:previewbuilds it and deploys it to https://pushleft.dev, withCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDset.
Developer access. An Admin reaches one environment’s private services from a laptop: pl db connect, pl tunnel <role> <port> and pl exec <role>, and a Shell button per service in the console. A Member gets pl exec and the Shell in preview environments only. All go through a relay in the agent gateway, last at most four hours and are recorded (developer access). pl restart <role> restarts a role’s running instances in place, with no crash mail (restart a role).
Test environment data. pl env checkpoint <name> saves every database of a non-production environment, and pl env restore puts a checkpoint or production dumps back. The services stop, the databases load and the same release starts again. The console’s Data page does the same (environment checkpoints).
The Fleet app. Operators run the fleet from apps/fleet-admin, a Tauri app for macOS with an iPad build (2026-11-05). It talks only to the fleet admin API on the management tailnet. Its pages are Overview, Nodes, Map, Pipeline, Deployments, Backups, Events and Arena (the fleet as a playable level). On Nodes, each server has a Terminal: the Mac’s own ssh through the pl-cp jump host. Map shows servers, health, workloads and work in flight. See design baseline.
Servers.
- Follow deploy/README.md for units, roles and migrations.
- Use First live run in the fleet page as the node checklist.
- Read operations for SLOs, alerts (
scripts/ops-alerts.sh, SQL indeploy/observability/alerts/), audit and capacity. - The runbooks are in runbooks/.
Names and domains. Preview and production hostnames end with the organization’s unique handle (<branch>--<project>--<handle>.<base>). So no organization can take the URL of another. The scheduler checks verified custom domains again every day. A domain lapses after three failed checks in a row, which frees the name. Caddy route IDs can carry the organization, and the client refuses a hostname that is routed for another organization. This check is active once the agent calls the org-bound methods. See domain registration.
Per-organization limits. One organization cannot starve the others:
| Limit | Setting | Default | Answer |
|---|---|---|---|
| Deployments queued, building or deploying per org | PUSHLEFT_DEPLOYMENT_MAX_ACTIVE | 20 | 429 deployment_quota |
| Deployment creates per org, through the shared PostgreSQL limiter | PUSHLEFT_DEPLOYMENT_RATE_LIMIT/_WINDOW_SECONDS | 30 per 60 s | 429 rate_limited with Retry-After |
| Open event streams per credential and per org, per API process | PUSHLEFT_EVENT_STREAMS_PER_CREDENTIAL/_PER_ORG | 8 and 32 | 429 stream_limit |
The settings are in deploy/systemd/api.env.example. The scheduler places the next job of the org with the fewest jobs in flight. The gateway leases a node’s queue to the org it served least recently. So a backlog of 1000 jobs does not delay the single job of another org.
- An organization’s trust tier can only lower the deployment cap (new organizations: 5).
- An operator can suspend an organization. This refuses every change and scales its releases to zero.
- Abuse reports go to a queue (abuse controls).
- Retention: only production keeps release history; a preview’s superseded release gives up its source and image at once (decided 2026-11-05).
pl project deletepurges a project’s history 7 days later. - Usage is metered into an hourly ledger priced in EUR. Budgets alert at 50/80/100% and can hard-stop new deployments. There is no payment provider yet (billing).
5. Way of working
Trunk and history. Work lands on main. Commits are authored as the repository owner with the Co-Authored-By and Claude-Session trailers. The dev token that was once in the baseline commit is rotated and removed from history with git filter-repo.
Verification ladder. For every change, run these, then the suites the change touches, one at a time:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
npm run test:allis the full list (seepackage.json).- Each
scripts/*-e2e.shcreates a disposable migrated database and real containers with per-run names and ports. So suites can run on a shared machine. --ignoredRust tests needPUSHLEFT_TEST_DATABASE_URL. The scripts set it.- CI (
.github/workflows/verify.yml) runs the same on Ubuntu, then the Linux-only packet, routing and XFS quota gates.
Native Linux. Docker Desktop hides kernel-level behaviour. So the Linux-only suites run in CI on Ubuntu. The full chain runs on the staging fleet: amd64 VMs on the Proxmox lab host (staging runbook). A local Lima VM (Ubuntu 24.04 arm64) did this on the Mac until 2026-10-23. Lima is no longer used. Suites that need root on Linux (mesh, network agent, XFS quota) escalate only their runtime fixture under PUSHLEFT_MESH_E2E_SUDO=1.
Security gate. npm run security runs cargo audit, npm audit, gitleaks over history, opengrep and a trivy filesystem scan. Then it runs the per-platform runtime image scan with no suppression (scripts/runtime-image-scan.sh).
- The image step is red by decision until 2026-11-16.
- The time-boxed acceptance is
deploy/security/image-risk-register.json.npm run test:security-policyfails when it expires. - Never suppress a package vulnerability to make the gate green.
- Tenant images are scanned at build. Only production builds are gated; findings are stored per deployment and shown on the console’s Findings page (build executor).
- Tenant source is scanned daily per live deployment (Trivy, gitleaks, OpenGrep security rules, Brakeman, importmap pins). It is recorded, never gating, and shown beside the image findings (source scan).
Review. An independent Codex review hook reviewed every turn of agent-produced work. Its findings had to be fixed before the turn could end. Commit messages and docs call out the findings that changed behaviour.
Machine etiquette on a shared host.
- Use
CARGO_BUILD_JOBS=4andnice -n 15for builds and suites. - Run one integration suite at a time per host, and at most three implementation agents in parallel.
- Never kill, renice or reset processes or containers that you did not start. Never prune Docker.
Rules that do not change.
- Development auth stays loopback-only.
- Nothing unfinished is enabled to make a test pass.
- Network readiness needs independent durable evidence. Reserved capacity is not permission to execute.
- Identities (source, artifact, deployment, node, lease, generation) stay bound across retries.
- History is immutable: we add statuses and never delete rows.
- Subnet slots are never recycled.
- Tenant builds never see the host Docker socket, host secrets or privileged mode.
6. Further reading
Production has run real tenants on the Robot fleet since 2026-11-04. It has public DNS and certificates, Headscale admission across several hosts, and off-host backup copies to R2. Still open:
- the decision on the pinned runtime images (the acceptance expires 2026-11-16),
- a control-plane PostgreSQL replica and automatic failover on production,
- two-region failover (operations),
- a payment provider (billing).
Related
- Architecture: invariants, networking and the delivery slices in detail.
- The .pl.yaml manifest: how you describe an app to Pushleft.
- Deploying the control plane: hosts, ports, users and roles.
- Operating Pushleft: SLOs, alerts and disaster recovery.
- Fleet substrate: provisioning, enrollment and node lifecycle.
- Your own servers: add a customer’s server with one command.
- Security findings: the scan mail, the scan log and how to mute a finding.