Skip to content

feat(cluster): start the node Colima profile from a launchd daemon at boot - #175

Merged
Mearman merged 3 commits into
mainfrom
feat/colima-boot-daemon
Nov 3, 2026
Merged

Mearman merged 3 commits into
mainfrom
feat/colima-boot-daemon

Conversation

@Mearman

@Mearman Mearman commented Nov 2, 2026

Copy link
Copy Markdown
Member

The Colima node profile was started by a launchd user agent, which only runs once someone logs in. A Mac that reboots or loses power with FileVault off sits at the login window, so the profile and the k3s container stay down (m1 did exactly that).

For the profile named by github_runner_cluster_runtime_boot_profile (default node) the role now installs a launchd daemon instead: /Library/LaunchDaemons/<label>.plist, root:wheel, 0644, loaded with launchctl bootstrap system. It runs colima start --profile node --activate=false as the connecting user (UserName) with HOME, PATH and COLIMA_HOME in its environment, and logs to the user's ~/Library/Logs. Writing and loading it use become. Any other profile (the mini's default) keeps its login agent; its rendered plist is byte for byte what it was. github_runner_cluster_runtime_autostart_at (auto, login, boot) overrides per host.

A profile has one kind of job at a time. Installing the daemon unloads the profile's agent from gui/<uid> when there is a session and deletes its plist either way (m1 has the file but no session), so hosts that got the v2.19.0 agent migrate on the next run and nothing starts the profile twice. Setting a host back to login retires the daemon the same way. Neither unload stops the VM, and loading runs colima start, which does nothing to a running profile. A rerun with nothing changed changes nothing.

Tests (tests/unit/test_runtime_autostart.py) run the role against stand-ins, with a launchctl that refuses to change the system domain unless called through the stand-in sudo. I checked they fail with UserName removed from the template and with become removed from the load task.

Only a real boot shows whether a daemon with UserName can start a vz VM and whether socket_vmnet's sudoers entry works from it; the stand-ins cannot. Validation on m1: stop the profile and unload the agent, load the daemon, reboot to the login window and check colima status --profile node.

…at boot

The login agent only runs once someone logs in, so a Mac that reboots or loses power sits at the
login window with the node's Colima profile stopped, and its k3s container never comes back.

The profile named by github_runner_cluster_runtime_boot_profile (node) is now started by a launchd
daemon, a property list in /Library/LaunchDaemons owned by root:wheel with mode 0644, loaded into
the system domain and running as the connecting user (UserName) with HOME, PATH and COLIMA_HOME in
its environment. Writing and loading it use become. Any other profile keeps its login agent,
rendered and installed exactly as before. github_runner_cluster_runtime_autostart_at (auto, login
or boot) overrides the choice per host.

A profile has one kind of job at a time. Installing the daemon unloads and deletes the profile's
agent from an earlier run, whether or not the user has a login session, and installing the agent
does the same to a daemon, so the profile is not started twice. Neither unload stops the VM.
…ive node's argument specs

The argument specs declare the native node's variables only, and a test holds them to it.
@Mearman
Mearman marked this pull request as ready for review November 3, 2026 00:47
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-11-03T00:47:10.767774Z
We couldn’t complete this review. Comment @codex security review to try again.
54ff162 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@Mearman
Mearman merged commit 38b92d2 into main Nov 3, 2026
27 checks passed
@Mearman
Mearman deleted the feat/colima-boot-daemon branch November 3, 2026 00:47
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant