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.

Blame · docs/deploy/macos.md

Line attribution on main · 310 line(s)

d1f44d83
Keenan Nemetz
21h ago
1 # Deploy on macOS
75478a9d
Keenan Nemetz
3d ago
2
3 ## Pick a service
4
5 There 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
15 Start with the LaunchAgent. It is one command, it runs as you, and its data is
16 yours. Choose a LaunchDaemon when the forge must outlive your login session or
17 bind a privileged port without running as root.
18
19 ## Install with Homebrew
20
21 The tap is hosted on the Rodent Software forge, not GitHub, so Homebrew has to be
22 told the clone URL rather than guessing GitHub:
23
24 ```sh
25 brew tap rodent-software/homebrew-tap https://rodent.software/homebrew-tap.git
26 brew install vole
27 vole version
28 ```
29
30 The formula installs the `vole` binary and a LaunchAgent service:
31
32 ```sh
33 brew services start vole
34 brew services stop vole
35 brew upgrade vole
36 ```
37
38 A 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
d1f44d83
Keenan Nemetz
21h ago
40 [system sshd in front of Vole](#put-sshd-in-front-of-vole) for a portless
75478a9d
Keenan Nemetz
3d ago
41 clone URL, or a proxy in front of HTTP for TLS.
42
43 If `git --version` opens a dialog offering to install the command line tools,
44 run `xcode-select --install` first. The dialog is a macOS shim, not Vole; the
45 formula declares `depends_on "git"` and Homebrew installs Git itself.
46
47 ## Where things live
48
49 The Homebrew formula installs only the binary, so the instance state is yours to
50 choose. The conventional layout matches the Linux package but under the Homebrew
51 prefix, 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
61 lives next to the repository it hosts. The prefix layout above is the choice to
62 make when Vole is the machine's service rather than one project's tool.
63
64 ## Run as a LaunchDaemon
65
66 A LaunchAgent cannot bind a privileged port and dies with your session. For a
67 machine-wide forge, install a LaunchDaemon that runs `vole serve` as a dedicated
68 `_vole` account.
69
70 Create the service account and its data directory first. Pick an unused system
71 UID — macOS service accounts live in the low hundreds; `dscl . -list /Users
72 UniqueID | sort -n -k2` shows what is taken. `350` is used here:
73
74 ```sh
75 sudo dscl . -create /Users/_vole
76 sudo dscl . -create /Users/_vole UniqueID 350
77 sudo dscl . -create /Users/_vole PrimaryGroupID 20
78 sudo dscl . -create /Users/_vole RealName "Vole service"
79 uuid=$(uuidgen)
80 sudo dscl . -create /Users/_vole GeneratedUID "$uuid"
81 sudo dscl . -create /Users/_vole NFSHomeDirectory /var/vole
82 sudo dscl . -create /Users/_vole UserShell /usr/bin/false
83 sudo mkdir -p /var/vole
84 sudo 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
88 want: `_vole` has no login shell, no password, and no home directory it can write
89 outside `/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
91 key. The `git` account (created when you enable the
d1f44d83
Keenan Nemetz
21h ago
92 [sshd front door](#put-sshd-in-front-of-vole)) reaches only the socket
75478a9d
Keenan Nemetz
3d ago
93 directory, not this data.
94
95 Install 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>
d1f44d83
Keenan Nemetz
21h ago
115 <string>staff</string>
75478a9d
Keenan Nemetz
3d ago
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
130 On 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
134 sudo cp software.rodent.vole.plist /Library/LaunchDaemons/
135 sudo launchctl bootstrap system /Library/LaunchDaemons/software.rodent.vole.plist
136 sudo launchctl kickstart -k system/software.rodent.vole
137 ```
138
139 Stop and unload with `sudo launchctl bootout system/software.rodent.vole`.
140
54ccf66e
Keenan Nemetz
3d ago
141 ## Serve HTTPS with socket activation
142
143 ACME needs port 80 (HTTP-01) or 443 (TLS-ALPN-01), and macOS refuses ports below
144 1024 to a non-root process. The answer is **socket activation**: a LaunchDaemon
145 owns 80 and 443 as root and hands the ready sockets to `vole serve`, which keeps
146 running unprivileged. The same mechanism is systemd's `LISTEN_FDS`, so one code
147 path serves both operating systems.
148
149 `serve` reads `LISTEN_FDS`/`LISTEN_PID` (and launchd's `Listeners`) at startup.
150 When inherited descriptors are present it serves HTTP and HTTPS from them instead
151 of binding `http_addr`/`https_addr`; when they are absent it binds exactly as a
152 hand-run or containerized instance always has. The ACME cache, challenge handler,
153 and certificate manager do not care which descriptor is underneath them.
154
155 Install the daemon that owns the sockets. `share/launchd/software.rodent.vole.plist`
156 in 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
160 sudo cp software.rodent.vole.plist /Library/LaunchDaemons/
161 sudo launchctl bootstrap system /Library/LaunchDaemons/software.rodent.vole.plist
162 ```
163
164 With it loaded, `vole.toml` names the privileged ports and the daemon delivers
165 them:
166
167 ```toml
168 http_addr = ":80"
169 https_addr = ":443"
170 acme_email = "admin@example.com"
171 acme_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
176 the HTTPS path. The trade-offs that chose this arrangement over running as root or
177 putting a terminator proxy in front are the three options worth naming: root gives
178 up the unprivileged property, and a proxy contradicts one binary to operate.
179
75478a9d
Keenan Nemetz
3d ago
180 ## What launchd does not give you
181
d1f44d83
Keenan Nemetz
21h ago
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
75478a9d
Keenan Nemetz
3d ago
188 The 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
191 macOS 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
198 There is no read-only root, no private `/tmp`, no capability drop, and no way to
199 restrict the socket families the process can open. Treat the `_vole` account's
200 reach as the boundary, the same way the Linux package treats its capability set,
201 and keep anything you do not want the forge to touch out of `/var/vole` and out
202 of that account's reach.
203
d1f44d83
Keenan Nemetz
21h ago
204 ## Put sshd in front of Vole (optional) {: #put-sshd-in-front-of-vole }
205
206 Vole's own SSH listener answers on 2222, so every clone URL carries `:2222`.
207 Letting the system sshd authenticate and hand the session to Vole removes the
208 port and keeps one SSH endpoint on the host.
209
210 This page covers the full macOS deployment. The `Match` block is the same as on
211 Linux; everything around it is not.
212 The release still attaches `vole-darwin-sshd.conf`, but `vole ssh-config` renders
213 the drop-in with the real binary and config paths, which is what a Homebrew
214 install needs:
215
216 ```sh
217 vole ssh-config --platform darwin > vole.conf
218 less vole.conf
219 sudo install -m 0644 vole.conf /etc/ssh/vole.conf
220 ```
221
222 Render and inspect the file before installing it. The header carries the macOS
223 steps; the `--vole`, `--config`, and `--socket` flags replace the defaults it
224 names.
225
226 1. 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
233 2. Check and reload sshd:
234
235 ```sh
236 sudo sshd -t && sudo launchctl kickstart -k system/com.openssh.sshd
237 ```
238
239 3. 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
255 4. 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
274 5. Restart Vole the way you started it.
275
276 `AuthorizedKeysCommandUser` is the account `vole serve` runs as. Start the
277 service 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
281 the forced command reached the service.
282
283 The port disappears from every remote the same way, because they all use the same
284 SSH 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
288 vole whoami --role --remote ssh://forge.example.com/demo.git
289 vole secret list demo --remote ssh://forge.example.com/demo.git
290 vole change show 42 --remote ssh://forge.example.com/demo.git
291 vole run list --remote ssh://forge.example.com/demo.git
292 vole admin --remote ssh://forge.example.com account invite admin
293 vole runner --remote ssh://forge.example.com
294 ```
295
296 Inside a clone, `--remote origin` is the shorter form of the repository ones.
297
298 A `:2222` in an example elsewhere on this site belongs to Vole's own listener;
299 drop it for an instance whose sshd is the front door.
300
301 ## CI runners on macOS
302
303 Vole does not ship a macOS runner service. Run the runner on a separate Linux
304 machine and point it at this instance; see [Set up a runner on Linux](linux.md#set-up-a-runner-on-linux).
305
75478a9d
Keenan Nemetz
3d ago
306 ## Next
307
d1f44d83
Keenan Nemetz
21h ago
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.