Repository navigation
feat(sbx): SBX_WORKER_AT_BOOT=0 installs a worker without enabling it for boot - #799
Conversation
… for boot install-host.sh enables every template worker unit it installs, and the unit is WantedBy=multi-user.target, so a host boot starts every installed worker. Under a host agent, which starts and stops workers from the control plane's wanted state, the agent's first run after a boot stops all the workers nothing leases. Each of those starts pays a snapshot verify and a standby pool fill for nothing, and a stop during a pool fill can leak a VM (rossoctl#795). install-host.sh now takes SBX_WORKER_AT_BOOT (0 or 1, default 1, so nothing changes for existing installs). With 0 the unit is installed and started once, as before, but disabled rather than enabled. Every re-install applies the value it is given, so a re-install with 0 disables a unit an earlier install enabled, and one with 1 enables it again. Any other value, an explicit empty one included, is refused before systemd or any file is touched, as the script's other settings are. The README and the RUNBOOK say to use SBX_WORKER_AT_BOOT=0 on a host run by a host agent. The tests cover the default, 0 on a fresh install, a re-install with 0 then 1, and the refusals. Refs rossoctl#796 Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
Adds SBX_WORKER_AT_BOOT (0|1, default 1) to deploy/sbx/install-host.sh. Under 0 the worker unit is installed and started once but systemctl disabled, so a host boot leaves starting workers to the host agent (#796). I read every changed line. The default path is unchanged: still enable, then reset-failed and one restart. A re-install applies the value it is given, and disable on an already-disabled unit is a no-op. The ^[01]$ check runs before install_egress/install_units/install_worker, so a bad value touches nothing. The no-colon ${SBX_WORKER_AT_BOOT=1} correctly refuses an explicit empty value. [email protected] has [Install] WantedBy=multi-user.target and nothing else pulls the instances in at boot, and moca-egress stays enabled as before. The tests track enable state in the mock and cover the default, five bad values, a fresh 0, and 1 → 0 → 1 re-installs. The README and RUNBOOK match the behaviour. No issues found.
Author: webchang (MEMBER — maintainer)
Areas reviewed: Shell, Docs, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (all 16 checks green, including deploy-scripts, deploy-scripts-bash32 and shellcheck)
AI-assisted review, approved by a maintainer before posting.
clawgenti
left a comment
There was a problem hiding this comment.
All checks pass. Ready for human review.
The validation runs before validate_worker, so any systemctl call or file write comes after it. It sits after the --egress early return, so it applies only to a worker install, which is the only path that reads it. Using ${SBX_WORKER_AT_BOOT=1} without the colon means an explicit empty value is refused, as the PR body says. disable on a unit that was never enabled is harmless, so a fresh install with 0 is safe. No inline comments.
- Author: webchang (MEMBER — maintainer)
- Areas reviewed: Shell (
install-host.sh), tests (install-host.test.shand the systemctl mock's enable state), docs (README §2, RUNBOOK step 5) - Agent/IDE config (.claude/.vscode): none
- Commits: 1 commit, all signed-off: yes
- CI status: passing (all 16 checks green, including deploy-scripts, deploy-scripts-bash32 and shellcheck). Mergeable (
CLEAN).
Verified by:
bash deploy/sbx/tests/install-host.test.shon the PR head: 42 ok, exit 0, including the four newSBX_WORKER_AT_BOOTcases- shellcheck 0.11 over
deploy/sbx/*.shand the test, diffed againstmain: no new findings git merge-tree origin/main pr-799: clean. Against #800 it conflicts, as the PR body expects- grepped
deploy/for anything that reads a unit's enable state (is-enabled,list-unit-files,status.sh): onlyis-activeis used, so nothing else depends on the change
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
|
need rebase and resolve conflicts |
Conflicts in RUNBOOK.md and install-host.sh: main's guest-RAM, budget and SBX_WORKER_BIN text and setting, plus this branch's SBX_WORKER_AT_BOOT setting and RUNBOOK sentence. Both sides kept. Refs rossoctl#796 Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Follow-up at 89cd353 (merge of main 634781a). Both conflict resolutions (install-host.sh defaults, RUNBOOK step 5) keep both sides. SBX_WORKER_AT_BOOT validation still precedes validate_worker and every write or systemctl call. CI is green and the PR is mergeable. No new issues.
AI-assisted review, approved by a maintainer before posting.
|
still conflicts |
Conflicts in deploy/sbx/tests/install-host.test.sh, both sides kept: main's EXIT trap (it also ends the reaper tests' leftover processes) with this branch's MOCK_ENABLED_DIR, and this branch's SBX_WORKER_AT_BOOT tests followed by main's VM-reaper tests. Refs rossoctl#796 Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Follow-up at c6cecd2 (merge of main 1016d26). The one hand resolution, in deploy/sbx/tests/install-host.test.sh, keeps both sides: main's EXIT trap (with the reaper-process cleanup) plus this branch's MOCK_ENABLED_DIR, and the SBX_WORKER_AT_BOOT tests followed by main's #795 reaper tests. Nothing was dropped (checked with git show --remerge-diff). The ^[01]$ check still runs before validate_worker (which now includes the SBX_LIBEXEC_DIR checks), so a bad value is refused before any write or systemctl call. A worker disabled with 0 still gets the ExecStopPost= reaper when it is stopped. No new issues.
Author: webchang (MEMBER — maintainer)
Areas reviewed: Shell tests (merge resolution)
Agent/IDE config (.claude/.vscode): none
Commits: 3 commits, all signed-off: yes
CI status: see checks
AI-assisted review, approved by a maintainer before posting.
Upstream main (949dc5f) adds SBX_WORKER_AT_BOOT (rossoctl#799), the worker stop's VM reap (rossoctl#800), and template tags, edits and owner transfer (rossoctl#774). This branch claims no API version. Conflicted: - deploy/sbx/install-host.sh (main): both checks kept, this branch's SBX_READ_AHEAD_KB refusal and then main's SBX_WORKER_AT_BOOT one, each before the host is touched. Also changed in the merge: - install-host.sh's header, the README and the RUNBOOK's read-ahead section say sbx-read-ahead.service is enabled whatever SBX_WORKER_AT_BOOT says, so a host agent's later worker starts read ahead too; install-host.test.sh checks it (a worker installed with SBX_WORKER_AT_BOOT=0 still enables the read-ahead, not the worker). - deploy/sbx/README.md: a blank line after the read-ahead paragraph, which ran into the next one. - [email protected] (auto-merged): main's ExecStopPost and this branch's After=sbx-read-ahead.service both kept. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Closes #796. One signed-off commit on main (86d6350), in
deploy/sbxonly.What it does:
install-host.shtakes a new setting,SBX_WORKER_AT_BOOT, so that on a host run by a host agent, a boot doesn't start every installed template worker.1(the default): the worker's unit is enabled for boot, as today. Nothing changes for an existing install.0: the unit is installed and started once, as today, but left disabled. A boot then starts none of the workers, and the host agent starts each one from the control plane's wanted state.0disables a unit an earlier install enabled, and one with1enables it again.systemctl enablebecomessystemctl disableunder0.reset-failed, the single restart and the attach wait are as before.0or1is accepted. Anything else is refused, naming the value, before anysystemctlcall or file write. An empty value is refused, unlike the other settings, so a mistaken empty pass never silently means boot starts. Only an unset variable defaults to1.deploy/sbx/README.md§2 describes the setting, and RUNBOOK step 5 says to useSBX_WORKER_AT_BOOT=0on a host run by a host agent.Why: on a host-agent host, a reboot started every installed worker at once, and the agent stopped them about 20 s later. That wastes cold starts, and a stop during a worker's pool fill can leak a VM (#795).
Not in this PR: the host agent itself isn't on main yet. Its install should pass
SBX_WORKER_AT_BOOT=0, which is a one-line follow-up in the host-agent PR (#772) once this is in.Tests (
deploy/sbx/tests/install-host.test.sh):systemctlmock now tracks each unit's enable state;2,yes,'',' 1'and01are each refused before anysystemctlcall or env file write; a fresh install with0starts once without enabling; a re-install takes1 → 0 → 1through disable and enable again. They fail on the unmodified script;declare -A), as on main, after the three new cases pass;make test-deploypasses.Expected overlaps: #782 and #757 also change
install-host.sh(the read-ahead unit, the legacy jail), so whichever merges later rebases a few lines.Assisted-By: Claude Code