Mac runner¶
What allmyram install sets up on an Apple-silicon Mac, the VM the runner
keeps, and how the Linux setup inside that VM differs from a Linux runner.
To install one, see How to add a Mac runner.
Processes¶
| Process | Runs as | Does |
|---|---|---|
allmyram runner |
the Mac's owner, as the LaunchAgent name.allmyram.runner |
serves clients over tailcat, keeps run records and repos, and creates, starts, stops and recreates the VM |
| Lima's host agent and the VM | the Mac's owner | one Lima VM (Garden Linux arm64, vz) in the runner's own Lima home |
allmyram-warden, allmyram proxy, containerd |
in the VM | the Linux runner's sandbox side; see Inside the VM |
Nothing runs as root on the Mac, and nothing outside ~/Library changes.
The runner calls limactl by the absolute path it was installed with, never
through PATH or ~/.lima, so any other Lima on the Mac is untouched.
Files¶
The state directory is ~/Library/Application Support/allmyram.
| Path | Purpose |
|---|---|
bin/allmyram |
the runner: a copy of the binary install ran from |
runner.json |
runner config, mode 0600 |
runner-host-key, .pub |
the runner's SSH host key |
host-cert.pub, revocations |
what the join saves |
trust.json |
the owner key, the allowed client node keys and the egress check's tailnet peer, mode 0600; owned by the Mac's owner, as the rest of the directory is |
runner-name, limactl, registries |
the flags given to install, kept so a rerun can omit them |
repos/ |
pushed repos |
cache/ |
the VM image, downloaded once and checked against its pin |
vm-bin/ |
what the runner hands the VM: its linux/arm64 binaries and warden.json, assembled at each start from what the runner binary carries |
lima/ |
the VM's LIMA_HOME, including the job data disk |
vm-share/ |
the share: the one Mac directory the VM sees |
~/Library/LaunchAgents/name.allmyram.runner.plist |
the agent: KeepAlive, and ExitTimeOut 150 s so the runner can stop its jobs and the VM on the way down |
~/Library/Logs/allmyram/runner.log |
the runner's stdout and stderr |
The runner adds run records, its tailcat identity and the VM's files when it runs.
The VM¶
- Image. A Garden Linux disk image pinned by URL and sha512 in the
binary. The runner downloads it the first time, checks it, keeps it in
cache/and looks there first. See Mac VM image. - Binaries. The runner's own linux/arm64
allmyramandallmyram-warden, embedded in the darwin binary, and the warden'swarden.jsonreach the VM through the share at every boot. The VM checks them before the warden and the proxy start. - Lifecycle. The runner starts the VM when it starts and for a job when
it is stopped, and stops it after
vm_idle_stop(5 minutes) with no runs. It recreates the VM from the cached image when the VM is broken, when its template changed (a new binary or image pin, so every upgrade), after any stop that wasn't a clean shutdown, and after a failed start-up egress self-check, which it then runs again. - Size.
vm_cpus(default 4) andvm_memory(default8GiB) inrunner.json. - Job data disk. A 100 GiB sparse Lima disk,
allmyram-data, formatted XFS in the VM and mounted at/var/lib/allmyram/warden. Lima keeps it apart from the instance, so it survives a recreate. - Network. The runner forwards the warden's socket out of the VM to
lima/warden.sock. No change is made to the Mac's firewall.
Inside the VM¶
The VM runs deploy/linux's units, egress rules and CNI network, built
into its image; install.sh doesn't set the VM up, and install.sh --vm
refuses and says so. What differs from a Linux runner:
- The share. The Mac's
vm-share/, mounted by virtiofs at/var/lib/allmyram/share. The warden's staging and logs arestaging/andlogs/under it, and the runner writespods/<pod ip>files naming each pod's run. The share enforces no permissions in the VM (every entry reads0:0; experiment 18), so there is noallmyram-stagegroup and no setgid staging./var/lib/allmyram, above the mount point, is0750 root:allmyram-share, a group of just the warden and the proxy, which keeps other VM processes off the share. - The proxy.
allmyram-proxy.servicerunsallmyram proxy --listen 10.78.0.1:3128 --pods <share>/podsasallmyram-proxy, which reaches the share throughallmyram-share. It isn't inallmyram-warden, containerd's socket group, and its unit hides/run/containerd. - The warden.
allowed_uidis0: Lima's guest agent, as root, forwards the warden's socket to the Mac, so it is the one caller.warden.jsonsets"in_runner_vm": true, the only setting under which the warden acceptsallowed_uid0. The drop-inallmyram-warden.service.d/vm.confreplacesSupplementaryGroups=withallmyram-share, clearsInaccessiblePaths=, and grantsCAP_CHOWN,CAP_FOWNERandCAP_DAC_OVERRIDE(CapabilityBoundingSet=andAmbientCapabilities=), which the warden needs to copy workspaces; it already holds containerd's root-equivalent socket. - The workspaces. gVisor checks mode bits itself and refuses a job that
isn't root a workspace on the share. The warden's
workspace_rootis/var/lib/allmyram/warden/workspaceson the job data disk (0711 allmyram-warden). Create copies a run's staged workspace there, never following a symlink, gives every entry to the job's uid and gid with its permission bits, and removes the staged copy; Stop removes the workspace. When the warden starts, it removes every workspace whose run has no pod: a VM stopped under a run leaves workspaces only the VM can delete. - The job's user. Jobs run as
allmyram-job, an unprivileged system user (the warden'srunner_uidandrunner_gid).
Not yet on a Mac¶
- Scratch pads: a Mac runner refuses jobs that ask for pads, and a
runner.jsonthat configures them. - Host readings in heartbeats: a Mac sends runner, shipper and run metrics only.
allmyram install¶
| Flag | Meaning |
|---|---|
--join |
join by invite, read from the terminal or one line of stdin, never an argument, so ps and shell history never hold it; never kept |
--limactl PATH |
absolute path of limactl, Lima 2.3 or later |
--name NAME |
runner name; default the short host name, lowercased |
--host-key FILE |
use this host key and FILE.pub; a new key needs a new join |
--tailnet-peer ADDR |
a tailnet machine that is up, for the egress self-check to prove jobs can't reach; kept in trust.json until a rejoin without it, which goes back to the laptop's; without --join, only on a runner that has joined |
--registries FILE |
registry allowlist, one host[:port] per line (# comments allowed), given to the VM's warden |
--limactl, --name, --host-key and --registries are kept for reruns. install waits up
to 5 minutes for the runner's egress self-check. It exits 0 when the check
passed; 1 on a failed join, a failed check (after the runner rebuilt the VM
and checked again), a stopped agent, no verdict in 5 minutes, or any other
failure; and 2 when the runner hasn't joined.
runner.json on a Mac¶
install writes it with "backend": "lima". The runner refuses a Mac
runner.json that sets any of these:
| Field | Why |
|---|---|
staging_root, warden_socket |
derived from state_dir |
workspace_root |
the warden keeps workspaces on the VM's disk, out of the runner's reach |
proxy_listen |
the proxy runs in the VM |
jobs_cgroup, warden_cgroup |
the cgroups are in the VM, where the runner can't read them |
pads_root, pads_free_floor_bytes |
a Mac runner has no scratch pads yet |
vm_bin_dir |
the runner binary carries the VM's binaries |
state_dir and limactl must be absolute. The Mac adds:
| Field | Default | Meaning |
|---|---|---|
limactl |
required | absolute path of limactl |
vm_cpus |
4 | the VM's CPUs |
vm_memory |
8GiB |
the VM's memory, a Lima size |
vm_idle_stop |
5m |
how long the VM stays up once no run has a sandbox |