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/handbook.md

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.

Console A project in the console: traffic, latency, errors and spend, the latest deployment's events and its services.

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.

CrateRoleDetail
pushleft-coreShared contracts: .pl.yaml manifest, plan, typed tasks for build, application, database, volume, network, ingressmanifest.md
pushleft-apiControl 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-codepl-up-demo.md, developer-access.md
pushleft-schedulerPlaces 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 verificationarchitecture.md, retention.md
pushleft-agent-gatewayThe only service agents talk to: mandatory mTLS, node-targeted leases, heartbeats, fenced completions, enrollment and certificate renewal, PKI hot reload, the developer session relayagent-gateway.md, fleet.md
pushleft-agentRuns 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-updatebuild-executor.md, managed-databases.md
pushleft-meshHeadscale coordinator per environment, route approval, Caddy admin clientmesh-coordinators.md
pushleft-controllerOperator CLI: fleet provisioning and admission, drains, decommission, CA rotation, domain registration and DNSfleet.md, domain-registration.md
pushleft-adminThe fleet admin API for the Fleet app: nodes, placements, pipeline, deployments, backups, events, operator actions; passkey sign-in on the management tailnetcrates/pushleft-admin/README.md
pushleft-ai-proxy, pushleft-mail, pushleft-errorsAI provider gateway, customer mail, Sentry-compatible error ingestai-proxy.md, mail.md, errors.md
pushleft-telemetry-gateway, pushleft-opsmTLS telemetry ingress; health, readiness and SIGTERM handling shared by all servicesoperations.md, logs.md
pushleft-hetzner, pushleft-proxmox, pushleft-cloudflare, pushleft-openprovider, pushleft-secrets, pushleft-source, pushleft-blob, pushleft-seal, pushleft-webauthnProvider clients, Vault/OpenBao secrets, verified source store, the S3/local blob store and pushleft-offsite (the R2 shipper), sealing, passkeysretention.md

The path of one deployment:

  1. The CLI uploads a verified source snapshot (source ingestion).
  2. The API records a deployment and resolves the plan.
  3. The scheduler queues a build only to a build node with the capability and admission evidence.
  4. 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 without run_as fails it (effective user).
  5. The scheduler places application roles only after the environment network is admitted.
  6. The agent starts containers with health checks and generation ownership.
  7. After durable health, the scheduler publishes Caddy routes. The deployment is live with an HTTPS URL.
  8. A later release drains the old route. pl down removes routes, then containers, then the environment network, and ends in destroyed.

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. build runs one Kata VM per build with BuildKit inside on Robot hosts, and rootless BuildKit in development. application runs Docker plus the host Caddy that is the ingress. database has an XFS data volume with project quotas. pushleft-controller fleet provision provisions Hetzner Cloud nodes, and fleet enroll-host enrolls a Robot server you installed yourself (Robot hosts). A customer adds its own server with one command (your own servers). Cloud-init installs Docker, persists br_netfilter and 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_netfilter with net.bridge.bridge-nf-call-iptables=1. The agent refuses environment firewalls without it. You also need Caddy 2.7 or newer, psql and jq. Container images are digest-pinned in deploy/images.lock.env.

4. Running it

Laptop (development). You need Rust 1.88+, Node 20+ and Docker with Compose.

  1. Run herdr-pushleft to open the tmux workspace.
  2. dev/setup writes a private .env.herdr.
  3. The panes run dev/api, dev/scheduler, dev/web, dev/site and dev/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.md and the README at build time, so it stays in step with the code.
  • npm run sync-docs copies the manual’s sources to site/content/. npm test in site/ 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 figures regenerates site/src/data/figures.json (lines per source file per crate), and npm test fails when it is stale. site/src/data/demo-timeline.json is a dated record of one measured run.
  • dev/site (or cd site && npm run dev) serves the site on port 4720, at https://pushleft-site.test through the local Caddy. The site pane 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:preview builds it and deploys it to https://pushleft.dev, with CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID set.

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 in deploy/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:

LimitSettingDefaultAnswer
Deployments queued, building or deploying per orgPUSHLEFT_DEPLOYMENT_MAX_ACTIVE20429 deployment_quota
Deployment creates per org, through the shared PostgreSQL limiterPUSHLEFT_DEPLOYMENT_RATE_LIMIT/_WINDOW_SECONDS30 per 60 s429 rate_limited with Retry-After
Open event streams per credential and per org, per API processPUSHLEFT_EVENT_STREAMS_PER_CREDENTIAL/_PER_ORG8 and 32429 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 delete purges 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:all is the full list (see package.json).
  • Each scripts/*-e2e.sh creates a disposable migrated database and real containers with per-run names and ports. So suites can run on a shared machine.
  • --ignored Rust tests need PUSHLEFT_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-policy fails 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=4 and nice -n 15 for 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).
Rendered from the repository at build time. Edit docs/handbook.md to change it.