Skip to content

SBX0: a host boot starts every installed template worker, even under a host agent #796

Closed

Description

@webchang

Problem

deploy/sbx/install-host.sh runs systemctl enable sbx-worker@<id>.service for every worker it
installs, and the unit is WantedBy=multi-user.target. So a host boot starts every installed worker.

With the host agent (deploy/sbx/host-agent.sh), which workers run is the control plane's wanted
state: a worker with no lease is in stop. After a boot, the agent's first wanted-state run stops
every worker the boot started and nothing leases. Each of those starts pays a snapshot verify and a
standby pool fill (a pinned memory file read) for nothing, on a disk that a cold start is bound by.

Observed on a KVM host with eight installed workers and a host agent: the boot started all eight; the
agent stopped all eight about 20 s later ("stopped":8). One was stopped mid-fill and leaked a VM
(separate issue).

Proposal

Under a host agent, a worker starts only when the wanted state asks for it:

  • install-host.sh takes a setting (for example SBX_WORKER_AT_BOOT=0|1), and the host agent's
    install sets it to 0: the unit is installed and its first start done as today, but not enabled for
    boot (systemctl disable after the start, or never enable). Without a host agent the default
    stays 1, as today.
  • The RUNBOOK says which applies.

What the PR will contain

  • deploy/sbx/install-host.sh and deploy/sbx/tests/install-host.test.sh (enabled or not, per the
    setting; a re-install keeps it).
  • deploy/sbx/RUNBOOK.md (the host agent section) and deploy/sbx/README.md.

Depends on

The host agent's PR for the agent-managed case.

How to verify

On a KVM host under a host agent: reboot; no worker starts at boot, and the agent starts the leased
ones at its first run.

Limits / out of scope

  • A host whose control plane is unreachable at boot runs no workers until it is reachable again; that
    is the wanted state's model already.

Assisted-By: Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions