Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Code

527 commit(s) on main

Put job execution behind an interface Keenan Nemetz · 2h ago de3eec16
source preview history blame raw 12.0 KiB
1# Deploy on macOS
2
3## Pick a service
4
5There are two ways to run `vole serve` on a Mac, and they have different limits.
6
7| | LaunchAgent | LaunchDaemon |
8|---|---|---|
9| Started by | `brew services start vole` | a plist you install in `/Library/LaunchDaemons` |
10| Runs | as your account | as a service account (`_vole`) |
11| On logout | stops | keeps running |
12| Privileged ports (below 1024) | no | yes |
13| Ships with | the Homebrew formula's `service` block | not yet — install the plist below |
14
15Start with the LaunchAgent. It is one command, it runs as you, and its data is
16yours. Choose a LaunchDaemon when the forge must outlive your login session or
17bind a privileged port without running as root.
18
19## Install with Homebrew
20
21The tap is hosted on the Rodent Software forge, not GitHub, so Homebrew has to be
22told the clone URL rather than guessing GitHub:
23
24```sh
25brew tap rodent-software/homebrew-tap https://rodent.software/homebrew-tap.git
26brew install vole
27vole version
28```
29
30The formula installs the `vole` binary and a LaunchAgent service:
31
32```sh
33brew services start vole
34brew services stop vole
35brew upgrade vole
36```
37
38A LaunchAgent serves on the default loopback addresses — HTTP on
39`127.0.0.1:8080` and SSH on `127.0.0.1:2222` — and stops when you log out. Put the
40[system sshd in front of Vole](#put-sshd-in-front-of-vole) for a portless
41clone URL, or a proxy in front of HTTP for TLS.
42
43If `git --version` opens a dialog offering to install the command line tools,
44run `xcode-select --install` first. The dialog is a macOS shim, not Vole; the
45formula declares `depends_on "git"` and Homebrew installs Git itself.
46
47## Where things live
48
49The Homebrew formula installs only the binary, so the instance state is yours to
50choose. The conventional layout matches the Linux package but under the Homebrew
51prefix, which is `/opt/homebrew` on Apple Silicon and `/usr/local` on Intel
52(`brew --prefix` prints it):
53
54```text
55<prefix>/bin/vole the binary
56<prefix>/etc/vole/vole.toml your configuration
57<prefix>/var/vole/ the instance: repositories, database, LFS
58```
59
60`vole admin init --dir .` also works in a plain directory, for a laptop forge that
61lives next to the repository it hosts. The prefix layout above is the choice to
62make when Vole is the machine's service rather than one project's tool.
63
64## Run as a LaunchDaemon
65
66A LaunchAgent cannot bind a privileged port and dies with your session. For a
67machine-wide forge, install a LaunchDaemon that runs `vole serve` as a dedicated
68`_vole` account.
69
70Create the service account and its data directory first. Pick an unused system
71UID — macOS service accounts live in the low hundreds; `dscl . -list /Users
72UniqueID | sort -n -k2` shows what is taken. `350` is used here:
73
74```sh
75sudo dscl . -create /Users/_vole
76sudo dscl . -create /Users/_vole UniqueID 350
77sudo dscl . -create /Users/_vole PrimaryGroupID 20
78sudo dscl . -create /Users/_vole RealName "Vole service"
79uuid=$(uuidgen)
80sudo dscl . -create /Users/_vole GeneratedUID "$uuid"
81sudo dscl . -create /Users/_vole NFSHomeDirectory /var/vole
82sudo dscl . -create /Users/_vole UserShell /usr/bin/false
83sudo mkdir -p /var/vole
84sudo chown _vole:staff /var/vole
85```
86
87`dscl` does not add the record to its group or set a password, which is what you
88want: `_vole` has no login shell, no password, and no home directory it can write
89outside `/var/vole` — launchd runs it directly without a login. It is the account
90`vole serve` runs as, so it owns the repositories, the database, and the SSH host
91key. The `git` account (created when you enable the
92[sshd front door](#put-sshd-in-front-of-vole)) reaches only the socket
93directory, not this data.
94
95Install the plist at `/Library/LaunchDaemons/software.rodent.vole.plist`:
96
97```xml
98<?xml version="1.0" encoding="UTF-8"?>
99<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
100 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
101<plist version="1.0">
102<dict>
103 <key>Label</key>
104 <string>software.rodent.vole</string>
105 <key>ProgramArguments</key>
106 <array>
107 <string>/opt/homebrew/bin/vole</string>
108 <string>serve</string>
109 <string>--config</string>
110 <string>/opt/homebrew/etc/vole/vole.toml</string>
111 </array>
112 <key>UserName</key>
113 <string>_vole</string>
114 <key>GroupName</key>
115 <string>staff</string>
116 <key>WorkingDirectory</key>
117 <string>/var/vole</string>
118 <key>RunAtLoad</key>
119 <true/>
120 <key>KeepAlive</key>
121 <true/>
122 <key>StandardOutPath</key>
123 <string>/var/log/vole.log</string>
124 <key>StandardErrorPath</key>
125 <string>/var/log/vole.log</string>
126</dict>
127</plist>
128```
129
130On an Intel Mac, `/opt/homebrew/bin/vole` is `/usr/local/bin/vole`; use
131`brew --prefix` to get the right value. Load it:
132
133```sh
134sudo cp software.rodent.vole.plist /Library/LaunchDaemons/
135sudo launchctl bootstrap system /Library/LaunchDaemons/software.rodent.vole.plist
136sudo launchctl kickstart -k system/software.rodent.vole
137```
138
139Stop and unload with `sudo launchctl bootout system/software.rodent.vole`.
140
141## Serve HTTPS with socket activation
142
143ACME needs port 80 (HTTP-01) or 443 (TLS-ALPN-01), and macOS refuses ports below
1441024 to a non-root process. The answer is **socket activation**: a LaunchDaemon
145owns 80 and 443 as root and hands the ready sockets to `vole serve`, which keeps
146running unprivileged. The same mechanism is systemd's `LISTEN_FDS`, so one code
147path serves both operating systems.
148
149`serve` reads `LISTEN_FDS`/`LISTEN_PID` (and launchd's `Listeners`) at startup.
150When inherited descriptors are present it serves HTTP and HTTPS from them instead
151of binding `http_addr`/`https_addr`; when they are absent it binds exactly as a
152hand-run or containerized instance always has. The ACME cache, challenge handler,
153and certificate manager do not care which descriptor is underneath them.
154
155Install the daemon that owns the sockets. `share/launchd/software.rodent.vole.plist`
156in the tap is a `Sockets` block for 80 and 443; copy it to
157`/Library/LaunchDaemons/`, set the `_vole` account, and load it:
158
159```sh
160sudo cp software.rodent.vole.plist /Library/LaunchDaemons/
161sudo launchctl bootstrap system /Library/LaunchDaemons/software.rodent.vole.plist
162```
163
164With it loaded, `vole.toml` names the privileged ports and the daemon delivers
165them:
166
167```toml
168http_addr = ":80"
169https_addr = ":443"
170acme_email = "admin@example.com"
171acme_domains = ["forge.example.com"]
172```
173
174`vole serve` never runs as root. A LaunchAgent cannot own a privileged socket, so
175`brew services` keeps serving the unprivileged loopback addresses; the daemon is
176the HTTPS path. The trade-offs that chose this arrangement over running as root or
177putting a terminator proxy in front are the three options worth naming: root gives
178up the unprivileged property, and a proxy contradicts one binary to operate.
179
180## What launchd does not give you
181
182!!! warning "launchd has no service sandbox"
183 The Linux package hardens `vole.service` with `ProtectSystem=strict`,
184 `PrivateTmp`, `PrivateDevices`, `NoNewPrivileges`, and a
185 `RestrictAddressFamilies` list. launchd has no equivalent. On a Mac the
186 `_vole` account and its file modes are the boundary.
187
188The Linux package hardens `vole.service` with systemd's sandboxing:
189`ProtectSystem=strict`, `PrivateTmp`, `PrivateDevices`, `NoNewPrivileges`, and a
190`RestrictAddressFamilies` list. launchd has **no equivalent** for any of these. A
191macOS service is sandboxed by two things only:
192
193- **the account it runs as** (`_vole`, not root), and
194- **file modes** — `vole` sets a restrictive umask and writes its own secrets at
195 `0600`, but nothing stops the process from reading or writing whatever that
196 account can reach.
197
198There is no read-only root, no private `/tmp`, no capability drop, and no way to
199restrict the socket families the process can open. Treat the `_vole` account's
200reach as the boundary, the same way the Linux package treats its capability set,
201and keep anything you do not want the forge to touch out of `/var/vole` and out
202of that account's reach.
203
204## Put sshd in front of Vole (optional) {: #put-sshd-in-front-of-vole }
205
206Vole's own SSH listener answers on 2222, so every clone URL carries `:2222`.
207Letting the system sshd authenticate and hand the session to Vole removes the
208port and keeps one SSH endpoint on the host.
209
210This page covers the full macOS deployment. The `Match` block is the same as on
211Linux; everything around it is not.
212The release still attaches `vole-darwin-sshd.conf`, but `vole ssh-config` renders
213the drop-in with the real binary and config paths, which is what a Homebrew
214install needs:
215
216```sh
217vole ssh-config --platform darwin > vole.conf
218less vole.conf
219sudo install -m 0644 vole.conf /etc/ssh/vole.conf
220```
221
222Render and inspect the file before installing it. The header carries the macOS
223steps; the `--vole`, `--config`, and `--socket` flags replace the defaults it
224names.
225
2261. Enable Remote Login and append one line at the **end** of `/etc/ssh/sshd_config`:
227
228 ```sh
229 sudo systemsetup -setremotelogin on
230 echo 'Include /etc/ssh/vole.conf' | sudo tee -a /etc/ssh/sshd_config
231 ```
232
2332. Check and reload sshd:
234
235 ```sh
236 sudo sshd -t && sudo launchctl kickstart -k system/com.openssh.sshd
237 ```
238
2393. Install the shell wrapper and create the forced-command account. The account's
240 login shell has to exec exactly one thing, so a three-line wrapper hands off to
241 `vole ssh-shell`. Put it where the drop-in names it, pointing at your prefix
242 (`/usr/local` for a system install, `/opt/homebrew` for Homebrew on Apple
243 Silicon):
244
245 ```sh
246 sudo mkdir -p /usr/local/lib/vole
247 printf '#!/bin/sh\nexec /usr/local/bin/vole ssh-shell "$@"\n' | sudo tee /usr/local/lib/vole/ssh-shell
248 sudo chmod 0755 /usr/local/lib/vole/ssh-shell
249 sudo sysadminctl -addUser git -fullName "Vole git" -shell /usr/local/lib/vole/ssh-shell
250 ```
251
252 Then set the three settings in `vole.toml` and put `ssh_socket` where both
253 accounts can reach it.
254
2554. Decide the socket directory's group. macOS has no `/run` or tmpfiles, so the
256 operator creates the shared directory. Use one shared group: create it, put
257 the service account (`_vole`) and `git` in it, and make the directory
258 `_vole:git` with setgid so the socket inherits the group:
259
260 ```sh
261 sudo dseditgroup -o create -r "Vole front door" vole
262 sudo dseditgroup -o edit -a _vole -t user vole
263 sudo dseditgroup -o edit -a git -t user vole
264 sudo mkdir -p /usr/local/var/vole
265 sudo chown _vole:git /usr/local/var/vole
266 sudo chmod 2770 /usr/local/var/vole
267 ```
268
269 `ssh_socket` then names `/usr/local/var/vole/ssh.sock`, and the socket's `0660`
270 is reachable by both because setgid carries the shared group onto it. A single
271 shared group is the simple answer; a `vole`/`git` pair adds nothing here
272 because only these two accounts ever touch the socket.
273
2745. Restart Vole the way you started it.
275
276`AuthorizedKeysCommandUser` is the account `vole serve` runs as. Start the
277service with the LaunchAgent or LaunchDaemon in
278[Deploy Vole on macOS](macos.md).
279
280`vole whoami` returning your account name means sshd resolved your key to it and
281the forced command reached the service.
282
283The port disappears from every remote the same way, because they all use the same
284SSH endpoint. A command that acts on a repository names it in the URL;
285`vole admin` and `vole runner` name only the instance:
286
287```sh
288vole whoami --role --remote ssh://forge.example.com/demo.git
289vole secret list demo --remote ssh://forge.example.com/demo.git
290vole change show 42 --remote ssh://forge.example.com/demo.git
291vole run list --remote ssh://forge.example.com/demo.git
292vole admin --remote ssh://forge.example.com account invite admin
293vole runner --remote ssh://forge.example.com
294```
295
296Inside a clone, `--remote origin` is the shorter form of the repository ones.
297
298A `:2222` in an example elsewhere on this site belongs to Vole's own listener;
299drop it for an instance whose sshd is the front door.
300
301## CI runners on macOS
302
303Vole does not ship a macOS runner service. Run the runner on a separate Linux
304machine and point it at this instance; see [Set up a runner on Linux](linux.md#set-up-a-runner-on-linux).
305
306## Next
307
308- [Deploy on Windows](windows.md) — the MSI and Windows service.
309- [Runners](../runner.md) — register a runner on a Linux host.
310- [Configuration](../configuration.md) — the full `vole.toml` surface.
311