+**At boot (a daemon).** For the profile that runs the node the role installs a launchd daemon instead, `com.exadev.github-runner.colima.<profile>`, as `/Library/LaunchDaemons/<label>.plist`, owned by `root:wheel` with mode `0644` (launchd refuses a daemon property list that anyone else can write), and loads it into the `system` domain (`launchctl bootstrap system <plist>`). A daemon runs when the Mac starts, whether or not anyone has logged in, so the profile and the node's container come back after a power loss with the Mac sitting at the login window. The daemon runs the same command with the same `PATH` and `COLIMA_HOME` as the agent does, as the connecting user (`UserName`, which launchd honours only for a job loaded into the system domain, and ignores for an agent: `man launchd.plist` on a Mac), with that user's `HOME` set in its environment, because launchd.plist(5) does not promise one for a daemon and Colima and Lima are Go programs, whose `os.UserHomeDir` is `$HOME` on macOS. Its log is in the user's `~/Library/Logs`, as the agent's is. Writing the property list and loading it take root, so the role uses `become` for these tasks and nothing else in the runtime tasks: run the play with passwordless sudo for the connecting user (the `github_runner_macos_host` role's `github_runner_macos_host_sudoers_nopasswd` grants it) or with `--ask-become-pass`. Colima's network helper (`socket_vmnet`) and its sudoers entry are the user's, installed the first time a profile with an address starts, and the daemon runs as the same user, so it needs nothing the agent did not.
0 commit comments