How to add a Mac runner¶
This turns an Apple-silicon Mac into a runner in your hoard. It runs as you:
no sudo, and no root process anywhere. You need a
set-up laptop; if this Mac is the laptop, it already
is. Mac runner lists everything the install
puts in place.
Before you start¶
- Lima 2.3 or later:
brew install lima. - git 2.40 or later at
/usr/bin/git. If/usr/bin/git --versionis older, point it at Xcode's:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer. - A logged-in graphical session on the Mac. The runner is a LaunchAgent, which can't be started over plain ssh.
- The darwin/arm64
allmyrambinary. From a checkout,just build-darwinbuilds it intodist/darwin-arm64/allmyram, with the VM's Linux binaries inside it. -
The VM image in the runner's cache, until the image is published as a release asset. From a checkout on the Mac:
Once the image is published, the runner downloads it on its first start instead. Until then, a runner without it in its cache says the download got the forge's sign-in page.
Steps¶
-
On the laptop, start the invite:
It prints an invite, good for 15 minutes and one connection, and waits.
-
On the Mac, run the install with
--join, giving limactl's absolute path, and paste the invite when it asks:It reads the invite from the terminal, never from an argument, so
psand shell history never hold it. It checks the invite's form and every other input before it changes anything. -
The Mac prints a fingerprint. If the laptop shows the same fingerprint and the right name, approve on the laptop. The laptop signs the runner's host certificate and records the runner in
client.json. -
Wait for the install to finish. The runner creates and starts its VM and checks its egress; the install prints the check lines and either
egress self-check passed=trueorstart-up egress self-check failed. It exits 0 only when the check passed. A firstpassed=falseisn't final: the runner recreates the VM and checks again.
Options¶
- If you want the egress self-check to prove jobs can't reach a different
tailnet machine, add
--tailnet-peer ADDR; pick one that is up. On a runner that has already joined it works without--join. - If you want to limit which registries jobs pull from, add
--registries FILE, onehost[:port]per line (#comments allowed). To return to the defaults, deleteregistriesfrom the state directory and rerun. - If you want to use a host key you made, add
--host-key FILE, withFILE.pubbeside it. A different key needs a new join.
Upgrade a Mac runner¶
Run the new binary's ./allmyram install with no flags; the ones you gave
before are kept. It stops the agent, which stops the VM, copies the new
binary into place and starts the agent again. The runner then recreates the
VM from the cached image, which downloads nothing. The job data disk is
kept.
The host certificate renews itself as on Linux; after a long absence, run
allmyram renew macbook on the laptop.
Rejoin a Mac runner¶
Pass --join again, with a fresh allmyram invite. --join is never
remembered. A failed rejoin that changed nothing starts the runner again
with its previous trust.
A Mac installed before joins existed keeps its old runner.json, which the
runner refuses, and no agent, until it joins. The join removes the old
ca.pub, runner-host-key-cert.pub, allowed-clients and
tailnet-peer. install no longer takes --ca-pub, --host-cert or
--allowed.
Remove a Mac runner¶
- On the laptop:
allmyram remove macbook. -
On the Mac, stop the agent:
-
Wait until the runner has stopped its VM, which can take 2 minutes after
bootoutreturns. Both must hold: the first command fails, and the second prints nothing. -
Remove the files:
Removing the state directory while the VM still runs leaves a VM process with nothing to stop it. Nothing else on the Mac was changed.
The job data disk won't mount¶
Every VM start fails its service check, and runner.log says the VM's
allmyram services are not active. The data disk outlives every recreate of
the VM, so a damaged filesystem on it stays damaged. It holds only running
workspaces and caches, so delete it and let the runner make a blank one.
-
Stop the runner and wait until it has stopped the VM, as in Remove a Mac runner:
launchctl printfails andpgrepprints nothing. -
Delete the VM and the disk. The VM's config names the disk, so both go. Use the
limactlyou gave--limactl. -
Start the runner again. It creates the VM and a blank disk, which the VM formats at its first boot.