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

Fleet

Add hosts to the Pushleft fleet, keep their certificates current, update their agent and retire them. Developers never see these tools: operators run pushleft-controller fleet with direct database and provider credentials.

Console Your own servers on the Nodes page: status, reserved capacity and the install of each server, step by step.
Console The one-line install command for a new server, valid for 15 minutes.
Fleet app The operator's Fleet app: open problems, nodes, deployments and reserved capacity.
Fleet app Every node with its pools, liveness, load and disk.
Fleet app One node: status, pressure against reserved capacity, drives and its placements.
Fleet app The fleet as a map: request path, build zone and control plane, coloured by health.
Fleet app Builds and rollouts in flight and their timings.
Fleet app Deployments across organizations, with failures to dismiss.

Quick start

This path enrolls a host that you installed yourself, such as a Hetzner Robot server. Prepare the host first (Robot hosts runbook): mount the XFS data volume at /var/lib/pushleft/data and join the management tailnet.

  1. On the control plane, set DATABASE_URL, PUSHLEFT_FLEET_ENROLL_URL, PUSHLEFT_FLEET_CONTROL_PLANE, PUSHLEFT_FLEET_GATEWAY_CA_FILE, PUSHLEFT_AGENT_RELEASE_URL, PUSHLEFT_AGENT_VERSION and PUSHLEFT_RELEASE_PUBKEY (configuration).

  2. Create the node and its bootstrap script. The script holds a one-time enrollment secret that expires after 15 minutes:

    pushleft-controller fleet enroll-host --pool application --region fsn1 --public-ipv4 203.0.113.10 --out bootstrap.sh
  3. enroll-host prints the node ID and the command below, then waits until the agent enrolls. Run the script on the host as root:

    ssh [email protected] 'bash -s' < bootstrap.sh
  4. On the host, check the result with pushleft-agent doctor.

  5. Make the node schedulable, then check its capacity and heartbeat:

    pushleft-controller fleet admit <node-id>
    pushleft-controller fleet list

To retire a node later, move its volumes off, drain it, and decommission it when fleet list shows it empty (details):

pushleft-controller fleet migrate-volumes <node-id>
pushleft-controller fleet drain <node-id>
pushleft-controller fleet decommission <node-id> --wait 600

To create Hetzner Cloud servers or Proxmox VMs instead, use fleet provision (Provisioning).

Scope

The fleet is the set of Pushleft-managed hosts that run builds, applications, databases and the mesh. This page covers private operator tooling for those hosts:

  • Hetzner and Proxmox provisioning, and bring-your-own hosts.
  • Agent enrollment, short-lived certificates and rotation.
  • Signed agent updates.
  • Inventory, health and capacity.
  • Drains and replacement.
  • The Fleet app, the operators’ desktop view of all of this.

None of this is exposed to the developer API or console. Operators use pushleft-controller fleet … with direct database and Hetzner credentials. The agent gateway is the agents’ side of the same identity.

Live Hetzner provisioning has not been run (gap). No credentials were available. Everything below was run against a local Hetzner API stub (scripts/fixtures/hetzner_stub.py), built from the official OpenAPI document (https://docs.hetzner.cloud/cloud.spec.json). See First live run.

Components

PieceWhere
Hetzner Cloud API v1 clientcrates/pushleft-hetzner
Operator CLI and unhealthy sweepcrates/pushleft-controller/src/fleet/cli.rs; unhealthy sweep in crates/pushleft-controller/src/fleet.rs
Enrollment listener, renewal route, rotation completioncrates/pushleft-agent-gateway/src/enroll.rs
Agent enroll, renew-certificate, renewal loop, host factscrates/pushleft-agent/src/enroll.rs
Agent self-updatecrates/pushleft-agent/src/update.rs
Lost-node reclamationcrates/pushleft-scheduler/src/reclaim.rs; lease refusal with cleanup in crates/pushleft-agent-gateway/src/applications.rs; agent cleanup in crates/pushleft-agent/src/application.rs
CA rotationpushleft-controller fleet ca rotate (crates/pushleft-controller/src/ca.rs); gateway PKI hot reload crates/pushleft-agent-gateway/src/pki.rs
Schemacrates/pushleft-api/migrations/0029_fleet_provisioning.sql, 0037_fleet_reclamation_and_ca_rotation.sql
Unitsdeploy/systemd/pushleft-agent.service, pushleft-agent-update.service
E2Escripts/fleet-e2e.sh (npm run test:fleet), scripts/fleet-reclaim-e2e.sh (npm run test:fleet-reclaim)

Provisioning

pushleft-controller fleet provision --pool build|application|database --region fsn1 --type cx32 [--image ubuntu-24.04] [--placement-group NAME]
pushleft-controller fleet provision --provider proxmox --pool build|application|database --region fsn1 --type pve-8c-16g
pushleft-controller fleet provision --resume <node-id>

--provider defaults to hetzner. See Proxmox VE below. --resume continues a node of either provider.

Provisioning is an operator-run CLI workflow, not a queued job. jobs.org_id is mandatory, and platform nodes belong to no organization. A controller-only job kind would have needed a schema exception for that. Durability comes from fleet_nodes.provision_state:

  1. pending:
    • Insert the fleet_nodes row (provisioning, provider='hetzner').
    • Validate the server type, location, image (matching architecture) and SSH keys.
    • Converge the pool firewall.
    • Generate a 256-bit enrollment secret. Store only its SHA-256, with a 15-minute expiry.
    • Record capacity from the server type, less a fixed host reserve of 0.5 vCPU, 1 GiB and 20 GB. CPU counts 6x on application and database hosts (CPU overcommit).
    • Create the server with cloud-init user_data and the labels pushleft.node_id, pushleft.org=platform and pushleft.pool.
  2. server_requested: poll until the server is running. Record the server ID, type, location, image and public/private IPs.
  3. awaiting_enrollment: wait until the gateway marks the node enrolled. If the secret expires first, the state becomes failed.
  4. enrolled: done. fleet admit <node> then sets schedulable once the node is active, has heartbeated within 60 s and has capacity. It refuses a build node whose schedulable capacity is less than one build (2 CPUs, 4096 MiB, 20 GB). Such a node never gets a build.

Replay safety. The CLI looks up a server by its pushleft.node_id label before it creates one.

  • A crash after creation adopts the existing server. Its user-data holds the secret that is already hashed in the row.
  • A name held by a server without our label is a conflict. The CLI never adopts it.
  • A 429 is retried with Retry-After, or with RateLimit-Reset when RateLimit-Remaining is 0.
  • Idempotent calls also retry 5xx and transport errors, at most 4 attempts with backoff.
  • Server creation never retries blindly. After an ambiguous failure, the CLI looks up the label again.
  • The token comes from HETZNER_API_TOKEN. It is sent only as a bearer header and redacted from Debug and error output.

Configuration (environment):

VariableMeaning
DATABASE_URLControl-plane database (a role that can write fleet_nodes)
HETZNER_API_TOKENHetzner project token (read/write)
PUSHLEFT_FLEET_OPERATOR_CIDRSComma list of SSH source ranges, prefix at least /8 (0.0.0.0/0 is refused)
PUSHLEFT_FLEET_SSH_KEYSComma list of Hetzner SSH key names
PUSHLEFT_FLEET_ENROLL_URLGateway enrollment listener, https://…
PUSHLEFT_FLEET_CONTROL_PLANEGateway mTLS listener, https://…
PUSHLEFT_FLEET_GATEWAY_CA_FILEPEM CA the agent uses to verify the gateway server certificate
PUSHLEFT_AGENT_RELEASE_URL, PUSHLEFT_AGENT_VERSIONPinned agent release
PUSHLEFT_RELEASE_PUBKEYBase64 raw 32-byte Ed25519 release public key

Proxmox VE

--provider proxmox makes a node a full clone of a cloud-init template VM. The fleet admin API does the same with POST /v1/nodes/provision {"provider": "proxmox", ...}. scripts/staging/staging.sh makes the staging fleet on pve1 this way (staging runbook).

  • The row has provider='proxmox' (migration 0085). provider_server_id is the VMID, and public_ipv4 is the VM’s static address on the bridge.
  • --type is pve-<cores>c-<memory GiB>g.

The steps, each resumable:

  1. pending:
    • Allocate the first VMID in PUSHLEFT_PROXMOX_VMID_RANGE and the first address in PUSHLEFT_PROXMOX_IP_RANGE that no row records (as public_ipv4 or private_ipv4), except a deleted one. For VMIDs, no VM that the token can see may have it either.
    • The allocation holds an advisory lock and is kept on the row, so a resume reuses it.
    • Clone the template (full clone, into PUSHLEFT_PROXMOX_POOL). Refuse a VMID that holds any VM other than the node’s (matched by name).
    • Set cores, memory, cpu=host and cloud-init (user, the provisioner’s SSH public key, ipconfig0, nameservers).
    • Add the data and backup disks when missing, grow the root disk to the pool’s size, and start the VM.
  2. server_requested: wait for SSH and cloud-init. Then run one script over SSH as root. The script:
    • Formats and mounts the data disk (XFS with prjquota) at /var/lib/pushleft/data, and the backup disk at /var/backups/pushleft.
    • Installs PUSHLEFT_FLEET_NODE_CA_FILE as a system CA.
    • Joins the management tailnet with a one-use, 15-minute node pre-auth key, minted at that moment through the management Headscale’s API.
    • Runs the same bootstrap that enroll-host writes, with an enrollment secret armed right before (a full clone can take longer than 15 minutes).
    • Prints the tailnet address, which is recorded as private_ipv4.
  3. awaiting_enrollment, enrolled: as for Hetzner. Capacity comes from the agent’s host facts at fleet admit, as for BYO hosts.

Why SSH and not user-data. Proxmox passes custom user-data only as a cicustom snippet file on a snippets storage, and its API cannot upload one. The upload call takes iso, vztmpl and import only (checked on pve1, Proxmox VE 9.2). Writing the file would need root on the Proxmox host.

  • The bootstrap therefore runs from the control plane over SSH. This needs PUSHLEFT_PROXMOX_BOOTSTRAP=ssh and a direct route to the bridge (cp is on vmbr20 in staging).
  • The VM’s host key is trusted on first use.
  • The template must carry tailscale and xfsprogs (scripts/staging/base-setup.sh installs both).

Removal. fleet decommission stops the VM and deletes it with purge=1 and destroy-unreferenced-disks=1. It does this only inside the VMID range, and only when the VM carries the node’s name. A VM that is already gone is fine. The VMID and address are free again once the row is deleted. fleet replace makes a like-for-like Proxmox node.

Token rights. The token needs:

  • VM.Clone, VM.Allocate, VM.Config.*, VM.PowerMgmt and VM.Audit on the pool, the template included.
  • Datastore.AllocateSpace on the storage.
  • SDN.Use on the bridge.

Staging’s staging@pve!fleet has exactly the pool rights.

VariableMeaning
PUSHLEFT_PROXMOX_URLhttps://<host>:8006; the certificate must name the host
PUSHLEFT_PROXMOX_NODEProxmox node name, for example pve1
PUSHLEFT_PROXMOX_TOKEN_FILEJSON {"full-tokenid": "user@realm!name", "value": "..."} (pveum user token add --output-format json), 0600
PUSHLEFT_PROXMOX_CA_FILEThe cluster CA (/etc/pve/pve-root-ca.pem), the only trust anchor
PUSHLEFT_PROXMOX_TEMPLATE_VMIDThe cloud-init template, outside the VMID range
PUSHLEFT_PROXMOX_VMID_RANGE150-199: the only VMIDs created or deleted
PUSHLEFT_PROXMOX_POOLOptional resource pool for new VMs (required for a pool-scoped token)
PUSHLEFT_PROXMOX_STORAGE, PUSHLEFT_PROXMOX_BRIDGEDisk storage and the NIC’s bridge
PUSHLEFT_PROXMOX_IP_RANGE10.20.1.40-10.20.1.79/24: static addresses, reserved for this
PUSHLEFT_PROXMOX_GATEWAY, PUSHLEFT_PROXMOX_DNSGateway; space- or comma-separated nameservers
PUSHLEFT_PROXMOX_ROOT_GBRoot disk GiB per pool, default build=120,application=40,database=40
PUSHLEFT_PROXMOX_DATA_GB, PUSHLEFT_PROXMOX_BACKUP_GBData and backup disks, default 64 and 32
PUSHLEFT_PROXMOX_BOOTSTRAPMust be ssh
PUSHLEFT_PROXMOX_SSH_KEY_FILEProvisioner private key (its .pub next to it goes into cloud-init), readable by the service user only
PUSHLEFT_PROXMOX_SSH_USERCloud-init user, default ubuntu
PUSHLEFT_FLEET_NODE_CA_FILEOptional PEM CA installed system-wide on the node before it joins (a private CA behind the login server or the release URL)
PUSHLEFT_FLEET_MGMT_LOGIN_SERVERhttps://mgmt.<base>
PUSHLEFT_FLEET_MGMT_HEADSCALE_URLThe management Headscale’s HTTP listener, http://127.0.0.1:8085 on cp
PUSHLEFT_FLEET_MGMT_HEADSCALE_API_KEY_FILEA Headscale API key (hs apikeys create --expiration 90d), 0600, for the user that runs the provisioning

The Headscale API key can mint keys for every management user, node included. It is as sensitive as Docker access on cp. Keep it readable by the admin service user only, and renew it before it expires (hs apikeys list, hs apikeys expire).

Cloud-init

The user-data is a bash script of at most 32 KiB, with quoted heredocs. Each value is validated before rendering: UUID, hex secret, https URLs without shell metacharacters, version grammar, base64 and PEM-only CA. The script:

  1. Writes /etc/pushleft/agent.env, the gateway CA, the release public key (SPKI PEM) and the enrollment secret (/var/lib/pushleft/enrollment-secret, 0600).
  2. Merges "userns-remap": "default" into /etc/docker/daemon.json (keeping any other keys) before Docker is installed.
  3. Installs ca-certificates curl openssl zstd docker.io nftables, pushleft-firewall-restore.service and the Docker drop-in that requires it.
  4. Restarts Docker and checks that docker info lists name=userns (workload hardening).
  5. Downloads SHA256SUMS, SHA256SUMS.sig and the release tarball. It verifies them with openssl pkeyutl -verify -rawin and sha256sum -c --strict before it installs /usr/local/bin/pushleft-agent (signed updates).
  6. Installs both systemd units, runs pushleft-agent enroll and enables pushleft-agent.service.

The agent service has ConditionPathIsMountPoint=/var/lib/pushleft/data. It does not start until the operator has attached and mounted the XFS data volume. The bootstrap also creates /etc/pushleft-otel and /var/lib/pushleft-otel. The unit binds them read-write, and systemd refuses to start it (226/NAMESPACE) when they are missing.

Firewall

Host precondition. br_netfilter must be loaded with net.bridge.bridge-nf-call-iptables=1. Cloud-init writes /etc/modules-load.d/pushleft.conf and /etc/sysctl.d/90-pushleft.conf.

Environment rules sit in the inet forward hook. Bridged frames between the mesh gateway’s port and a workload traverse that hook only with br_netfilter. Without it:

  • pushleft-agent manage-firewall refuses to apply or verify rules.
  • The recurring gateway health_check fails.
  • Every heartbeat reports the live value as host.bridge_netfilter.

Gap: the agent reports a module unloaded after admission and takes no action. Running environments keep their now-bypassed rules until an operator drains the node. Bridge-family rules that do not depend on br_netfilter are the upgrade. The gap showed up on native Ubuntu 24.04 with Docker 29, which no longer loads the module itself. The Linux worker suites pass --sysctl net.bridge.bridge-nf-call-iptables=1 and need the module on the host.

Each pool has one Hetzner firewall, pushleft-<pool>. It is attached in the create request, so a server never boots without it. Inbound rules are exact and converged with set_rules:

  • 22/tcp from PUSHLEFT_FLEET_OPERATOR_CIDRS only.
  • 80/tcp and 443/tcp from anywhere, on application (ingress) pool nodes only.
  • Nothing else. Agent, telemetry and management traffic is outbound. The agent dials the gateway, and Tailscale/Headscale uses the management mesh with outbound NAT traversal or DERP. The Hetzner firewall does not restrict outbound traffic.

Workload hardening

Workload hardening limits what a tenant container can reach if it escapes. The codes in brackets are the findings each item closes.

  • userns-remap (H3). Container root is a subordinate uid of dockremap. Docker creates the user and its /etc/subuid range. A runc or kernel escape is therefore not host root.
    • Docker keeps a separate image and container store under /var/lib/docker/<uid>.<gid>. Turning it on for a node that already runs containers hides them from Docker. Enable it on fresh nodes only: drain an older node and enroll a fresh one.
    • The agent detects the mode (docker info: root dir suffix and name=userns). Before docker run, it hands every bind source it wrote to the remapped root. The bind sources are database data, secrets and archive directory, restored PostgreSQL bases, drill scratch, application volume directories, mesh state, key and CA snapshot. It uses lchown, never follows symlinks, and walks only trees that no container has mounted.
    • The agent advertises "userns_remap": 1, and pushleft-agent doctor reports the state. The scheduler places applications and databases only on a node that advertises it. PUSHLEFT_REQUIRE_USERNS_REMAP=false turns this off on development hosts.
    • A job for work already on a node without it waits until the node reports it again.
    • Application containers get no --user. Images that need root inside keep working, and that root is unprivileged on the host with every capability dropped.
    • The build container is the one --userns=host exception. Rootless BuildKit needs a 65536-id range of its own, and Kata’s boundary is the VM (build executor). Build hosts serve only the build pool.
    • Limit: the remap is one range per daemon. An escaped container is the same host uid as every other container on that host, and can reach their bind-mounted files. On a shared application host, that is other tenants’ volumes and mesh state. Database and application data sit together only on org-dedicated hosts (H5). The escape does not reach host credentials (/etc/pushleft, the agent key), which stay host root. Nodes hold no Vault token.
  • Firewall before containers after a reboot (M1). Containers keep --restart unless-stopped.
    • The agent saves each environment’s nft transaction to /var/lib/pushleft/firewalls/<table>.nft.json once the kernel provably holds it. The recurring check backfills tables that an older agent applied. The agent deletes the file before it deletes the table.
    • pushleft-firewall-restore.service (Before=docker.service) loads every saved file.
    • The drop-in docker.service.d/pushleft-firewall.conf makes Docker Require it. A file that fails to load keeps Docker, and every tenant container, down. The node then misses heartbeats and goes unhealthy.
    • We chose the restore unit over --restart no with agent-started containers. The unit is about 20 lines, against a startup reconciler that must know every environment’s firewall before the gateway leases anything. It also covers database and mesh gateway containers.
    • Nodes bootstrapped before this have neither the unit nor the remap. Drain them and enroll fresh ones.
  • Host input (M2). From an environment bridge, the host accepts only reply-direction established/related packets (ingress Caddy’s own connections to containers). The host drops everything a container opens towards it.
  • Noisy neighbours (L4).
    • Application containers get --ulimit nofile=65536:65536 and local logs of 3 x 10 MB (was 5 x 20 MB). The existing CPU, memory, swap and PID limits still apply.
    • Each environment gets at most 8192 new tracked flows from its bridge (ct count over).
    • Block I/O is not limited. Equal --blkio-weights change nothing, and NVMe’s default none scheduler ignores weights. Per-device io.max is planned.
  • Bounded logs for every container. On staging, a ClickHouse container’s unbounded json-file log reached 19 GB, filled the control-plane host and stopped its PostgreSQL. Now:
    • The node bootstrap sets the Docker daemon’s default to "log-driver": "local" with 3 x 10 MB on every pool, mesh included. It uses setdefault, so an explicit setting wins. A container started without its own log options cannot fill the disk.
    • It also sets default-address-pools to 10.96.0.0/12 in /24 networks (about 4096), clear of the environment bridges (10.128.0.0/9), the tunnel bridge and the tailnet. Docker’s own pools hold about 31 networks, and every mesh coordinator and every build takes one; on a staging mesh host they ran out (2026-11-01). The agent adds the same setting to an enrolled host’s daemon.json at start; it applies after Docker’s next restart. The mesh worker also retires the coordinator of a destroyed segment: its route, DNS record set, container, network and state.
    • The platform’s own containers also pass their limits explicitly: applications, builds, databases (20 MB), the network helper and the registry unit.
    • Hosts enrolled before this get the same merge from the agent at its start. The agent writes /etc/docker directly where its unit allows it (units from 2026-10-25). Otherwise it runs a one-off systemd-run job outside its sandbox. Older units keep ProtectSystem=strict, and a self-update replaces only the binary. The agent already drives Docker as root, so this widens nothing.
    • A host with its own log driver keeps it. Size options are added only for local and json-file, and only the missing ones (a configured max-size stays).
    • Docker reads daemon.json when it starts, and applies the default only to containers created after that. An existing host needs a Docker restart and then its containers’ next recreation. Each new deployment recreates application containers anyway. Nothing restarts Docker for this.

Proof so far.

  • Unit tests for the rendered rules, bootstrap and argument shapes.
  • npm run test:linux-firewall for M1 and M2 in a Linux namespace.
  • On 2026-10-20, the Lima harness on a remapped Docker 29 daemon on Ubuntu 24.04. The harness was removed on 2026-10-23, and the staging fleet runs these paths now (staging runbook). It showed that:
    • Container root is host uid 100000.
    • The environment mesh gateway (TUN, wrapped pre-auth key, state directory) enrolls under the remap.
    • Two organizations’ containers on one node reach neither each other nor the host.
    • After a reboot, the saved tables load before dockerd starts, and the containers return with their addresses.

The harness found three defects, now fixed:

  1. A pre-auth key rewritten for a stopped gateway’s restart stayed root-owned and unreadable under the remap.
  2. After a reboot, an application container took the gateway’s static address. Environment bridges now allocate dynamically only from the upper half of the /24.
  3. Application containers got a new address on restart while the ingress route kept the old one. They now get a fixed address from the lower half.

The database and volume paths under the remap are still not exercised (gap).

Control-plane host alerts

Control-plane hosts get the same disk and memory alerts as fleet nodes. They were added after staging’s control-plane disk filled (a 19 GB container log) and stopped its PostgreSQL with no warning. Fleet’s alerts covered fleet nodes only, and the control-plane hosts are not nodes.

A control-plane host runs no agent, so it has a host collector of its own (deploy/observability/otelcol-cp-host.yaml as pushleft-otelcol.service, installed by install-control-plane.sh since 2026-11-05). Its host.id is the host’s short name, such as pl-cp. The admin API’s GET /v1/control-plane/hosts reads them like node metrics:

  • Disk per filesystem, with the level from the fullest one. Summing them let cp’s empty data disks hide a 55% root as 17%.
  • Memory, load per core (system.cpu.logical.count) and sample time, and the last hour for the sparklines.
  • Drive and RAID health. pushleft-host-health.timer runs pushleft-agent disk-health (the binary only, no agent service; it needs smartctl) every 10 minutes as root. install-control-plane.sh turns it on only when both are installed. It writes /var/lib/pushleft-host-health/<short hostname>.json, which the admin API reads from PUSHLEFT_ADMIN_HOST_HEALTH_DIR. The node page shows it as for a fleet node. It raises no desktop alert yet (gap).
  • A level with the node thresholds: disk warn 80% and critical 90%, memory 92% and 95%.

A host with no sample for 5 minutes is stale, so a collector or host that died does not show as healthy.

The Fleet desktop app shows them in a Control plane panel on Overview and raises warnings in Needs attention. It notifies through the same desktop alerts as nodes: disk at 90%, memory at 92%, silent for 5 minutes. It sends one notification when an alert opens, and the Dock badge counts open ones.

The desktop app is the only channel for these alerts, so they need the app running on an operator’s machine. Operations lists the server-side alerts that page.

Fleet nodes are judged the same way. GET /v1/nodes gives each node’s now.disks (per device, fullest first) and now.disk_share (the fullest). The Fleet app’s disk level, alerts and node page use that filesystem. Before, a node’s figure was all filesystems’ used bytes over the data disk’s size, so an empty data disk could hide a full root.

Enrollment

Enrollment gives a new host its first client certificate. The gateway serves POST /v1/enroll on a separate listener (PUSHLEFT_AGENT_ENROLL_BIND). It uses TLS with server authentication only and no client certificate. The listener has only that one route. It cannot lease, heartbeat or complete jobs.

Request: {node_id, enrollment_secret, csr_pem}.

  1. The gateway parses the CSR and verifies its signature (proof of key possession). Its CN must equal the node ID, and any SANs must be DNS names equal to the node ID. Otherwise the gateway returns 400. The CSR is checked before the secret, so a malformed request does not use up the secret.
  2. One UPDATE consumes the secret: matching hash, enrollment_used_at IS NULL, unexpired and node provisioning. The node becomes active with a fresh last_seen_at. An unknown node, a wrong, expired or used secret and a non-provisioning node all return the same 401 enrollment_refused.
  3. The gateway signs a client certificate with the operator CA key and inserts it as fleet_node_certificates purpose agent.
    • The certificate has CN and SAN DNS set to the node ID, EKU clientAuth only, KeyUsage digitalSignature, no CA flag and a random serial.
    • The X.509 notBefore is backdated 60 s for replica clock skew. The stored window is the nominal lifetime.
    • The response is {certificate_pem, ca_pem, not_after}.

Gateway configuration:

VariableMeaning
PUSHLEFT_AGENT_CA_KEY_FILEPKCS#8 PEM CA key. It must be a regular file with no group or other permission bits, or the gateway refuses to start. Unset disables issuance (renewal returns 503).
PUSHLEFT_AGENT_CA_CERT_FILEIssuing CA certificate. Defaults to PUSHLEFT_AGENT_CLIENT_CA.
PUSHLEFT_AGENT_CERT_LIFETIME_SECONDSDefault 86400, range 30 s to 30 days
PUSHLEFT_AGENT_ENROLL_BINDEnrollment listener. Requires the CA key.

The agent (pushleft-agent enroll) generates an ECDSA P-256 key locally. The key never leaves the host.

  1. The agent stages the key and certificate atomically: temp file, fsync, rename, 0600, then directory fsync.
  2. It deletes the secret file.

Running it again with an identity already staged does nothing. Certificates live in /var/lib/pushleft/pki, because /etc/pushleft is read-only to the agent service.

Rotation

Agent certificates last 24 hours by default, so the agent renews them automatically.

  • POST /v1/agent/certificate/renew (mTLS, {csr_pem}) returns a new certificate in two cases. Either the presenting certificate has less than a third of its stored lifetime left, or the gateway’s current CA did not issue it. Otherwise the answer is 409 renewal_not_due.

    • Every issued row records issuer_ca_sha256. Certificates from before migration 0037 have none, and renew at the next check.
    • The new row records replaces_id.
    • The response carries ca_pem, the gateway’s trust bundle (PUSHLEFT_AGENT_CLIENT_CA).
  • The agent’s run loop calls it every PUSHLEFT_AGENT_RENEW_CHECK_SECONDS (default 600). When renewal succeeds, the agent:

    1. Restages the key and certificate atomically.
    2. Stages the bundle as gateway-ca.pem beside the certificate (/var/lib/pushleft/pki).
    3. Builds a new client and checks it against /healthz.
    4. Swaps it in place. Every request takes the current client, so in-flight jobs keep their leases and heartbeat with the new certificate.

    If the check fails, the agent exits, and systemd (Restart=always) starts it from the staged files. Abandoned leases expire and retry under token fencing.

  • Once gateway-ca.pem exists, it replaces the bootstrap PUSHLEFT_AGENT_CA (read-only under /etc/pushleft). It arrived over an mTLS session that the previous trust verified. After a CA rotation, the agent stops trusting the old CA at its next renewal.

  • On the first lease with a certificate from renewal, the gateway revokes (revoked_at) every older agent certificate of that node, in the same transaction.

    • From then on, the old fingerprint gets 401 on every route: lease, heartbeat, complete, source, identity and renew.
    • Until that first lease, the old certificate keeps working, so a lost renewal response does not lock the node out.
    • Each later renewal attempt issues a fresh certificate, and the first one used retires all earlier ones.
  • pushleft-agent renew-certificate performs one attempt by hand.

  • Late renewal. A node offline past its certificate’s expiry can still renew with it for PUSHLEFT_AGENT_CERT_RENEW_GRACE_SECONDS after not_after (default 7 days, 0 disables).

    • The TLS handshake accepts such a certificate only when expiry is its sole fault. The chain, the signature and possession of the key are verified as of its not_after.
    • Every route except /v1/agent/certificate/renew then refuses it (401), because authentication checks the stored validity window.
    • A revoked certificate, or a revoked or retired node, never renews.
    • Each late renewal is recorded as an agent_certificate_late_renewal fleet event (old and new fingerprint, expiry, remote address).
    • Past the grace, drain the node and enroll it again.

A build that is downloading its source when the swap happens keeps the snapshot client for that download. The old certificate stays valid until the node’s next lease.

This covers agent mTLS certificates. Environment-mesh (Headscale) pre-auth keys have their own workflow (mesh coordinators).

Gateway server certificate. The gateway server certificate lasts one year. To re-sign it with the current CA (same key and names), run pushleft-controller fleet ca renew-server on the gateway host.

  • It uses the same file variables as a rotation.
  • It is refused while a rotation is in progress. That rotation’s --complete re-signs the certificate anyway.
  • The gateway reloads the certificate within 2 s.
  • certificate_file_expiring in ops-alerts warns 30 days ahead when the file is in PUSHLEFT_OPS_CERT_FILES.

Credential lifetimes

This table lists every credential that a node or the fleet depends on, how it is renewed, and what alerts before it runs out. Operations has the same table with the control-plane credentials.

CredentialLifetimeRenewalAlert
Agent client certificate24 h (PUSHLEFT_AGENT_CERT_LIFETIME_SECONDS)Automatic: the agent renews at a third of its lifetime left (checked every 10 min, and at start). Up to 7 days after expiry it still renews on the renewal route only (late renewal, audited).agent_certificate_not_rotating (page): an active, unhealthy or draining node 30 min past its renewal point (7.5 h left for 24 h) or expired
Enrollment secret15 min, single useNone by design: a new fleet provision / enroll-host—
Gateway server certificate1 yearManual: fleet ca renew-server, or fleet ca rotate --completecertificate_file_expiring (ticket at 30 days, page at 7)
Fleet CA5 yearsManual: fleet ca rotate --begin / --complete, no outagecertificate_file_expiring
Telemetry client certificate (purpose='telemetry')As issued by the operatorNone: issued and replaced by hand (gap). At expiry the node’s telemetry stops; the node keeps working.telemetry_certificate_expiring (ticket, 30 days)
Environment-mesh gateway node (Headscale)No expiry (node.expiry: "0")Not needed: gateways never re-authenticate. Coordinator ensure clears any expiry still set (nodes registered under the earlier 720 h default) with headscale nodes expire --disable.mesh_node_expiring (page): an expiry it could not clear, under 7 days away; route checks also log mesh_node_expiry_near
Headscale pre-auth key10 min, single useNone by design: a new enrollment intent—
Registry token15 minPer operation from the gateway—

CA rotation

The fleet CA issues agent client certificates and the gateway server certificate. It rotates in two phases without a fleet outage. Run the controller on the gateway host, with the gateway’s own file variables and DATABASE_URL:

VariableRole in a rotation
PUSHLEFT_AGENT_CA_CERT_FILEIssuing CA certificate. Required, and must differ from PUSHLEFT_AGENT_CLIENT_CA.
PUSHLEFT_AGENT_CA_KEY_FILEIssuing CA key, 0600
PUSHLEFT_AGENT_CLIENT_CATrust bundle for client certificates; also sent to agents in renewal responses
PUSHLEFT_AGENT_GATEWAY_CERT, PUSHLEFT_AGENT_GATEWAY_KEYGateway server certificate (re-signed at --complete) and key
  1. Run pushleft-controller fleet ca rotate --begin. It:

    • Archives the current CA as <file>.previous (key 0600).
    • Generates a new ECDSA P-256 CA.
    • Writes the bundle as new + old, then the new key and certificate.
    • Records ca_rotation_begun with both CA fingerprints.

    Every certificate that the new CA did not issue is now due for renewal. The renewal response carries the two-CA bundle, so each agent trusts the new CA before anything switches. The gateway server certificate is still from the old CA.

  2. Agents renew at their next check (PUSHLEFT_AGENT_RENEW_CHECK_SECONDS) and swap clients in place. Old-CA certificates keep authenticating during the overlap.

  3. Run pushleft-controller fleet ca rotate --complete. It is refused while any active, unhealthy or draining node has no unrevoked, unexpired agent certificate from the new CA, and it lists those nodes. Otherwise:

    • In one transaction, it revokes every agent certificate that the new CA did not issue, and records ca_rotation_completed.
    • It re-signs the gateway server certificate with the new CA: same common name and DNS/IP names, server-auth only, existing key.
    • It trusts only the new CA, and deletes the archived old key and certificate.

    If it fails after the commit, run --complete again to finish.

  4. To undo, run pushleft-controller fleet ca rotate --abort. It restores the archived CA, but only while the new CA has issued no certificate (ca_rotation_aborted).

The gateway re-reads its PKI files every 2 s, with no restart and no SIGHUP.

  • It loads a changed set in full and self-tests it before it replaces the running one. The CA key must sign a certificate that the CA certificate verifies, and the issuing CA must be in the trust bundle. A half-written set keeps the previous configuration.
  • New handshakes use the new configuration. Established connections keep their session.
  • Certificate issuance takes a shared PostgreSQL advisory lock, which the rotation phases take exclusively. It refuses to issue from a CA whose rotation was aborted, so a gateway that has not reloaded cannot issue from it.
  • Keys never enter the database. fleet_events holds only CA fingerprints and counts.

Limits:

  • Nodes provisioned during the overlap get PUSHLEFT_FLEET_GATEWAY_CA_FILE in cloud-init. Point it at the two-CA bundle until --complete, then at the new CA.
  • lost nodes do not block --complete, which revokes their old-CA certificates. A lost node that returns after a completed rotation cannot authenticate, so it never receives its cleanup list. Stop its containers by hand or reimage it.
  • Telemetry certificates (purpose='telemetry') are not part of this rotation, and nothing issues or renews them (telemetry_certificate_expiring warns 30 days ahead).
  • A compromised CA key needs the incident runbook first (gateway CA compromise). A rotation alone does not show which certificates the holder minted.

Lost nodes

A lost node is one that stopped sending heartbeats. The scheduler fences its work and replaces its applications on other nodes.

The scheduler marks an active, unhealthy or draining application, build or database node lost once its last_seen_at is older than PUSHLEFT_NODE_LOST_AFTER_SECONDS (default 300, minimum 30). Mesh coordinator nodes are excluded.

Gateway outage guard. When no admitted node has heartbeated within that window, the scheduler treats the agent gateway (or the path to it) as the cause.

  • Nothing is reclaimed. The scheduler logs fleet_heartbeats_absent as an error, and the fleet_heartbeats_absent alert pages.
  • The scheduler also waits one window after such a silence, and after its own start, before it reclaims again. Nodes that reconnect one by one after an outage are then not declared lost in the race.

The scheduler handles each lost node in one transaction:

  1. Set status='lost', schedulable=false and lost_at. Write a node_lost row in fleet_events (unique per node). The row records the silence, the fenced job count and kinds, lost and replacement instance counts, released allocations and stranded databases.

  2. Fence every queued or leased agent job targeted at the node: failed, lease token cleared, last_error='target node lost; lease fenced'. Jobs are never retargeted. The gateway answers every later heartbeat or completion from a lost node with 409 lease_conflict (the stale-lease path), and writes no result row.

  3. Handle fenced side effects. A build whose artifact was not yet published fails its deployment (build_failed, code=node_lost). A publishing ingress route becomes failed, and is republished once the replacement is ready.

  4. Its application instances (deploying, ready, error, draining) become lost. That status is terminal, and rows are never deleted. Reserved-only instances go back to pending_placement.

  5. Release its deployment_role and network_attachment allocations. Subnet slots (network_attachment_requests) are kept and never reused.

  6. Give each lost instance of an active deployment a replacement row: same role slot, generation + 1, replaces_instance_id, and a normal ensure_application job. Placement then follows the usual rules:

    • A fresh, schedulable node in the deployment’s regions.
    • A network attachment request on that node.
    • Fresh network admission evidence before the job is targeted.

    With a sealed environment topology, a node that is not yet a member joins it through a topology revision. The replacement starts after every member has rolled. A role bound to a volume or a box-bound address stays on its member node. Release and job roles that already ran do not run again.

  7. A live deployment stays live while it waits. It becomes degraded, with a deployment_degraded event, if no eligible application node exists or a replacement is rejected or fails. It returns to live (deployment_recovered) when its long-lived roles are ready and no route on a lost node is still active.

  8. Database instances on the node become error, with a database_instance_stranded fleet event. Their allocations stay held and nothing moves, because the data is on that disk (restore and relocation).

Ingress. A live deployment keeps its active route on the lost node at first. The route stays until every primary web instance (including the replacement) is ready on an active allocation of a healthy node.

  1. The scheduler publishes a relocation route (relocation=true, the hostname’s next generation) through the normal publish_ingress path.
  2. When that route activates, the gateway moves the lost node’s route for that hostname to draining (ingress_route_relocated).
  3. The deployment is live again only when no hostname is still served from a lost node and every long-lived role is ready.

A failed relocation leaves the old route and degrades the deployment. It is retried per hostname after five minutes, at most three failures. With platform DNS configured, each hostname’s record follows its route to the new node; otherwise the operator-managed wildcard must point at the new ingress host (node lost runbook).

Return of a lost node

A self-hosted node can drop off for an ordinary reason: its uplink, a firewall or a power cut. Pushleft puts such a node back into service when its agent polls again.

  1. While the node is lost, each lease request gets 403 node_lost and a cleanup list.
  2. The list holds one TeardownApplicationTask for each instance fenced away from the node, 64 at most per response.
  3. The agent runs the normal fenced teardown for each task. It removes only containers with matching ownership labels and generation. A second run of the same list removes nothing.
  4. The gateway records each refused poll in last_seen_at. The first poll sets returning_since.
  5. After a gap of more than 60 s, the next poll sets returning_since again.
  6. After PUSHLEFT_NODE_RETURN_AFTER_SECONDS of polls without a gap (default 300, minimum 60), the scheduler sets the node active and not schedulable. The gateway leases work only to active nodes.
  7. In the same transaction, the scheduler:
    • queues a teardown job marked returned for each fenced instance, at its exact generation. The instance stays lost, because its replacement owns the role slot.
    • queues a health check for each stranded database (error, with no release requested). The result sets the database ready or degraded.
    • charges the gateway capacity of each surviving network membership again.
    • writes a node_returned fleet event.
  8. Until the node is back in service, the gateway leases it these jobs only.
  9. When every returned teardown is complete and every database check has a result, the scheduler restores the earlier status and schedulable flag. A draining node stays draining.
  10. A failed teardown leaves the node unschedulable, because a container can still run on it.

Replacements bound to the volume of the node go back to it through normal placement.

Each step uses the rows and generations of the control plane. A report from the node changes none of them. The agent certificate of the node is its only way back in.

To keep a lost node lost, run pushleft-controller fleet block <node>. Run fleet unblock to let it return. fleet decommission revokes the certificate for good.

Known limit: the ingress Caddy on the node can keep a route that was removed while the node was lost. By then, the hostname resolves to the relocation route.

pushleft-controller fleet list shows lost nodes with their reclamation result. pushleft-controller fleet events lists recent fleet events.

Signed agent updates

Agent updates are signed with an offline key, and each node checks the signature before it installs a new binary. The release layout under <release_url>/<version>/ is:

  • pushleft-agent-<version>-linux-<amd64|arm64>.tar.zst, containing exactly one regular file, pushleft-agent (build with tar --zstd -cf … pushleft-agent).
  • SHA256SUMS in sha256sum format.
  • SHA256SUMS.sig: base64 of the raw Ed25519 signature over the exact SHA256SUMS bytes.

Signing (operator, offline key):

openssl genpkey -algorithm ed25519 -out release.key            # once; keep offline
openssl pkey -in release.key -pubout -outform DER | tail -c 32 | base64   # PUSHLEFT_RELEASE_PUBKEY
sha256sum pushleft-agent-0.2.0-linux-*.tar.zst > SHA256SUMS
openssl pkeyutl -sign -rawin -inkey release.key -in SHA256SUMS | base64 > SHA256SUMS.sig

To update a node, change PUSHLEFT_AGENT_VERSION in agent.env. The oneshot pushleft-agent-update.service then runs pushleft-agent self-update, which:

  1. Downloads all three files over HTTPS, with bounded sizes.
  2. Verifies the signature with the pinned key (ring Ed25519, already in the lock through rustls).
  3. Finds the exact file name for the requested version in the signed sums. The version is part of each signed name, so an old signed release cannot be served as a newer version.
  4. Checks SHA-256, then extracts only pushleft-agent. Any other entry, link or path is refused.
  5. Writes it next to the target (fsync, 0755), runs --version and renames it over /usr/local/bin/pushleft-agent.
  6. With --restart, runs systemctl restart pushleft-agent.

pushleft-agent.service keeps /usr read-only. The update unit gets ReadWritePaths=/usr/local/bin. --release-ca / PUSHLEFT_RELEASE_CA_FILE adds a trust root for a private release mirror.

A release build carries its version (PUSHLEFT_AGENT_RELEASE at build time). Such an agent updates itself:

  1. Every 10 minutes it reads <PUSHLEFT_RELEASE_URL>/latest, a file holding one release version.
  2. When that names another release, it stops leasing jobs and waits until none run. A developer session does not count: the restart drops it.
  3. It starts pushleft-agent self-update --restart as a transient systemd unit with the same sandbox as pushleft-agent-update.service. The steps above run there.
  4. When the update fails, the agent keeps its version and takes jobs again.

To release to every node, publish the release, then write its version into latest. Every node takes it within about 10 minutes. There is no canary group (gap). A local build has no release version and never updates itself.

Downgrades are possible when the operator picks an older version, in agent.env or in latest.

Signed pl releases

The CLI is published the same way, under https://releases.pushleft.dev/cli/<version>/: pl-linux-amd64, pl-darwin-arm64 (plain binaries), SHA256SUMS and SHA256SUMS.sig, signed with the same release key. A CI job or a machine checks it before running pl:

V=0.1.0-0fb2d60; R=https://releases.pushleft.dev
KEY=ycJxDG57xxcAbQEHazM+5VANSLxjrj1ZerDOjnGixgs=   # PUSHLEFT_RELEASE_PUBKEY, pinned in CI
curl -fsSO $R/cli/$V/SHA256SUMS -fsSO $R/cli/$V/SHA256SUMS.sig -fsSO $R/cli/$V/pl-linux-amd64
{ printf '302a300506032b6570032100' | xxd -r -p; echo "$KEY" | base64 -d; } > release.der
base64 -d < SHA256SUMS.sig > SHA256SUMS.bin
openssl pkeyutl -verify -pubin -keyform DER -inkey release.der -rawin -in SHA256SUMS -sigfile SHA256SUMS.bin
sha256sum -c --ignore-missing --strict SHA256SUMS && chmod +x pl-linux-amd64

Pin the key in CI. Do not fetch release.pub beside the release: whoever can replace the files can replace that copy too. The prefix turns the raw 32-byte key into the DER form OpenSSL reads.

Updates. https://releases.pushleft.dev/cli/latest holds the newest version. A release build of pl knows its own version (pl --version). Once a day, in an interactive terminal, pl reads latest and asks to update when a newer release is out. It never asks in CI (CI set), in a pipe, or with PL_NO_UPDATE_CHECK=1. pl update installs the newest release, and pl update --version <v> a given one. Both check the signature with the key built into pl and the binary’s checksum, and that the new binary reports the version asked for, before they replace the binary. Builds from before 0.1.0-56ba8ec do not report their version, so pl update cannot install them. CI keeps its pinned version.

To publish a release: build with PL_RELEASE_VERSION=<version> in the environment, publish the directory, then write the version into /srv/releases/cli/latest.

Inventory, health and capacity

The control plane tracks each node’s host facts, heartbeat and used capacity.

  • Every lease request carries capabilities.host: cpu_count, memory_mb, data_disk_free_gb (on /var/lib/pushleft/data), kernel and docker_version, plus agent_version. The gateway stores these, bounded, in fleet_nodes.host_* with host_facts_at. The agent probes the Docker version once per process.
  • Host facts also carry disk_health: SMART per drive and md RAID state, sampled every 10 minutes, with the agent’s findings. It is stored in fleet_nodes.host_disk_health, served on GET /v1/nodes as host.disk_health, and alerted on by node_disk_failing and node_disk_warning (disk health). Wear past 100% shows on the node page and raises no alert.
  • Leases and heartbeats refresh last_seen_at. Schedulers keep their 60 s freshness rule.
  • pushleft-controller fleet sweep marks active nodes whose last_seen_at is older than PUSHLEFT_NODE_UNHEALTHY_AFTER (seconds, default 90) as unhealthy. The controller daemon runs it every 2 s. Allocations are not released, because moving work is drain’s job. Leases are refused while the node is unhealthy. The node’s next authenticated lease returns it to active.
  • pushleft-controller fleet list prints pool, region, status, schedulable, CPU, memory and disk used/total from active fleet_allocations (meters), heartbeat age and agent version. Then it prints one line per lost node: fenced jobs, lost instances, replacements ready and queued, and stranded database instances.
  • After PUSHLEFT_NODE_LOST_AFTER_SECONDS without a lease or heartbeat the scheduler marks the node lost and reclaims its work (Lost nodes).

Fleet app

The Fleet app (apps/fleet-admin) is the operators’ desktop app for the fleet. It is a Tauri app for macOS, and also builds for iPad (a 760 px minimum width; a narrow split view scrolls sideways). It talks only to the fleet admin API (pushleft-admin, README). The Connect screen defaults to production’s admin API, https://admin.internal.pushleft.dev:8447 (decided 2026-11-05). Sign-in is a passkey, and the session token is kept in the keychain, one entry per admin API.

PageWhat it shows
OverviewCapacity against reserved, nodes by pool, the control-plane hosts, the busiest hosts and the latest events; open problems and the last 24 hours’ failed deployments on top. It refreshes every 30 s.
NodesEvery node and control-plane host: status with its reason, heartbeat age, the latest reading and last-hour sparklines. A heartbeat older than 1 minute is late; after 5 minutes the node is silent.
Node pageA status panel (liveness, pressure as used against reserved, sparklines), insights, drive and RAID health, and placements grouped by organization and environment, collapsed. A Terminal button opens a shell on the server.
DeploymentsThe latest deployments of all organizations. Superseded, torn-down, fixed and dismissed ones are hidden until Show inactive. Each row opens the deployment’s history with its failure output and the full build log of each attempt.
Pipeline, Backups, EventsBuilds (failed first), the last backup, drill and off-host copy of each database and volume, and the latest 500 fleet events
CustomersPushleft’s users and organizations, with plan, trial end, cloud access, members and projects (below)
MapThe fleet in 3D (below)
ArenaThe fleet as a Quake 3 level (below)

Dismissing failures. Dismiss acknowledges a failed deployment for every operator. Dismiss all acknowledges only the open failures: a failure that a newer live deployment of the same environment replaced is not open. Each acknowledgement is an audit row (fleet_events, operator_action, action acknowledge_failure). A bulk dismissal records one batch id, and the app groups the rows by it.

Customers. The page reads the admin API’s /v1/customers: users, organizations, members and projects, with search, filters and the views On trial, Cloud requests and Suspended. An operator can suspend or unsuspend an organization, set its plan, approve its cloud access, and disable a user. Each change asks for a reason and is an audit row (fleet_events, operator_action, action customer_<name>). The users list reloads every 5 s.

Map. Pan by drag or swipe, pinch to zoom, and turn or fit with the buttons. Zones are laid out as the request path (internet, application, database), with the control plane and build behind.

  • Nodes layer: colour by CPU, memory, disk or network. A rack turns orange or red when any metric is over its limit, whatever metric is shown. Limits (warning / critical): CPU 80 / 90%, memory 92 / 95%, disk 80 / 90%, network 500 / 800 Mbit/s against a 1 Gbit/s link (the busier direction).
  • Workloads layer: each node is a stack of its environments (organization / project / environment), height from booked memory, colour from the organization. It reloads every 30 s. A node whose workloads fail to load is skipped and counted.
  • Work in flight, polled every 10 s. A running build is a box that assembles over its build server. A rolling deploy is a dashed arrow from the build zone to each target server.

Terminal. The app runs the Mac’s own /usr/bin/ssh, with the operator’s keys, agent and known hosts, in a pseudo-terminal drawn by ghostty-web. It connects as root to the server’s management-tailnet address through the jump host: ssh -t -J pl-cp root@<address>, or ssh -t pl-cp for the control plane. The operator’s ~/.ssh/config must name pl-cp (Robot hosts runbook). Only an address in 100.64.0.0/10 reaches ssh. macOS and Linux only: the iPad has no ssh.

Arena. The Arena page (or typing quake outside a field) builds a level from a fleet snapshot. Each server is one data core, coloured by health and faster when busier. The level is remapped every 30 s. The admin API compiles it (POST /v1/arena/level) and serves the two game files (GET /v1/arena/files/{name}). The app checks the files against their hash and caches them. The engine is ioquake3 as WebAssembly, with OpenArena’s GPL game code and art.

Desktop alerts. While the app runs, it checks every minute and notifies once when an alert opens. The Dock badge counts open alerts. Nodes: disk 90%, memory 92%, load 2 per core, drive or RAID findings, no heartbeat for 5 minutes. Control-plane hosts: disk 90%, memory 92%, no samples for 5 minutes (control-plane host alerts).

Drain and replace nodes

To retire a node, drain it, then decommission it. Node drain and replacement has the full procedure.

  • fleet drain <node>: sets status='draining' and schedulable=false. The gateway already refuses leases to non-active nodes (403). Heartbeats and completions of already-leased jobs continue. The command reports active allocations and live leases.

  • fleet drain <node> --move [--wait SECONDS]: cordons the node, then moves its volumes, PostgreSQL databases and long-lived instances off it, one environment at a time. It stops at the first failure. It drains only when no allocation or volume source copy is left; until then the node stays active and cordoned, and a re-run finishes it. It refuses a node with a live ClickHouse or Valkey instance.

  • fleet decommission <node> [--wait SECONDS]: waits for zero active allocations and zero live agent leases. It refuses unless the node is draining, provisioning, offline, revoked or already retired.

    1. It takes fleet_nodes … FOR UPDATE in one transaction. The lock conflicts with the FK lock a new allocation takes. In that transaction it checks allocations again, revokes every certificate (all purposes) and sets retired/retired_at.
    2. Only after the commit does it delete the Hetzner server (by recorded ID or label lookup) or the Proxmox VM (Proxmox VE). It leaves a BYO host alone.

    To retry a failed delete, run the command again. Rows, certificates, jobs and results are kept. The CLI never deletes a server whose node still has an active allocation.

  • fleet replace <node>: provisions a like-for-like Hetzner or Proxmox node (same pool, region, type and image), waits for enrollment, then drains the old node.

    • Moving allocations off a draining node is not automated. Run fleet migrate-volumes <node> before the drain to move its application volumes (migration).
    • Only a node that goes silent is reclaimed automatically (Lost nodes).
    • Database relocation is a separate workflow: run fleet relocate-database before the drain (managed databases).
    • Decommission the old node once fleet list shows it empty.

Placement preference

Placement picks the host itself, so a new application host stays empty while the old ones fill. To move an environment to a chosen host (decided 2026-11-05, migration 0140):

pushleft-controller fleet place-environment <project slug | org handle> <environment slug> --node <node id or name>
pushleft-controller fleet place-environment <project slug | org handle> <environment slug> --clear
  • The node must be an active, schedulable application node that the environment’s organization can use. The first argument must match exactly one environment: give the organization handle when a project slug is used by more than one organization.
  • Setting it moves nothing. It applies to the next placement of each role and the next volume migration:
    • Roles that are not bound to a volume or a box-bound address go to the preferred node first. The preferred node comes ahead of the network’s members and of a web role’s current routing node. If it does not fit (capacity, region, capabilities, heartbeat, or a sealed network whose hosts cannot take a topology revision), the normal order applies.
    • Volume migrations (pl volume migrate, fleet migrate-volumes) target the preferred node first when it qualifies (migration). Otherwise the scheduler picks as usual.
    • Volume-bound roles stay on their volume’s host until the volume migrates. Database instances are not affected.
  • The preference stays until --clear. While it is set, every redeploy tries that node first.

Moving an environment with volumes to a new host:

  1. fleet place-environment <project> <environment> --node <node>.
  2. Redeploy the environment (pl up on its branch). Its stateless roles move to the node. In a sealed network this adds the node through a topology revision. Wait until every member runs the new generation and the release is ready.
  3. pl volume migrate <environment> <volume> for each volume (pl volume list shows them). The node is now a member, so it qualifies as the target. The roles that mount the volume stop during the copy and start on the node.
  4. Check fleet list and pl volume list. Clear the preference when the node should no longer attract new work.

A volume that a web role mounts does not migrate. Its role stays on the old host.

Bring-your-own hosts (Hetzner Robot)

pushleft-controller fleet enroll-host --pool build|application|database|mesh --region fsn1 \
  [--public-ipv4 IP] [--private-ipv4 IP] [--model EX63] --out bootstrap.sh

Use enroll-host for hosts that the operator installs, such as Robot dedicated servers (Robot hosts runbook).

  1. The command creates the row with provider='byo' (migration 0040) at awaiting_enrollment, with a live 15-minute secret.
  2. It writes the bootstrap to --out (0600, never overwritten). cloud-init runs the same script. Run it over SSH.
  3. It waits for enrollment like provision.

Pushleft calls no provider API. There is no server ID or Cloud firewall, and the Robot firewall is the operator’s.

  • fleet admit sets capacity from the agent’s reported host facts, less the same host reserve, with the same CPU overcommit.

Memory overcommit

Each host has its own memory factor (memory_overcommit). The scheduler may promise that many times the host’s memory, less the 1 GiB reserve. At 3x, a 64 GiB host schedules 191 GiB. A role’s or database’s memory figure is its limit, and most use a fraction of it. A new platform host that serves only the application pool or only the database pool starts at 3x (MEMORY_OVERCOMMIT). Other hosts start at 1x.

Change a host’s factor with:

pushleft-controller fleet overcommit <node-id> --memory 3

The command sets the factor and recomputes the host’s memory capacity from the memory its agent reported. It refuses a factor that gives less than the memory already reserved on the host. fleet list shows the factor after the memory column.

Placement checks memory twice:

  1. The reservations fit the host’s capacity.
  2. The host has the memory free: its memory, less the 1 GiB reserve and the memory in use at its last report (host_load_memory_mb, at most 30 seconds old). Work reserved or started after that report counts at its full reservation, so several placements do not use one reading.

A role bound to one host by its volume, address or hostname is checked on reservations only. A build or workspace host, a host that mixes pools and a customer-managed node start exact. When many roles on one host grow to their limits together, the host can run out of memory: node_memory_high pages at 90% real use (Node busy).

CPU overcommit

On application and database hosts the scheduler may promise 6x the host’s CPU threads (CPU_OVERCOMMIT), less the 0.5 vCPU reserve. Every vCPU counts 1x against that capacity (fleet_allocation_charges.charged_cpu_millis). Migration 0151 counted a production vCPU 2.5x, so production alone was at most 2x overcommitted. On 2026-11-06 that left two of three application hosts without room and production deploys were reaped, so 0159 set it back to 1x until more hosts are added. The factor was 3x on 2026-11-03, then 4x and 5x on 2026-11-04. A 16-thread host schedules 95 500m. Reservations are what each container may use at most, and most of them sit idle. For example, every environment’s network gateway alone reserves 1 CPU on each host it uses (2 CPUs for gateways created before 2026-11-04 until they are resized, tenant gateway CPU). Memory has its own factor (memory overcommit), disk is never overcommitted, and build hosts stay exact, because a build uses its CPUs. When tenants are busy at the same time they share the host’s real CPUs, so a busy tenant can slow others on that host. A host admitted before this keeps its capacity until fleet admit --refresh-capacity (bring-your-own hosts).

  • --pool application,database puts both pools on one host and requires --owner-org. Shared hosts serve one pool. Build hosts always serve only their own pool (migration 0041).
  • decommission retires and revokes without deleting anything. replace refuses BYO nodes.
  • Every bootstrap turns on NTP (timedatectl set-ntp true) and stops unless the clock reports NTPSynchronized=yes, because certificates and registry tokens are time-bound. pushleft-agent doctor checks it again.

No mesh hosts. Since 2026-11-03 there is no mesh pool. Each environment’s Headscale coordinator runs on one of its own application or database hosts, and every host gets userns-remap (mesh coordinators).

Tests: scripts/fleet-e2e.sh and, for every pool, every staging install (staging runbook).

Customer-owned nodes

An organization can run its own servers as nodes (plan byo-2026-11; decided 2026-11-06, migration 0152). Only that organization’s work is placed on them. Owners and admins manage them in the console (Nodes), with pl nodes, or through the API. The customer’s guide is Your own servers.

CallWhoWhat
GET /v1/orgs/{id}/nodesany memberNodes owned by the organization that are not retired: status, pools, region, capacity, reserved CPU, memory and disk, seconds since the last heartbeat, agent version. Also install_step, install_detail and install_seconds (the last step the install reported, its error and last output lines on failed, and how long ago), ingress_tunnel, and admission (why an active node takes no work yet).
POST /v1/orgs/{id}/nodes {pools, region, telemetry?, data_device?, data_size_gib?, tunnel?}owner, adminA node at awaiting_enrollment, its one-line install command and its full bootstrap script, shown once. telemetry defaults to true. data_device is an absolute /dev/ path; data_size_gib (20 to 16384, default 50) sizes the data file when there is no device. tunnel (default false) needs the application pool (nodes behind NAT).
POST /v1/orgs/{id}/nodes/{node}/enrollmentowner, adminA new secret, command and script for a node that has not enrolled yet (the last command expired, or the install failed). The old command stops working. Audit kind node_install_renewed.
GET /v1/node-install/{org}no sign-inThe node’s bootstrap as text/x-shellscript, while its enrollment is live. The secret in the x-pushleft-install header is the credential. It is never in the path, so it stays out of traces and access logs. Any other request gets a script that prints why and exits 1.
POST /v1/node-install/{org}/progress?step= (same header)no sign-inThe install’s step, with the error and the last output lines as the body on failed (at most 2000 characters). Accepted until one hour after the secret expires or is used. 404 otherwise.
POST /v1/orgs/{id}/nodes/{node}/drainowner, adminNo new work goes to the node. Work that runs on it keeps running.
DELETE /v1/orgs/{id}/nodes/{node}owner, adminRetires a drained or never-enrolled node with no active allocation and revokes its certificates. Nothing on the host is deleted.
GET /v1/orgs/{id}/placementany member{production, preview, plan_own_nodes_only}: where new work of each environment kind runs. own_first (the default) until an admin sets it. plan_own_nodes_only is true when the plan keeps all work on the organization’s nodes, whatever the setting says.
PUT /v1/orgs/{id}/placement {production, preview}owner, adminEach own_first, own_only or pushleft (work placement). On a plan with own nodes only, anything but own_only is refused (409). It also applies to roles bound to a node by a volume, an address or a shared hostname: such a role waits when the setting rules its node out. Audited as placement_changed.
pl nodes enroll --pool application --region fsn1 [--tunnel] [--out node.sh] \
  [--no-telemetry] [--data-device /dev/sdb | --data-size 100]
# prints: s=$(curl -fsSL -H 'x-pushleft-install: <secret>' https://console.pushleft.dev/v1/node-install/<org>) && printf '%s\n' "$s" | sudo bash
pl nodes list
pl nodes command <id> [--out node.sh]
pl nodes drain <id>
pl nodes remove <id>
pl nodes placement [--production own_first|own_only|pushleft] [--preview ...]
  • Enrollment is enroll-host (pushleft_controller::fleet::enroll_host): provider byo, owner_org_id the organization, customer_managed = true, a 15-minute one-time secret. Pools: application, database, application,database or build. The API needs the PUSHLEFT_FLEET_* bootstrap settings (deploy/systemd/api.env.example), else it answers 503. Each create and remove is in the audit log (node_enrolled, node_drained, node_removed).

  • Bootstrap. Besides what every node gets, the script of a customer-managed node writes these lines to /etc/pushleft/agent.env:

    LineWhenWhy
    PUSHLEFT_INGRESS_TLS=1, PUSHLEFT_INGRESS_PLATFORM_CERTS=1alwaysPer-hostname certificates, never the wildcard.
    PUSHLEFT_CUSTOMER_MANAGED=1alwayspushleft-agent doctor skips the management-tailnet check and needs otelcol-contrib only with telemetry.
    PUSHLEFT_UNWRAP_VIA_GATEWAY=1alwaysNo PUSHLEFT_VAULT_ADDR: the agent unwraps its lease secrets through the gateway, because Vault stays private.
    PUSHLEFT_MESH_CA_FILE=/etc/pushleft/pki/mesh-ca.crtalwaysThe workload-coordinator CA, written from the API’s PUSHLEFT_FLEET_MESH_CA_FILE.
    PUSHLEFT_OTEL_GATEWAY=<PUSHLEFT_FLEET_TELEMETRY_URL>, PUSHLEFT_TELEMETRY_CERT_VIA_GATEWAY=1telemetry onThe agent gets and renews its telemetry client certificate from the gateway into /etc/pushleft-otel/.
    PUSHLEFT_PUBLIC_INTERFACE=<uplink>application, databaseFound on the host with ip route get. The script stops if it finds none.
    PUSHLEFT_POSTGRES_REPOSITORIES=postgres,<pgvector repository>databaseFrom deploy/images.lock.env, as on our database hosts.
    PUSHLEFT_DATABASE_SPOOL_MODE=disableddatabaseNo off-host shipper runs on a customer host (our R2 key stays ours). A spool would keep every file that the 1-day local store prunes, until the disk is full. Backups stay on the customer’s host, and share its fate.
    • Data disk. The script prepares /var/lib/pushleft/data as XFS with project quotas (prjquota, from /etc/fstab). With data_device, it formats the device only when it holds no filesystem and no partition table. It reuses an existing XFS. It refuses a device that holds anything else, has partitions or is mounted elsewhere: it never formats a device with data. Without a device, it creates the sparse file /var/lib/pushleft/data.img (data_size_gib, default 50) and mounts it as a loop device. It refuses when the disk has less free space than the size plus 10 GiB. A run on a host where the data volume is already mounted with prjquota changes nothing. When it is mounted without prjquota and listed in /etc/fstab, the script adds the option and mounts it again. Both fstab lines use nofail, so a missing disk does not stop the boot (the agent then does not start).
    • On database nodes, /var/backups/pushleft is a bind mount of /var/lib/pushleft/data/backups, as on our hosts (backup directory).
    • Telemetry. On by default. The script installs otelcol-contrib at the version and SHA-256 that deploy/images.lock.env pins (x86_64 only), the pushleft-otel user, pushleft-otelcol.service and the drop-in and process.yaml from scripts/staging/telemetry.sh. The agent renders the configuration and starts the collector. With telemetry off, nothing of this is installed and no metrics or logs leave the host. The audit row node_enrolled records the choice.
    • Ingress. On an application node the script installs Caddy at the version and SHA-256 that deploy/images.lock.env pins (x86_64 only), renders its base configuration with pushleft-agent ingress-caddy-config, starts pushleft-ingress-caddy.service and sets PUSHLEFT_CADDY_ADMIN. Hostnames get their own platform certificates; custom domains use ACME. The preview wildcard never goes to a customer node.
    • Build nodes. Kata Containers stays manual (build hosts). The script says so. No build is placed on the node before PUSHLEFT_BUILD_RUNTIME=kata is set.
    • The API also needs PUSHLEFT_FLEET_MESH_CA_FILE, and PUSHLEFT_FLEET_TELEMETRY_URL when telemetry is on. Without them it answers 503. Operator enrollments (enroll-host, the admin API) do not use them and are unchanged.
  • Certificates. The bootstrap sets PUSHLEFT_INGRESS_TLS=1 and PUSHLEFT_INGRESS_PLATFORM_CERTS=1. The node gets a certificate for each hostname it routes (platform certificates). The agent gateway refuses the preview wildcard (GET /v1/agent/ingress/wildcard) to every customer-managed node, because the customer has root on the host.

  • Admission. The controller admits a customer-managed node without an operator step, once it is active, heartbeats and has reported host facts within the last 60 s. Capacity is calculated as for fleet admit: the reported facts, less the host reserve. A node that reports more than 256 threads, 2 TiB of memory or 100 TB of free disk is not admitted (OWNED_NODE_MAX_*). A build node too small for one build is not admitted either. A drained node is not admitted again.

  • Limit. org_tiers.max_owned_nodes: new 2, standard 10, trusted 50 (NULL: no limit). Retired nodes and enrollments that expired unused do not count.

  • Backups. A customer-managed node gets no nightly base backup and keeps no WAL archive: its agent deletes each segment PostgreSQL archives instead of sealing it. pl db backup still takes a base backup, which restores on its own. Point-in-time recovery is not available on these nodes.

  • Alerts. Our rules (deploy/observability/alerts/control-plane.sql) and the Fleet app’s notifications skip customer-managed nodes. When the scheduler marks one lost, the API mails the organization’s owners and admins once for each loss (claim_node_lost_mail()).

  • Operator view. /v1/nodes shows owner_org, owner_org_name and customer_managed. /v1/fleet/summary leaves customer-managed nodes out of capacity, reserved and open events, and counts them in nodes.customer_managed. The Fleet app filters nodes by owner: shared, dedicated to an organization, or customer-run.

  • Hosts we run for one organization (enroll-host --owner-org) are not customer-managed. We keep the pager and the wildcard for them, and the organization sees them in its list but cannot drain or remove them.

One-line install

pl nodes enroll and Get install command in the console print one command (decided 2026-11-07, migration 0177):

s=$(curl -fsSL -H 'x-pushleft-install: <secret>' https://console.pushleft.dev/v1/node-install/<org>) && printf '%s\n' "$s" | sudo bash
  • The command. It holds the 15-minute one-time enrollment secret. The API keeps the bootstrap in fleet_nodes.install_script with a placeholder for the secret, and stores only the secret’s SHA-256. GET /v1/node-install/{org} takes the secret from the x-pushleft-install header, puts it back and serves the script. With --out, the CLI also writes the full script (0600), to run as ssh root@<host> 'bash -s' < node.sh. Without console_url in the platform settings, the API returns no command and the script reports no progress.
  • The wrapper. The served script is one function, pl_main, called with stdin closed. Bash reads all of it before any command runs, so no command in it can read the rest of curl | bash. It sets PUSHLEFT_INSTALL_REPORT to the progress URL.
  • Steps. The bootstrap reports started, packages, clock, docker, host, agent, enroll and done with pl_step. The GET records fetched only before any other step, so a second download keeps a running or failed install visible. On an error, an ERR trap reports failed with the step, the line, the exit code, the command and the last 15 lines of /var/log/pushleft-install.log. A report that fails does not stop the install. The bootstrap without PUSHLEFT_INSTALL_REPORT (operator enrollments, --out) sends nothing.
  • Console. While a node installs, the Nodes page polls every 3 s and shows a step track: Download, Packages, Clock, Docker, Data disk, Agent, Enrol, Start. A failed install shows its step in red and the reported detail. No report for 5 minutes shows “no progress for N min”. New command (pl nodes command <id>) appears for an expired command, a failed install or a stalled one. pl nodes list prints the same status (installing: <step>, install failed with the detail, expired, waiting for command).
  • Admission. After enrollment, admission says why the node takes no work yet: “connecting”, “needs over 1 GiB memory”, “too small for builds” or “checking”.

Public endpoints

Decided 2026-11-07. A customer node never joins the management tailnet. It reaches the control plane as gateway.<base>: the agent gateway on 8443 (mTLS, agent certificates), enrollment on 8444 (one-use secrets, rate-limited per address) and the telemetry gateway on 8445 (mTLS, telemetry certificates). The gateway and telemetry server certificates carry that name beside cp.internal.<base>.

  • Secrets. Vault stays private. The node unwraps its lease’s single-use tokens through POST /v1/agent/secrets/unwrap (node secrets).
  • Telemetry. The node gets a 30-day telemetry certificate from POST /v1/agent/telemetry/certificate and asks again daily. The gateway issues a new one when the node has none from the current fleet CA with 10 days left, at most one an hour. A CA rotation (fleet ca rotate) also writes the telemetry gateway’s client trust when PUSHLEFT_TELEMETRY_CLIENT_CA is set, and --complete waits for these certificates too. Restart pushleft-telemetry-gateway after each phase.
  • Mesh. A segment placed only on customer nodes gets its coordinator on a shared platform host (mesh coordinators).

Nodes behind NAT

A node with no public address is reached through a Cloudflare tunnel in the platform’s own account (decided 2026-11-07). Cloudflare ends TLS for these hostnames and sees the traffic, so the customer opts in per node: tunnel: true on the create call, pl nodes enroll --tunnel, or No public address in the console. Only a node with the application pool takes it (400 otherwise). The audit row node_enrolled records tunnel. An operator can still set it on an existing node:

psql -c "UPDATE fleet_nodes SET ingress_tunnel=true WHERE id='<node id>'"
  • The controller creates one tunnel for the node, stores its token in Vault and queues run_tunnel. The agent runs the connector as for a linked domain.
  • The tunnel routes the node’s active platform hostnames to its ingress. The connector checks the ingress certificate against its system roots, because platform certificates are public. Once a minute the controller puts back any routing changed in the dashboard and queues the connector again if it is down.
  • Only a node with an owner organization can take the flag (fleet_nodes_ingress_tunnel_owner): the tunnel, its token and its connector job are that organization’s.
  • Platform DNS gives each of these hostnames a proxied CNAME to <tunnel id>.cfargotunnel.com instead of an A record. The record moves to the tunnel only after Cloudflare sees its connector up and its routing lists the hostname (cloudflare_tunnels.connected, checked each minute). Until then the hostname keeps the record it has (an A record when the flag is first set) or points at its older route. A connector that goes down later does not delete a CNAME already in place. hostname_dns.content records what each record points at, so a node that moves to a tunnel, or gets a new one, has its records rewritten.
  • Cloudflare’s free certificate covers one level (*.<zone>). Hostnames under apps.<zone> need an edge certificate for *.apps.<zone> (Advanced Certificate Manager).
  • The zone has Always Use HTTPS on (since 2026-11-08). Without it, Cloudflare served a tunnel hostname over plain HTTP, and an app that relies on Cloudflare Access for another hostname was open on its default one. The only proxied records in the zone are tunnel hostnames, so the setting changes nothing else. Keep it on.
  • Not built: removing the flag keeps the tunnel, and there is no call to change it after enrollment.

Open

  • Off-host backups. A customer node’s database backups stay on its own data disk (PUSHLEFT_DATABASE_SPOOL_MODE=disabled), because the platform’s R2 key never goes to a customer host.
  • Kata Containers on customer build nodes is still manual on the host.
  • A hostile node can report false facts within the caps, so it can be given more work of its own organization than it can run. It can also try the gateway with its valid mTLS certificate. The gateway authorizes each request by node, so it gets only work and secrets that were placed on that node.

Manual steps

These steps stay with the operator:

  • Hetzner project, API token, SSH keys and the operator CA/gateway certificates.
  • Attaching and mounting the XFS data volume at /var/lib/pushleft/data. The agent service does not start before it is mounted. The bootstrap of a customer-managed node does this itself (customer-owned nodes).
  • Joining the management tailnet, the only private network (no vSwitch).
    • On hosts enrolled with enroll-host, the operator joins before running the bootstrap, so enrollment runs over the tailnet (private network).
    • A Proxmox node from fleet provision --provider proxmox joins on its own. Its bootstrap carries a one-use node key minted through the management Headscale’s API (Proxmox VE).
    • A Hetzner Cloud node from fleet provision cannot enroll yet, because its cloud-init carries no such key (gap). The same minting would serve it, but the key must outlive the server’s boot.
    • Three steps stay manual on a Proxmox node, as on a Robot host. Limit SSH to the operator devices (deploy/ssh/install-operator-ssh.sh; the provisioner’s key stays in the cloud-init user’s authorized_keys). Set the role settings in agent.env (Kata on build hosts, PUSHLEFT_VAULT_ADDR and the CA files on application and database hosts). Run fleet admit.
  • Removing old Vault tokens. No node gets a Vault token (C3). The gateway hands each lease single-use, response-wrapped secrets for exactly the work fenced to that node, and backup keys only for organizations placed on it. The agent unwraps them with PUSHLEFT_VAULT_ADDR alone (node secrets).
    • pushleft-agent run ignores PUSHLEFT_VAULT_TOKEN_FILE. pushleft-agent doctor warns when it is set or /etc/pushleft/credentials/vault-token exists. On older nodes, delete the token and revoke it.
    • Build hosts also leave PUSHLEFT_VAULT_ADDR unset. Any database or mesh job that needs a secret then fails closed.
    • Build hosts also need Kata Containers and PUSHLEFT_BUILD_RUNTIME=kata (build hosts). Hetzner Cloud build nodes have no KVM, and are not targeted while PUSHLEFT_REQUIRE_VM_ISOLATED_BUILD is on.
  • fleet admit, after the operator has checked the bootstrap (pushleft-agent doctor).
  • Releasing or relocating allocations of a drained (still heartbeating) node before decommission. Silent nodes are reclaimed automatically, but their databases are not.
  • Pointing the wildcard ingress DNS record at the replacement ingress host after a node is lost.
  • Building, signing and publishing agent releases, then writing the version into latest.
  • Starting each CA rotation phase (fleet ca rotate --begin, then --complete) on the gateway host.

Threat model

  • Stolen enrollment secret. It works once, for 15 minutes, for one node ID in provisioning. The plaintext exists only in the provisioning process memory, the Hetzner user-data and the 0600 file that the agent deletes. Any process on the new VM can read the Hetzner metadata service until the secret is used. The database stores only the hash. Brute force is impractical (256 bits).
  • Expired agent certificate (a node powered off past its lifetime). At start, the agent reads its certificate’s expiry. If it has expired, the agent renews with it straight away (the identity request would be refused) and connects with the new one. Once the gateway’s renewal grace has passed, the agent exits with a message to enroll the node again. The renewal loop also makes its first attempt at start.
  • Stolen agent key. The certificate has a 24 h lifetime by default, and revoked_at revokes it. The next rotation retires it automatically. fleet decommission or a manual revoked_at takes effect on the next request. A node can renew only for its own ID.
  • CA key compromise. An attacker can mint certificates. Every certificate must also exist as an unrevoked fleet_node_certificates row, so the CA key alone does not authenticate. Keep the CA key on the gateway host only, 0600. An HSM/KMS signer is the upgrade. See gateway CA compromise.
  • Malicious release mirror or MITM. Without the offline release key it cannot pass signature, checksum and single-file extraction. A replayed old release cannot be renamed to a newer version.
  • Enrollment listener abuse. The listener is unauthenticated by design but has one route. A bad CSR is refused before any database write, and refusals do not reveal whether a node exists. It is not rate-limited yet (gap). Keep it reachable only from the provider network, or put it behind a proxy limit.
  • Hetzner token. It has full project access. It is never stored in the database or logged. Run fleet commands from an operator host, never from the developer API.

First live run

Run these checks in a throwaway Hetzner project before the first real Hetzner Cloud provisioning:

  1. fleet provision creates exactly one server with the three labels, the pushleft-<pool> firewall attached at boot, and the expected type, location and image. A second --resume creates nothing.
  2. Hetzner accepts the user-data. Check /var/log/cloud-init-output.log: the apt install, release download, openssl pkeyutl -verify -rawin on Ubuntu 24.04’s OpenSSL, sha256sum -c and tar --zstd all succeed, and enrollment completes within the 15-minute TTL.
  3. The firewall rules as shown in the console. SSH from outside the operator CIDR fails. 80/443 are open only on application nodes. Nothing else answers.
  4. Recorded public IPv4/IPv6 and server ID match the console. The capacity reserve is plausible against real Docker/agent usage.
  5. After mounting the data volume and joining the mesh, the agent heartbeats and host facts are populated. Rotation with a short PUSHLEFT_AGENT_CERT_LIFETIME_SECONDS restarts the service, and the old fingerprint then gets 401.
  6. Signed self-update on the node, including the systemd unit sandbox (ReadWritePaths=/usr/local/bin).
  7. Rate-limit headers on a real 429, if one can be provoked safely, and the error codes for quota (resource_limit_exceeded) and a sold-out type (resource_unavailable).
  8. fleet decommission deletes the server and leaves the node retired with all certificates revoked.

Verification

npm run test:fleet runs the real gateway with a disposable database and an ephemeral EC CA, a stub Hetzner API and an HTTPS release server. It checks:

  • A group-readable CA key is refused.
  • The enrollment listener accepts TLS without a client certificate, and agent routes still reject such clients.
  • The provision CLI creates the server with only operator SSH on a build node, and stores only the secret hash.
  • A real agent enroll succeeds, and the secret cannot be used twice.
  • Leases record host facts, and renewal before the two-thirds point is refused.
  • After rotation, the old certificate works until the new one is used, then gets 401.
  • The sweep marks the node unhealthy, and the next lease recovers it.
  • admit uses the server-type capacity, and list shows used/total.
  • A draining node gets 403. Decommission refuses while an allocation is active, then retires and revokes the node and deletes the server.
  • Both the cloud-init command (using the controller-rendered PEM) and self-update accept the openssl-signed release. A foreign key or tampered archive is refused.

The enroll::tests::enrollment_rotation_and_revocation database test (run by scripts/mesh-controller-e2e.sh) covers the same rules at handler level, plus a revoked current certificate and a retired node.

npm run test:fleet-reclaim runs:

  • Database tests.

    • reclaim::tests: silence below and above the threshold, one node_lost event across replays, fenced leases, released capacity, lost rows kept and terminal, one replacement per lost instance at generation + 1, no target before admission on the new node, relocation only after the replacement is ready, degraded without capacity and back to live, and a database instance stranded with its allocation held.
    • Gateway: lost_node_completion_is_stale_and_its_lease_returns_cleanup, relocation_drains_the_lost_route_only_once_active_and_recovers_live, failed_relocation_degrades_a_live_deployment, ca_rotation_overlap_renews_onto_the_new_ca.
    • Controller ca::tests on a dedicated database: begin, abort, refused complete, refused abort, complete, re-signed server certificate and phase events.
  • Live lost node, with a real scheduler, mTLS gateway, two pushleft-agent run processes and Docker (network admission stubbed in SQL, no Caddy):

    1. Agent A runs the web instance and is SIGKILLed.
    2. After 30 s, the node is lost. Agent B runs the replacement at generation 2, and the deployment stays live.
    3. A restarted agent A gets 409 on a late heartbeat and 403 on lease. It removes its fenced container while B’s keeps serving.
  • Live CA rotation:

    1. --begin, and a gateway reload without restart.
    2. Agent B renews onto the new CA and swaps its client in place (same PID).
    3. --abort and --complete refusals, then --complete.
    4. The gateway serves a new-CA server certificate, and an old-CA client certificate fails the handshake.

    Agent B keeps leasing throughout.

Rendered from the repository at build time. Edit docs/fleet.md to change it.