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

Operations and alerts

Watch the Pushleft control plane, answer its alerts and recover it after a failure. This page also lists the service level targets, the audit trail, capacity limits and the lifetime of each credential.

Fleet app Fleet events: lost nodes, stranded databases and operator actions.
Fleet app Database backups across the fleet and their age.

Quick start

Run this check on a control-plane host every day, and when an alert fires:

  1. Look for firing alerts. Each FIRING line names the alert and its runbook:

    journalctl -u pushleft-ops-alerts --since "1 day ago" | grep FIRING
  2. Check that the API is ready. A 503 means its database is down or in recovery (Service not ready):

    curl -fsS http://127.0.0.1:8080/readyz
  3. When one service is not ready, read its state and its journal:

    systemctl status pushleft-scheduler
    journalctl -u pushleft-scheduler --since "1 hour ago"
  4. Check node status, capacity and heartbeat age:

    pushleft-controller fleet list
  5. Read the open abuse reports (Abuse mailbox):

    pushleft-api abuse list
  6. To find who changed what in an organization, read its audit trail (Audit trail):

    DATABASE_URL="$OPS_URL" pushleft-api audit --org <uuid> --since 2026-10-01T00:00:00Z

Scope

This page covers how to run, watch and recover the control plane.

  • Deploying the control plane has the deployment units, ports and database roles.
  • The runbooks are in runbooks/.
  • The fleet page covers the hosts that run workloads.

Everything below is measured, read from code, or labelled plan or gap. No part of this has run against a live fleet.

Signal sources

The control-plane services (pushleft-api, -scheduler, -agent-gateway, -controller, -mesh, -telemetry-gateway) export no metrics: no OpenTelemetry SDK and no /metrics. pushleft-core/src/observability.rs is the manifest’s observability policy (90-day retention, analytics privacy). It holds no instrumentation.

Node collectors send host metrics and application OTLP through the telemetry gateway to ClickHouse (pushleft_otel, 90-day TTL). This pipeline describes nodes and workloads only (logs).

  • The telemetry gateway sets host.id and cloud.region from the node’s certificate. It never takes tenant identity from the sender.
  • It refuses a resource that carries any pushleft.* attribute (403).
  • It strips pushleft.* attributes from scopes, log records, spans, span events and links, metrics, data points and exemplars. It strips them and does not refuse, because one node batch mixes tenants.

Every SLI below therefore comes from durable state that the services already write to the control-plane PostgreSQL: deployments, deployment_events, jobs, agent_job_results, fleet_nodes, fleet_allocations, ingress_analytics_routes.

  • The alert rules are SQL (deploy/observability/alerts/control-plane.sql).
  • scripts/ops-alerts.sh evaluates them every minute from pushleft-ops-alerts.timer, with HTTP probes of every /readyz.
  • Alert identity. One alert is its rule and what it is about, with changing numbers blanked. 5000s ago and 5001s ago are the same alert; another node is a new one. A -- repeat: rise rule sends again only above the highest value already sent.
  • Mute. Each alert mail has links to mute that alert for 8 hours, 1 day, 3 days or 1 week. The Fleet app’s Alerts page does the same and can unmute. A mute covers one identity, so a new problem under the same rule still alerts. The links need PUSHLEFT_OPS_MUTE_KEY in the API’s environment and in ops-alerts.env, and PUSHLEFT_OPS_MUTE_URL in ops-alerts.env.
  • A firing alert is a journal line (FIRING <severity> <alert> <runbook> :: <detail>) and a failed unit.

Paging. Set PUSHLEFT_OPS_NTFY_URL to push each new FIRING line to that ntfy topic.

  • page alerts go as urgent, ticket alerts as default. An optional token goes in PUSHLEFT_OPS_NTFY_TOKEN_FILE.
  • A line that is still firing is pushed again after PUSHLEFT_OPS_NTFY_REPEAT_MINUTES (60). A rule with -- repeat: rise is pushed again only when the number that starts its line goes up.
  • A line that clears is pushed as resolved.
  • Numbers in a line do not make it a new alert.
  • The state is in the unit’s StateDirectory.

Readiness probes. PUSHLEFT_OPS_PROBE_URLS entries are <service>=<url>. A failure names the service, what it answered (a status or the connection error) and the command to look at it. A failure must hold 2 minutes before it pages, so a planned restart does not page. Runbook links use PUSHLEFT_OPS_RUNBOOK_BASE (on pl-cp the site’s preview address until pushleft.dev serves the manual).

Hold. A rule with -- for: <minutes>m notifies (ntfy and mail) only after it has fired that long without a break; FIRING still prints at once. tenant_backup_stale holds 30 minutes, node_capacity_high 20.

Node use. With PUSHLEFT_OPS_CLICKHOUSE_URL (plus PUSHLEFT_OPS_CLICKHOUSE_USER and PUSHLEFT_OPS_CLICKHOUSE_PASSWORD, a read-only user), a node of ours at or over 90% CPU busy, or 90% memory used, in each of the last 5 whole minutes pages as node_cpu_busy or node_memory_high. The source is the collector’s host metrics. Build nodes and customer nodes are left out. Reserved capacity over 90% for 20 minutes is only a ticket, node_capacity_high (ntfy, no mail): nodes are overcommitted on purpose.

Mail. Set PUSHLEFT_OPS_MAIL_TO (comma-separated addresses) to get page alerts by email (PUSHLEFT_OPS_MAIL_SEVERITY=ticket adds tickets; ntfy gets both). One mail per alert lists all its items, then a repeat after PUSHLEFT_OPS_MAIL_REPEAT_MINUTES (default 1440) while it fires. There is no resolved mail; ntfy (which repeats after PUSHLEFT_OPS_NTFY_REPEAT_MINUTES) and the Fleet app show it.

  • The script calls pushleft-api ops-alert-mail. It sends through the platform mail settings of the API (PUSHLEFT_SMTP_URL, PUSHLEFT_MAIL_FROM; Amazon SES in production), so put the same two values in ops-alerts.env. The command needs no database, so it still mails when PostgreSQL is down.
  • The mail gives the alert, its severity, where it fired (the detail of the line), the host, when it started, and a link to the runbook. A resolved mail also gives when it cleared. Runbook links point to the published manual. PUSHLEFT_OPS_RUNBOOK_BASE changes the base (default https://pushleft.dev/manual).
  • Mail and ntfy keep separate state (firing-mail and firing). A failed mail is retried on the next run without a second push, and the other way round.
  • The ops mails and the image re-scan security mails share one layout (crates/pushleft-api/src/alert_mail.rs). The layout is HTML with a plain-text alternative, in the colours and type of the public site. To look at samples, run PUSHLEFT_MAIL_PREVIEW_DIR=/tmp/mail cargo test -p pushleft-api mail_preview and open the .html files.

Outside watcher. scripts/pl-cp-watch.sh runs every minute on a host in another data centre (deploy/systemd/pl-cp-watch.timer). It probes https://api.pushleft.dev/readyz and pushes to ntfy after 3 failed probes. It pushes again every hour during the outage, and once when the API answers. It does not notice when only ops-alerts stops. scripts/pl-cp-watch-test.sh is its self-check.

Heartbeat. PUSHLEFT_OPS_HEARTBEAT_URL is an outside dead-man’s switch, such as a healthchecks.io check with a 5-minute period. It is pinged after every run that could evaluate, and at <url>/fail after one that could not. When box 1 or its timer stops, the outside service pages.

Tests.

  • scripts/ops-alerts-paging-e2e.sh runs against a migrated database and local stand-ins for ntfy and SMTP. It proves the push and the mail, de-duplication, resolve, heartbeat and /fail. It also proves that a failed push or mail is retried on its own.
  • scripts/capacity-e2e.sh runs every rule (38 in the SQL file) against a populated database under the read-only pushleft_ops role.

No metrics pipeline was added for the control plane. The SQL rules need nothing new to run, and they can only reference tables that exist. Add OTLP instrumentation to the central collector when per-request API latency or queue-depth time series are needed (plan).

SLOs

An SLO is the target for one measure of service health. The targets are initial proposals. None has been checked against production data yet (production runs on Robot since 2026-11-04). “Window” is the evaluation window of the alert rule.

SLIExact measureTargetAlert (severity)
Deployment success rateDeployments created 30 min to 24 h ago: those with a deployment_url_ready event, divided by those plus status='failed' ones, leaving out those whose last build event is a build_failed with code build_test_failed (the tenant’s tests) or image_scan_blocked (its image scan). A plain BuildKit failure (code build_failed) can be ours as well as the tenant’s, so it still counts, as do a lost lease, node or registry push and a failure after a completed build.≥ 95 % over 24 h (at least 20 deployments)deployment_success_rate_low (ticket since 2026-11-05: a rate, not an outage)
Time from pl up to livedeployment_url_ready.occurred_at − deployment_accepted.occurred_at, p95≤ 10 min over 24 hup_to_live_slow (ticket); a single deployment silent for 30 min: deployment_stuck (ticket)
Build durationbuild_completed − source_verified, p95 (queueing for a build node included). The hard timeout is 30 min.≤ 15 min over 24 hbuild_duration_slow (ticket); infrastructure-wide failures: build_failures_infrastructure (page)
API availabilityGET /readyz answers 2xx within 3 s, probed every minute. The proxy’s non-5xx ratio is the better user-facing measure, but Pushleft ships no proxy config (gap).99.5 % of minutes per monthservice_not_ready (page)
API latencyp95 duration of non-streaming requests in the TLS proxy’s access log. The API itself logs no per-request durations at info.≤ 500 msnone shipped (gap)
Agent lease freshnessnow() − fleet_nodes.last_seen_at for schedulable nodes. The scheduler stops placing on a node at 60 s, and the controller marks it unhealthy at 90 s.≤ 60 snode_heartbeat_stale at 120 s (page); job_lease_orphaned (page; the daily scans scan_lease_orphaned, ticket at 60 min, decided 2026-11-07)
Ingress certificate validityFor every hostname with an active route for at least 15 min, a TLS handshake through PUSHLEFT_OPS_INGRESS_ADDRESS with SNI = hostname must verify the chain and name, and notAfter must be at least PUSHLEFT_OPS_CERT_MIN_DAYS (14) days away. Covers the operator wildcard (previews, renewed by the operator) and Caddy’s ACME certificates (custom domains, renewed by Caddy at about a third of their lifetime). Probed every minute by scripts/ops-alerts.sh; disabled when the address is unset.100 % of active hostnamesingress_certificate_invalid (page), ingress_certificate_expiring (ticket)
Ingress route publication latencyingress_analytics_routes.activated_at − created_at, p95≤ 120 s over 24 hingress_publication_slow (ticket); any route publishing > 5 min: ingress_publication_stuck (page)
Backup freshnessAge of the newest backup of each ready managed database on our own nodes, and the result of its last restore drill (backups). The control-plane WAL archive has its own alert (below).≤ 26 h for daily backupstenant_backup_stale (page)
Login abuseauth_events.kind='rate_limited': one row per tripped bucket (address, email or user) and window (rate limiting)≤ 20 tripped windows per 15 minauth_rate_limited_spike (ticket)
Control-plane database redundancyOn the primary: every pushleft_* physical slot active, under 64 MiB behind, replica replay_lag ≤ 30 s; the standby (PUSHLEFT_OPS_REPLICA_DATABASE_URL) reachable and in recoveryalwayscontrol_plane_replication_lag (page)
WAL archive freshnesspg_stat_archiver: no failure after the last success; no completed segment waiting over 5 min (archive_timeout = 60)alwayscontrol_plane_wal_archive_stale (page)
Vault/OpenBao snapshot freshnessAge of the last snapshot that was encrypted and copied off-host: the epoch in last-success, written by scripts/vault-snapshot.sh from pushleft-vault-snapshot.timer (hourly) only after the copy command succeeds. Probed every minute by scripts/ops-alerts.sh when PUSHLEFT_OPS_VAULT_SNAPSHOT_STATUS_FILE is set (runbook). A missing file also fires.≤ 2 h (PUSHLEFT_OPS_VAULT_SNAPSHOT_MAX_AGE_SECONDS, 2× the interval)vault_snapshot_stale (ticket)
Garage off-host copy freshnessAge of the last complete encrypted snapshot of every Garage bucket to R2: the epoch in /var/lib/pushleft-garage-mirror/last-success on the Garage host, written by scripts/garage-mirror.sh (pushleft-garage-mirror.timer, nightly) only after every bucket is copied and checked with rclone cryptcheck. The agent reports it with its host facts (fleet_nodes.host_garage_mirror_last_success_at, migration 0141; the last value is kept when the file goes away, so a deleted file also fires). (runbook)≤ 26 hgarage_mirror_stale (ticket)

Supporting alerts: node_cpu_busy, node_memory_high, node_capacity_high, node_data_disk_low, node_disk_high and node_disk_full (any of /, data or backups over 80% / 95%; host_disk_high and host_disk_full from PUSHLEFT_OPS_DISK_PATHS on a host without an agent), node_disk_failing and node_disk_warning (disk health; host_raid_degraded from PUSHLEFT_OPS_MDSTAT on a host without an agent), volume_near_quota, volume_operation_stuck, agent_certificate_not_rotating, telemetry_certificate_expiring, fleet_heartbeats_absent, mesh_node_expiring, certificate_file_expiring (credential lifetimes), ingress_route_failed, custom_domain_unrouted, registry_image_release_failing, failed_auth_burst. Each rule in the SQL file names its runbook.

Disk health

Each agent runs smartctl -j -H -i -A -l error on every drive smartctl --scan-open finds. --scan-open types SATA drives behind a SCSI layer as sat, which --scan does not. The agent also reads /proc/mdstat. It does this every 10 minutes on a thread of its own, and sends the result with its host facts (disk_health). The gateway stores it in fleet_nodes.host_disk_health (migration 0135; null from an older agent). It reads only the parts the findings use. The firmware of Dell’s Intel S4510 refuses the selective self-test log that -a also reads. On pl-app-3 (2026-11-05), -a gave a false SMART unreadable for that reason. The agent sorts what it sees into findings:

FindingSeverity
NVMe available spare at or below its thresholdpage (node_disk_failing)
NVMe available spare within 2× its thresholdticket (node_disk_warning)
Critical warning bits: spare below threshold (0x01), reliability degraded (0x04) on a drive below its rated endurance, read-only (0x08), volatile memory backup failed (0x10), persistent memory read-only (0x20)page; temperature (0x02) alone is a ticket
Media and data integrity errors, or SATA/SAS reallocated, pending or uncorrectable sectors, above 0ticket
The same counters rising against the baseline of one to two days agopage
The drive’s error log growing in that timeticket
SATA/SAS SMART overall-health FAILEDpage
md array degraded and not rebuilding / rebuildingpage / ticket
smartctl missing or a drive unreadable; a sample over an hour old (smartctl hung)ticket
Percentage Used over 100information only, never an alert

Wear is not a fault. An NVMe drive past its rated endurance sets critical warning bit 0x04, so smartctl reports the drive as FAILED. The flag is the drive’s estimate of its rated write life: pl-database-1’s first PM9A3s were at 107% with 100% spare and no media errors. On NVMe, the alerts ignore the overall verdict. They also ignore bit 0x04 when it was first seen at a Percentage Used of 100 or more. The agent keeps when the bit appeared in its baseline. A 0x04 that appeared below that means media or internal errors and keeps paging, also after the drive wears past 100%. An inactive md array counts as degraded. Plan a swap when wear passes 100%, and swap without delay when a page fires.

The baseline for “rising” lives in /var/lib/pushleft/disk-health-baseline.json on the node. It moves on once a day and keeps two generations. A counter that rose stays alerted for one to two days, also across agent restarts. Delete the file after a drive swap if the old drive’s counters linger. Counters are keyed by serial, so a new drive starts clean.

The Fleet app shows each node’s drives (wear, spare, media errors, error log, temperature, hours, data written) and arrays on the node page. Its node health word becomes Disk failing or Disk warning, and its desktop notifications include the findings.

What to do on a page: look at the node page or smartctl -a /dev/<drive> and cat /proc/mdstat on the host. With one drive of a RAID1 pair failing, ask Hetzner support to replace it (give the serial), then re-add the new drive to the arrays. If the whole array is at risk, drain the node first (node drain and replacement).

Gaps: the agent needs smartctl (apt install smartmontools; Ubuntu 24.04 ships 7.4, which has -j). pl-cp runs no agent: PUSHLEFT_OPS_MDSTAT=/proc/mdstat in its ops-alerts.env alerts on its RAID. Its drives’ SMART is sampled by pushleft-host-health.timer (pushleft-agent disk-health as root) and shown in the Fleet app since 2026-11-05 (control-plane host alerts). No rule alerts on it yet: ops-alerts runs unprivileged, and SMART needs root.

Service not ready

service_not_ready means a /readyz probe failed. A service is ready when all of these that apply to it are true:

  • The API’s database answers within 2 s and is not in recovery (pg_is_in_recovery()). A standby or a fenced old primary is not ready, so a service left pointing at one during a failover stays red.
  • A health listener’s database answers the same check within 2 s.
  • For the scheduler, controller and mesh: their loop completed an iteration in the last 30 s.
  • For a service that holds a Vault token (agent gateway, mesh, API with AI keys, AI proxy, mail): that token is not about to expire. Renewal failing with under 24 h left makes the service not ready. The journal says vault_token_renewal_failed, and the API’s body says vault_token.ok=false.

The API’s /readyz body reports database.in_recovery and replay_lag_seconds (on a standby). On the primary, it reports each replica’s name, state, sync_state and replay_lag_seconds (null without pg_read_all_stats).

What to do:

  • All services fail together: the database is out. Go to control-plane PostgreSQL failover, or restore if both nodes are lost.
  • A single service fails: that process is down or its loop is stuck. Check systemctl status and journalctl -u <unit>. Restart=always restarts a crashed process after 5 s.

An API that never becomes ready in production mode may be refusing its database role. The journal line names it: production authentication refuses a database role that bypasses row-level security. The API must run as the NOBYPASSRLS, non-owner pushleft_api role with PUSHLEFT_MIGRATE_ON_START=0 (the production default). Run migrations separately with pushleft-api migrate as the owner (migrations).

Node: Docker down after a reboot

On a fleet node, Docker Requires=pushleft-firewall-restore.service. That service reloads every saved environment firewall (/var/lib/pushleft/firewalls/*.nft.json) before any container restarts (workload hardening).

If one file fails to load, Docker and the agent stay down and the node goes unhealthy. Tenant containers must not run unfiltered.

  1. Run journalctl -u pushleft-firewall-restore. It names the file.
  2. Fix the cause (missing nft, a hand-edited file).
  3. Run systemctl start docker.

Do not delete a file only to get Docker up. You may delete one file only if its environment is already torn down (no Docker network uses its bridge). Otherwise drain the node and let its work move (node drain and replacement).

Control-plane exposure

  • PostgreSQL. Control-plane PostgreSQL listens on localhost and the node’s private vSwitch address only (PUSHLEFT_PG_LISTEN_ADDRESSES). pg_hba.conf admits only the replica and the control-plane hosts in PUSHLEFT_PG_CLIENT_HOSTS. configure-primary removes the catch-all line.
  • Enrollment listener. The enrollment listener (8444) answers 429 past 10 attempts per source address, refilling one per 6 s. It also answers 429 past 60 attempts for the whole listener, refilling one per second. The journal line is agent enrollment rate limited. The buckets live in the gateway process, so a restart refills them (enrollment).
  • DNS zones. Unverified DNS zones expire after 7 days (status = 'expired'). Creating the zone again issues a new TXT value (domain registration).

Ingress returns 404 after a restart

The agent publishes routes through the ingress Caddy’s admin API, so they exist only in Caddy’s running config. Run Caddy with --resume (deploy/systemd/pushleft-ingress-caddy.service). It then reloads its own autosave after a restart or reboot. A Caddy started from the base config alone answers 404 for every hostname until each deployment is republished (ingress host failure).

Linux checks before a release

The staging fleet (staging runbook) is the Robot layout as five Ubuntu 24.04 amd64 VMs on the Proxmox lab host. The VMs are the control plane, mesh, Kata build host, application host and database host. Staging uses the real binaries, units and enrollment.

  • scripts/staging/staging.sh update builds the working tree and rolls it out.
  • staging.sh smoke runs the pl journey: Kata build, push, mesh, ingress, and an app with a managed database.
  • staging.sh isolation runs the cross-tenant plan of examples/tenants with two sample apps, including reboots of the app and database VMs.

Run them before you ship changes to the agent, the units, deploy/postgres or the node bootstrap. The Lima harness was removed on 2026-10-23. Since then, no suite covers automatic control-plane PostgreSQL failover, the management tailnet reachability checks, a control-plane reboot or arm64 hosts (gap).

Audit trail

The audit trail answers who did what, and when. It lives in three append-only tables: auth_events, deployment_events and agent_job_results. Triggers reject UPDATE and DELETE, for the owner too, unless the triggers are disabled.

QuestionWhere it is recorded
Who deployed what, and whendeployment_events.kind='deployment_accepted' (environment), plan_resolved, build_queued (source revision). actor_user_id/actor_credential_id (migration 0034) carry the user and the API token or session id of the request. Rows from before 0034 and from development mode have no actor.
Who tore down whatteardown_requested with the same actor columns. Then application_removed, ingress_route_*, deployment_superseded.
Token lifecycleauth_events: bootstrap, login (with second_factor), logout, token_created (name, scope, role, service), token_revoked, login_code_created, and failed_auth with a reason (authentication audit). Ids only. Actions taken with a service token record no user_id (gap).
Second factor and login abuseauth_events: totp_enrolled, totp_activated, totp_disabled, recovery_code_used, security_settings_changed, failed_auth (totp_invalid, totp_replayed, recovery_code_reused, challenge_*, totp_required, totp_enrollment_required), and organization-less rate_limited rows (pushleft-api audit --org none). Never a TOTP secret, code or recovery code.
Membership changesauth_events.membership_changed: the acting user, plus {user_id, from, to} in the detail
Build outcomessource_verified, build_completed, build_failed (terminal flag, bounded log tail); agent_job_results for every attempt (node, attempt, outcome)
Runtime outcomesapplication_ready, application_failed, application_run_succeeded/_failed (exit code, log tail), application_placement_rejected, application_stopped, application_removed, application_teardown_failed
Ingress outcomesingress_publishing, ingress_route_active/_draining/_removed, ingress_failed, ingress_rejected, deployment_url_ready (URL)
Custom domainscustom_domains (status, method, attempts, last_error, created_by) and append-only custom_domain_events: custom_domain_added/_removed (with actor_user_id), custom_domain_check_failed (one per distinct reason), custom_domain_verified (method), custom_domain_failed (reason), custom_domain_routing, custom_domain_route_active/_failed/_removed. No certificate or key material is ever recorded.
Organization standing and abuse (abuse controls)auth_events: org_tier_changed (from, to), org_suspended, org_unsuspended, org_mail_paused (automatic, with the rates), org_mail_unpaused, abuse_report_resolved (report id, category, resolution; never the reporter). Operator commands record operator and reason. Reports themselves are in abuse_reports.
Budgets (budgets)auth_events: budget_changed (amount, thresholds, mode, acting user), budget_threshold_reached (threshold, spend, spend_blocked). The usage ledger itself (usage_ledger) is append-only too.
Fleet operator actions through the admin API (the Fleet app: admit, drain, migrate volumes, decommission, replace, provision, enroll host, relocate database, dismiss a failure)fleet_events.kind='operator_action': operator, action, arguments and outcome (append-only)
Runbook repairs through pushleft-controller fleet (revoke-node-certificates, mark-node, disable-user, fail-deployment, each with --reason)fleet_events.kind='operator_cli_action': action, node, reason, the login that ran it, and what changed (append-only). disable-user also writes token_revoked to each token’s organization. fail-deployment writes operator_failed or teardown_requested to the deployment.
Other pushleft-controller fleet actions (drain, decommission, admit) and break-glass SQLNot audited beyond fleet_nodes.status/retired_at and fleet_node_certificates.revoked_at. Record each in the ticket.

To read the trail as an operator:

DATABASE_URL="$OPS_URL" pushleft-api audit --org <uuid> --since 2026-10-01T00:00:00Z [--until <rfc3339>] [--limit 10000]

The command prints one JSON object per line, oldest first, across the three tables: {at, source: auth|deployment|agent_result, kind, deployment_id, actor_user_id, actor_credential_id, detail}.

  • Log tails (log) are stripped from event payloads and results.
  • The transaction is read-only.
  • It refuses to run under a role that RLS would blind (not superuser, BYPASSRLS or the table owner). Such a role would return an empty audit.
  • Tenant owners and admins can already read their own auth_events through RLS. There is no tenant-facing audit endpoint.

To search across organizations, use fleet audit-search. It reads the same three tables and adds org_id to each line. All filters are optional except --since:

DATABASE_URL="$OPS_URL" pushleft-controller fleet audit-search --since <rfc3339> [--until <rfc3339>] [--org <uuid>] [--node <node>] [--actor <email or id>] [--limit 10000]
  • --node keeps the agent results that node reported.
  • --actor matches the acting user, the credential, and a user, token, session or credential id in the event detail. An email is resolved to the user id.

The trail never contains:

  • Token, session or login-code secrets. Only SHA-256 hashes exist, and they stay in the credential tables.
  • Registry or Vault credentials, or environment secret values.

Agent results reject secret-shaped field names. Build and run log tails are tenant output, bounded to 16 KiB.

Retention.

  • auth_events and agent_job_results are kept for the life of the control-plane database. No Pushleft code prunes them, and the triggers block deletion.
  • deployment_events are kept by default too. An organization’s retention policy can set an event window. The scheduler then purges expired events of finished deployments, including build logs, which travel in events (purge_expired_deployment_events). The trigger allows only that delete and never removes a deployment’s newest event, so stream cursors are never reused.
  • Deployment audit rows (deployment_accepted and its actor) older than an org’s window are gone after the purge.
  • Source and registry retention GC releases objects but keeps every row (source ingestion).
  • Node and workload telemetry in ClickHouse has a 90-day TTL.

A bounded audit retention period with archival, and a tenant-erasure procedure that works with append-only tables, are plans. Until they exist, the audit trail is only as durable as the control-plane database backups (disaster recovery).

Abuse mailbox

Abuse reports reach Pushleft two ways: the public form endpoint POST /v1/abuse/reports (abuse reports) and mail to abuse@<platform domain>. RFC 2142 and the RIR abuse contacts (the abuse-c of the Robot IP ranges) expect that mailbox. Set it up before the first customer mail is sent:

  1. Create abuse@ at the platform domain’s mail provider (not on the customer MTA, whose IPs can be blocked). Route it to a shared inbox that at least two operators read. Publish it as the abuse-c contact for the Hetzner Robot subnets and in the site footer.
  2. Set PUSHLEFT_ABUSE_NOTIFY_EMAIL=abuse@<platform domain> in api.env. Platform mail (PUSHLEFT_SMTP_URL, platform mail) must be configured. Every report from the endpoint is then mailed there with its triage command. Without these settings, reports are only stored, so check pushleft-api abuse list every day.
  3. Copy each report that arrives by mail into the queue, so that one queue holds every report and resolving it writes the audit event. Use the endpoint with the reporter’s address, target and text.
  4. Triage. Run pushleft-api abuse show <id>, check the target, then resolve the report with resolve or suspend (abuse reports). Answer the reporter from the shared inbox. Do not name the customer.
  5. Answer reports from blocklists and network operators (Spamhaus, Hetzner abuse tickets) within their deadline. A Hetzner abuse ticket that is not answered can lead to null-routing of the IP.

Capacity

Capacity is how many deployments the control plane can place on a given fleet.

Gateway budget. New tenant gateways reserve 1 CPU and 256MiB (2 CPUs from 2026-10-29 to 2026-11-04, tenant gateway CPU). The capacity fixture defaults to 20 nodes for 100 isolated environments, sized for the 2000m gateway (2500m per environment, at most 6 on a 15500m node). With the 1000m gateway a 500m role plus its gateway is 1500m, so at most 10 fit on a 15500m node. The measurements below are historical runs with 500m gateways. Their packing and headroom figures do not measure the new budget. Set fixture sizes explicitly when you compare future runs.

Target: 100 deployments on 10 nodes. npm run test:capacity (scripts/capacity-e2e.sh) is the evidence. Measured on a 2026-10 dev Mac (Apple Silicon, Docker Desktop PostgreSQL 17, debug builds, shared with other work).

The test does this:

  1. It creates a disposable migrated database and applies migrations with pushleft-api migrate as the owner.
  2. The real API runs as the non-owner pushleft_api role. The real scheduler and the real mTLS gateway run as their BYPASSRLS roles. All have the grants in database roles.
  3. It seeds 10 application nodes at 15 500 m CPU / 31 744 MiB each (a Hetzner CPX51 less the fleet host reserve).
  4. It creates 100 single-replica web deployments through POST /v1/deployments. It stubs each build in SQL (snapshot, leased build job, the real publish_release_artifact).
  5. It stubs network admission in SQL every second, the way scripts/application-lifecycle-e2e.sh does.
  6. It waits until every web instance is targeted, and checks the invariants.
  7. Every node leases once through the gateway. The test runs the alert rules and pushleft-api audit, then stops every service with SIGTERM.

All of these assertions pass:

  • No node’s reserved plus active CPU or memory exceeds its capacity.
  • Every instance has exactly one targeted ensure_application job, on the node that holds its single active role allocation.
  • There is one gateway allocation per (environment, node).
  • Each node leases only its own work. Nodes with none get 204.
  • The scheduler’s database time in every 2 s window stays under the 2 s tick.
  • The audit returns rows under the ops role and refuses the RLS-bound API role.
  • All three services exit on SIGTERM within 10 s, with a logged graceful shutdown.
Measure (one run, 2026-10-17)Result
API POST /v1/deployments, sequential, 100 callsp50 8.7 ms, p95 11.5 ms, max 25.9 ms
Scheduler start → first instance targeted16.4 s (a first pass reserves, a second pass 15 s later targets after admission)
Scheduler start → all 100 instances targeted32.4 s (406.4 s before the tick drained its queue; see below)
Scheduler database time per 2 s window (20 windows, 7 455 statements)p50 9 ms, p95 721 ms, max 811 ms; slowest single statement 35 ms
Gateway POST /v1/agent/lease (7 nodes with work)p50 15.7 ms, max 17.8 ms
Placement result15, 15, 15, 15, 15, 15, 10, 0, 0, 0 instances per node; fullest node 96.8 % CPU reserved

What the numbers say:

  • The loop bounded throughput. The database had spare capacity. place_once handled one placement job per 2 s tick. Each web instance needs two passes (reserve, then target once admission exists), so 100 instances took about 400 s.
    • The tick now drains the queue while place_once returns true. Each drain stops at 64 placements or 10 s per tick, so the readiness heartbeat still beats every tick (crates/pushleft-scheduler/src/main.rs).
    • The same run then took 32.4 s. The remaining time is the 15 s admission-evidence delay plus the two passes.
    • Database time per 2 s window rose from ~2 % to a p95 of 0.72 s, still inside the tick.
  • Maintenance runs once per tick. Lost-node reclaim, the unstarted-reservation reaper, durability, ingress, lifecycle and environment teardown used to run inside every placement of the drain. They now run once before it. On the same test and machine, scheduler statements fell from 10 051 to 3 758. Database time per 2 s window fell from p95 1.43 s to 1.00 s. All 100 were targeted in 34.5 s, down from 36.6 s. The 15 s admission delay dominates that time.
  • Placement packs. Candidates are ordered best fit on free capacity: least free memory that still fits, then least free CPU, then id. The candidate query computes this, and only the chosen node is locked and rechecked. Nodes fill one at a time, and three of the ten stayed empty. One node failure takes out up to 15 of the 100 deployments. There is no anti-affinity or spread (gap).
  • CPU is the binding resource. In the measured run, a single-replica web deployment reserved 1 000 m and 768 MiB. The 1 000 m was 500 m for the role plus 500 m for the environment gateway, so a CPX51 held 15. The target needs at least 7 such nodes, and 10 leave about 50 % headroom.
  • Connection budget. The pools add up to 86 connections (API 20, gateway 20, telemetry gateway 20, mesh 16, scheduler 5, controller 5). PostgreSQL’s default is max_connections = 100, before operator sessions and ops-alerts. Raise max_connections or add a pooler before you scale any service out.

The target also needs the following, which this test did not cover:

  • Runtime execution of 100 containers. No agent ran, no image was pulled and no container started. A real load test must run real agents on 10 Linux nodes. The agent’s general lane is serial (execution lanes), so 15 instances on one node start one after another (pull, start, health probe up to 60 s each).
  • Real network admission: the mesh worker and one Headscale coordinator per environment, so 100, spread over their environments’ hosts. Each node also needs gateway, firewall and route evidence.
  • Real builds: the build pool’s serial lanes, the 30-minute timeout, and registry push concurrency for 100 sources. Source upload has only 2 slots per API process.
  • Ingress: 100 routes in the host Caddy, publication latency, and HTTP probes through it.
  • Concurrent pl up and SSE followers against the API, telemetry volume through the telemetry gateway, and sustained churn (redeploys, teardowns, cron).
  • Failure injection during the load: a node lost, a gateway restart, a database failover.

Retention and cleanup

Cleanup jobs keep storage and the database bounded. Retention has the details.

  • Registry blob GC. Zot collects garbage online (storage.gc, blobs older than 1 hour). A pass takes about 30 minutes. While it walks a repository, it holds the store lock, so pushes and pulls to every repository wait (zot 2.1.x; per-repository locks are planned for zot 2.2). A periodic pass starts only between 02:00 and 03:00 UTC (gcTimeWindow, checked every gcInterval, 1 h). A pass that has started runs to the end. A restart also starts a pass: on 2026-11-17 zot started one a second after “successfully initialized” ("module":"gc", “executing gc of orphaned blobs”), and the zot docs describe a one-time pass after gcDelay. Restart the registry inside the window, or accept a pass at that time. A change to gcTimeWindow needs a restart. Its retention policies delete old untagged images (registry retention). Nothing needs scheduling. Watch the registry bucket’s size in R2. A sudden drop means a retention rule deleted more than expected. Zot logs every decision with "module":"retention".
  • Stale deployment reaper. The scheduler fails deployments with no progress for longer than PUSHLEFT_REAP_QUEUED_AFTER (3600 s), PUSHLEFT_REAP_BUILDING_AFTER (2700 s) or PUSHLEFT_REAP_DEPLOYING_AFTER (3600 s). It also fails a deploying release whose role has waited for placement longer than PUSHLEFT_REAP_PLACEMENT_AFTER (600 s) (reaper). It never fails one with a live lease or in a suspended organization. Each reap logs a stale deployment reaped warning and appends a deployment_reaped event with the reason. Many reaps at once usually mean a build or application pool without capacity, or a gateway that is down (stuck deployment).
  • Stopped releases. Since 2026-11-05, stop_application removes the release’s containers, their secret directories and the image when no other container uses it. Before then, stopped containers stayed: pl-app-1 held 378 of them and 70 GB of images. The application_stopped event says retained: false.
  • Per-organization policy. Release, source, idle-preview and event windows are org settings bounded by the trust tier (org_tiers.max_*). Raising a tier raises the caps. Only production keeps release history: a preview’s superseded, failed or cancelled release gives up its source and image at once (retention). The scheduler role needs EXECUTE on purge_expired_deployment_events(integer) (database roles).

Disaster recovery

This table states what each component can recover from today. “Manual” means a runbook step that an operator runs. No restore drill has been timed, so no RTO below is measured.

ComponentCurrent stateRPORTOGaps
Control-plane PostgreSQLProduction today: one PostgreSQL 18 primary on the control-plane host, with no replica. It has a WAL archive, base backups, PITR and age-encrypted off-host copies. A lost database needs a restore. The HA design in deploy/postgres is built and not deployed: one synchronous replica, pg_auto_failover with a witness on a third host, and HAProxy on each control-plane host (runbook).Host lost: the lag of the off-host copy, ≤ 5 min, with pg_archive_copy_stale after 15 min. With the HA design: 0 for acknowledged commits when one node is lost.Production: a restore onto a new host, not yet timed. HA design: automatic failover took 54–56 s on three Lima VMs on 2026-10-20, and nothing has rerun it since the suite was removed on 2026-10-23. Manual mode: 4.9–5.0 s scripted in Docker (npm run test:control-plane-ha), plus human detection.No replica in production, so no failover. For the HA design: network-partition behaviour (an isolated primary may serve stale reads for about 20 s), loss and replacement of the monitor, operator-CA certificates on real hosts, restore drills at production size, Robot hardware
Source store /var/lib/pushleft/sourcesLocal 0700 directory on the control-plane host, no backup; or an S3-compatible bucket with PUSHLEFT_SOURCE_S3_* (retention.md)Local: total for unbuilt sources. S3: the provider’s durability. Already-built images are unaffected (they are in the registry).Uploads in flight fail, and users rerun pl up.S3 mode not yet run with a full upload-build; no client-side encryption
Gateway server key, agent CA key, telemetry TLSFiles on the control-plane hostOperator’s own backupRestore files, restart. Without the CA key, no enrollment or renewal. Nodes keep working until their certificates expire (24 h by default), then renew within the 7-day late-renewal grace once the CA key is back; past it they need replacement. A planned CA change is a two-phase rotation with no outage (fleet ca rotate --begin/--complete, fleet.md); the gateway reloads the files without a restart.HSM/KMS signer
OCI registryExternalThe provider’sThe provider’s. Builds fail closed during the outage (runbook).Secondary registry
Mesh coordinator host (Headscale per environment)Root-owned SQLite and Noise keys under /var/lib/pushleft/headscaleNo automated backupNot designed: losing coordinator state means re-enrolling each environment’s gatewaysCoordinator backup and restore procedure
Managed tenant PostgreSQL/ClickHouseContainers on one database node’s XFS volume. Daily sealed base backups, PostgreSQL WAL archiving and restore drills on the node. The agent hard-links the sealed archive into the off-host spool on the same partition (one copy on the host), and pushleft-offsite.timer ships it to R2 (backups).PostgreSQL: the WAL archive, at most 5 min behind on an idle server (archive_timeout=300). Off-host: as fresh as the last spool ship.Manual: pl db restore to a new generation (restore requests)A run of pushleft-offsite against the real R2 bucket and a restore drill from R2; replica HA (required before production)
Object storage (Garage, included tier)One Garage node, replication 1, on the database host’s data disk (storage.md). Every night pushleft-garage-mirror.timer copies every bucket, encrypted with rclone crypt, to the R2 bucket pushleft-garage-mirror as a full snapshot under garage/<UTC stamp>/ (runbook). The bucket’s lock and lifecycle rules keep each snapshot undeletable and then drop it after 5 days.≤ 26 h (garage_mirror_stale); an object written and deleted between two runs is lostManual: rclone copy of the latest snapshot that has COMPLETE back into GarageOnly 5 days back: an object deleted or overwritten in Garage more than 5 days ago cannot be recovered. Full copy each night (5× the data in R2); a restore of a whole bucket into Garage is not drilled, only single objects (2026-11-05)
Application nodesStateless containers. A node silent for PUSHLEFT_NODE_LOST_AFTER_SECONDS (default 300) is marked lost: leases fenced, capacity released, instances lost, replacements placed on another admitted node at the next generation. The deployment stays live (or degraded with an event if nothing can take the work).n/a (stateless)Automatic: lost-after time + placement + network admission + startup on the new node (about 60 s after the threshold in npm run test:fleet-reclaim, not measured in production) (runbook). A drained but alive node is still moved by redeploy (runbook).Relocation off a draining (alive) node; a staging proof of new hosts for a sealed environment topology (topology revisions); a returning lost node after a completed CA rotation gets no cleanup list
Database nodes, node lostInstances become error with a database_instance_stranded fleet event. Allocation held, data not moved.As managed databases aboveManual: recover the host and its volume, or restore from the tenant’s backupsDatabase relocation, HA
Ingress (host Caddy)Routes pushed once per publication. Caddy autosave restores them on the same host.n/aSame host: caddy run --resume. Lost host: the replacement publishes a relocation route on its node once healthy; the old route drains only then. With platform DNS configured, the controller repoints each hostname’s record; otherwise repoint the wildcard (runbook). Between live nodes, the old route drains only after the hostname’s DNS has pointed at the new node for two minutes (0125).Periodic route reconciliation, republish command
Vault/OpenBao (external, single instance, integrated raft storage)Holds every organization’s backup key and every database admin and principal password. Hourly raft snapshots, encrypted with age to an offline operator key and copied off-host, kept at least 35 days (longer than tenant backup retention). Unseal shares held offline by named people. Optional escrow of backup keys alone (runbook).≤ 1 h (snapshot interval); vault_snapshot_stale after 2 hManual: fresh instance, force-restore the decrypted snapshot, unseal with the original shares. Scripted end to end in npm run test:vault-backup (Docker, single share); not timed at size, no real unseal ceremony held.3-node raft cluster, a real restore ceremony with the named holders, write-once off-host retention
ClickHouse telemetry90-day TTL, no backupTelemetry loss acceptedRecreate schema—
RegionPreviews run in fsn1, or in the manifest’s preview.region. Production manifests may name two regions, but nothing fails over.——Two-region failover is not implemented. There is no cross-region replication of the control plane or of tenant databases, and no witness or writer fencing (architecture.md describes the plan).

The control-plane host is still a single point of failure. Its PostgreSQL has no replica, so a lost database needs a restore. The API, scheduler and gateway host fails over by hand to a prepared cold standby (control-plane host failover). While the host or the database writer is down, running workloads and their routes keep serving, because agents never stop healthy containers on gateway errors. Nothing can be deployed, torn down or changed until both are back.

Credential lifetimes

No credential may expire in a way that makes a node unreachable or the fleet unmanageable without an automatic, alerted renewal path. Each row names the lifetime, how it is renewed and the alert that fires before it runs out.

  • ops-alerts watches file-based certificates listed in PUSHLEFT_OPS_CERT_FILES (ops-alerts.env.example).
  • certificate_file_expiring is a ticket under 30 days, and a page under 7 days or for an unreadable file.
  • Node-side details: fleet credential lifetimes.
  • To rotate a secret by hand, follow secret rotation.
CredentialLifetimeRenewalAlert
Agent client certificate24 hAutomatic at a third of its lifetime left; up to 7 days after expiry on the renewal route only (PUSHLEFT_AGENT_CERT_RENEW_GRACE_SECONDS, audited as agent_certificate_late_renewal)agent_certificate_not_rotating (page; active, unhealthy and draining nodes, 30 min past the renewal point)
Gateway server certificate1 yearpushleft-controller fleet ca renew-server (same CA and key; the gateway reloads it within 2 s), or fleet ca rotate --completecertificate_file_expiring
Fleet CA5 yearsfleet ca rotate --begin / --complete, no outage (fleet.md)certificate_file_expiring
Registry token signing certificateAs issued (10 years in build-executor.md)Manual; also the registry’s rootcertbundlecertificate_file_expiring
Telemetry gateway server certificate and client CAAs issuedManualcertificate_file_expiring
Telemetry client certificates (purpose='telemetry')As issuedNone (gap): issued and replaced by hand. At expiry the node’s telemetry stops; the node keeps working.telemetry_certificate_expiring (ticket, 30 days)
Registry TLS certificateAs issuedManualcertificate_file_expiring
Control-plane PostgreSQL server certificatesAs issuedManual (ssl_cert_file on each node)certificate_file_expiring
Mesh coordinator HTTPS (Caddy)As provisionedACME by Caddy, or a file the operator renewscertificate_file_expiring when a file
Ingress certificates (wildcard, custom domains)90 days (ACME) or as issuedCaddy ACME; wildcard by the operatoringress_certificate_expiring (ticket), ingress_certificate_invalid (page)
Environment-mesh gateway nodes (Headscale)No expiry (node.expiry: "0")Not needed: gateways never re-authenticate. Every coordinator ensure clears an expiry still set (nodes registered under the earlier 720 h default) and replaces the earlier coordinator config.mesh_node_expiring (page, under 7 days); route checks log mesh_node_expiry_near
Vault service tokens (agent gateway, mesh, API, AI proxy, mail)Periodic orphan tokens, -period=72hAutomatic: each service calls renew-self every period/3 (deploy/README.md)service_not_ready (page): /readyz fails when renewal is failing with under 24 h left
Vault snapshot tokenPeriodicRenewed by each timer runvault_snapshot_stale (ticket)
Enrollment secret, Headscale pre-auth key, Vault wrapping token, registry token15 min, 10 min, 5 min, 15 minNone by design: single use or per operation—

A gateway outage stops every heartbeat at once. The scheduler treats a fleet with no heartbeat at all within PUSHLEFT_NODE_LOST_AFTER_SECONDS as a gateway outage, and reclaims nothing (fleet_heartbeats_absent, page). The outage therefore does not mark the fleet lost (lost nodes).

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