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/runbooks/node-drain-and-replacement.md

Node drain and replacement

Use this for planned maintenance, a provider host alert, or when node_heartbeat_stale or node_data_disk_low fires.

Before you start

  • Use an operator host with the operator CLI: pushleft-controller fleet list|drain|replace|decommission|admit (drain, decommission, replacement). On the production fleet that is the control-plane host, pl-cp. Reach it and every node through the pl-cp jump host, or open a server’s Terminal in the Fleet app (operator access).
  • Set DATABASE_URL to the pushleft_controller role.
  • Set HETZNER_API_TOKEN for replace and decommission of Hetzner Cloud nodes. Robot hosts need no token: replace refuses them, and decommission leaves the server to you.

Diagnosis

  1. Show pool, status, schedulable, CPU/memory/disk used and total, heartbeat age and agent version:

    pushleft-controller fleet list
  2. Find what lives on the node. Open the node’s page in the Fleet app:

    • Placements lists the allocations by organization and environment.
    • Deployments lists the deployments with instances there. pushleft-controller fleet deployments-on <node> prints the same list, lost instances included.
    • Databases lists its managed databases.
    • Recent jobs lists its last 25 jobs with their status.

Move the work off the node

One command moves everything that can move, one environment at a time:

pushleft-controller fleet drain <node> --move
  1. It refuses a node that holds a live ClickHouse or Valkey instance. Those cannot relocate.
  2. It cordons the node: no new placements, but the node still leases its own exports and stops.
  3. For each environment on the node, in name order, it:
    1. Migrates its application volumes. Their roles move with them.
    2. Relocates its managed PostgreSQL to a node the scheduler picks (restore requests and relocation).
    3. Starts a replacement for each long-lived instance (web, private, worker) on another node. The old instance stops after the replacement is ready and its routes have moved.
  4. It waits for each environment before the next one, 30 minutes by default (--wait <seconds>).
  5. It stops at the first failure and prints the environment and the error. Environments after it are not moved. Fix the cause and run the same command again. It skips work already done or in flight, and it tries a failed database relocation or instance placement again. A replacement instance that failed after it started stays failed: fix or redeploy that environment first.
  6. It drains the node only when nothing holds capacity there and no volume source copy is left. Source copies of volumes and relocated databases retire on the old node after their grace period, so the node stays active until then. In that case it prints what is left: run the same command again later.

Volumes of web roles and of roles with two volumes are refused (migration between hosts). The command stops there. Ask the tenant to redeploy that environment elsewhere, then run the command again.

Destroys data: ClickHouse and Valkey cannot relocate. Do not drain a node that holds a live instance unless you are prepared to restore from the tenant’s own backups.

Move one kind by hand

  • Volumes only: pushleft-controller fleet migrate-volumes <node>. Run it again to see what is left.
  • One database: pushleft-controller fleet relocate-database <instance> --to-node <new-node>.

The source copy of a volume is removed after PUSHLEFT_VOLUME_MIGRATION_GRACE_SECONDS, and a relocated database after PUSHLEFT_DATABASE_RETIRE_GRACE_SECONDS. fleet decommission waits for both.

Drain and replace

  1. If you did not use --move, drain the node. This sets draining and schedulable=false, and prints the active allocations and live leases.

    pushleft-controller fleet drain <node>

    The gateway refuses new leases from a non-active node (403). Heartbeats and completions of jobs already leased continue.

  2. Provision a like-for-like node. The command waits for enrollment and drains the old node.

    pushleft-controller fleet replace <node>

    replace provisions Hetzner Cloud servers and Proxmox VMs only. For a Robot host, install the new server and run fleet enroll-host on it (Robot hosts), then drain the old node.

  3. Mount the data volume on the new node.

  4. Join the new node to the management mesh.

  5. Check the new node:

    pushleft-agent doctor
  6. Admit the new node:

    pushleft-controller fleet admit <new-node>

Known trap: draining blocks teardown

A draining node cannot lease. The teardown_application, remove_ingress and stop_application jobs targeted at it wait forever. Its allocations stay active, and fleet decommission keeps refusing. fleet drain --move avoids this: the node stays active until its work is gone.

The only fix today is break-glass. Record it in the ticket.

  1. Return the node to active and keep it unschedulable. The node can then lease the work already targeted at it, and nothing new is placed.

    pushleft-controller fleet mark-node <node> active --reason "<ticket and reason>"

    The command accepts only a draining, unschedulable node, and only the status active. It writes an audit row (operator_cli_action). This also lets the node lease any queued retries of its existing instances.

  2. Watch fleet list until the allocations reach zero.

  3. Drain the node again.

Decommission

  1. Decommission the node. It waits for zero allocations and zero live leases, revokes every certificate, marks the node retired, then deletes the server.

    pushleft-controller fleet decommission <node> --wait 600
  2. If the provider delete fails, run the command again. For a Robot host the command prints bring-your-own host: wipe or cancel it yourself (retiring a Robot host).

Permanent node loss

A node that stops leasing and heartbeating is marked lost after PUSHLEFT_NODE_LOST_AFTER_SECONDS (default 300). This applies whether it was active, unhealthy or draining. Its leases are fenced, its application capacity is released, and its instances are replaced elsewhere (node lost). Database allocations stay held.

To stop a revived disk from acting as the node, decommission it. This revokes its certificates, so it also stops receiving its cleanup list.

pushleft-controller fleet decommission <node>

The command refuses while a stranded database allocation is held. In that case, revoke the certificates only:

pushleft-controller fleet revoke-node-certificates <node> --reason "<ticket and reason>"

Check it worked

  • fleet list shows the replacement active and heartbeating.
  • The old node shows zero used capacity, then retired.
  • node_heartbeat_stale clears.

Do not

  • Do not set fleet_allocations.status = 'released' or delete allocations by hand. Capacity accounting and subnet non-reuse depend on them.
  • Do not retarget jobs to the replacement node. A job’s identity, lease token and generation are bound to its node.
  • Do not delete fleet_nodes rows. Retirement keeps history.
Rendered from the repository at build time. Edit docs/runbooks/node-drain-and-replacement.md to change it.