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.

Rewrite documentation around reader tasks

d1f44d838966c0a4762073f12375ec7562582fdf · Keenan Nemetz · 21h ago · parent 9103f6a8

docs/deploy/index.md −408

@@ -1,408 +0,0 @@
1 # Deploy a server
2
3 Deploy Vole on one Ubuntu 24.04 or Debian 13 machine. For Windows, see
4 [Deploy on Windows](windows.md); for a Mac, see [Deploy on macOS](macos.md). The cloud-init procedure
5 installs the package, writes the public configuration, creates the first instance
6 admin, and starts the service. Use the
7 [existing-machine procedure](#use-an-existing-machine) when the server is already
8 running.
9
10 ## What you need
11
12 - A DNS name such as `forge.example.com` that you can point at the server.
13 - The SSH public key for the first instance admin.
14 - The release `.deb` URL for the server's architecture. Copy it from the
15 [current stable release](https://rodent.software/vole/channels/stable).
16 - A Vole source checkout and an [installed Vole binary](../install.md) on your
17 computer for rendering and remote administration.
18 - `envsubst`, provided by `gettext-base` on Debian and Ubuntu or `gettext`
19 elsewhere.
20
21 Account names are permanent. Choose the admin name before rendering the file.
22
23 ## 1. Render the first-boot file
24
25 From the source checkout:
26
27 ```sh
28 cd deploy/cloud-init
29
30 HOSTNAME=forge.example.com \
31 ADMIN_ACCOUNT=admin \
32 ADMIN_EMAIL=you@example.com \
33 ADMIN_SSH_KEY="$(cat ~/.ssh/id_ed25519.pub)" \
34 SSH_PORT=22 \
35 VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \
36 ./render.sh > user-data.yaml
37 ```
38
39 `SSH_PORT=22` puts the system sshd in front of Vole, which is what makes every
40 clone URL portless. Omit it to use Vole's own listener on 2222 instead; the rest
41 of this page works either way, and
42 [Put sshd in front of Vole](#put-sshd-in-front-of-vole) says what changes.
43
44 Inspect `user-data.yaml` before giving it to a provider. It contains the public
45 SSH key, package URL, and complete first-boot configuration.
46
47 | Variable | Default | Purpose |
48 |---|---|---|
49 | `HOSTNAME` | required | DNS name used for `public_url` and passkeys |
50 | `ADMIN_ACCOUNT` | required | Permanent name of the first instance admin |
51 | `ADMIN_SSH_KEY` | required | That account's public key |
52 | `VOLE_PACKAGE_URL` | required | Debian package URL from the [current stable release](https://rodent.software/vole/channels/stable) |
53 | `ADMIN_EMAIL` | empty | Contact address for the certificate authority |
54 | `INSTANCE_NAME` | `Vole` | Display name for this forge |
55 | `TLS_MODE` | `acme` | `acme` manages certificates; `proxy` serves loopback HTTP for your TLS proxy |
56 | `SSH_PORT` | `2222` | `22` lets the system sshd authenticate and drops the port from clone URLs; anything else is Vole's own listener |
57
58 For `TLS_MODE=proxy`, configure the proxy and client-IP header as described in
59 [Running behind a proxy](../configuration.md#running-behind-a-proxy).
60
61 ## 2. Create the machine
62
63 A small team can start with 2 vCPU, 4 GB of memory, and 40 GB of disk. Increase
64 disk for large repositories, LFS objects, and CI artifacts. Give the server a
65 public IPv4 address and enable provider backups.
66
67 Paste `user-data.yaml` into the provider's user-data field:
68
69 | Provider | Suggested image and size | User-data location |
70 |---|---|---|
71 | Hetzner Cloud | Ubuntu 24.04, CX22 | **Add Server → Cloud config** |
72 | DigitalOcean | Ubuntu 24.04 LTS x64, Basic 2 vCPU / 4 GB | **Create Droplet → Advanced options → User data** |
73 | AWS | Canonical Ubuntu 24.04 LTS, `t3.medium`, 40 GiB encrypted gp3 | **Launch instance → Advanced details → User data** |
74
75 On AWS, use a public subnet with auto-assigned public IPv4. Debian 13 is also
76 supported on Hetzner and DigitalOcean. Provider names and console layouts can
77 change; the requirement is an Ubuntu or Debian machine that accepts cloud-init
78 user data.
79
80 ## 3. Open the required ports
81
82 | Direction | TCP port | Allowed source | Purpose |
83 |---|---:|---|---|
84 | Inbound | 22 | Your administrators | Shell access, and Git over SSH when sshd is the front door |
85 | Inbound | 2222 | People who push | Vole Git over SSH when Vole's own listener serves it |
86 | Inbound | 80 | Anywhere | ACME challenge and HTTPS redirect |
87 | Inbound | 443 | Anywhere | Forge over HTTPS |
88 | Outbound | any | Package and certificate providers | Installation and renewal |
89
90 With `SSH_PORT=22` there is no inbound 2222 to open: sshd already answers on 22,
91 and Vole is reached only through it and over the local socket. Keep 2222 closed
92 unless you also run the built-in listener.
93
94 Use the provider firewall or AWS security group. Hetzner and DigitalOcean servers
95 can be open until a firewall is attached; AWS instances normally require inbound
96 rules. For `TLS_MODE=proxy`, expose only the ports your arrangement needs and
97 keep Vole's HTTP listener on loopback.
98
99 ## 4. Point DNS at the server
100
101 Create an `A` record for `forge.example.com` with the machine's public IPv4
102 address. Vole cannot obtain a certificate until this name resolves to the server.
103
104 Cloud-init runs only on first boot. Setup output is written to
105 `/var/log/vole-first-boot.log`; service output is available with
106 `journalctl -u vole`.
107
108 ## 5. Verify and enroll the admin
109
110 Open `https://forge.example.com`. The first request can take a few seconds while
111 Vole obtains its certificate.
112
113 From your computer, issue the admin's one-time passkey enrollment link:
114
115 ```sh
116 vole admin --remote ssh://git@forge.example.com:2222 account invite admin
117 ```
118
119 With `SSH_PORT=22` the remote is `ssh://git@forge.example.com` — no port. The
120 examples below keep `:2222` for the built-in listener; drop it for the front
121 door.
122
123 Open the link in a private browser window and register a passkey. Then create and
124 clone a repository:
125
126 ```sh
127 vole admin --remote ssh://git@forge.example.com:2222 \
128 repo create demo
129 vole admin --remote ssh://git@forge.example.com:2222 \
130 acl set-default-role demo read
131 git clone ssh://git@forge.example.com:2222/demo.git
132 ```
133
134 Omit `set-default-role` if `demo` should remain private.
135
136 ## Use an existing machine
137
138 Install Vole with the
139 [Debian or Ubuntu package repository](../install.md#debian-or-ubuntu), then
140 return here to configure the server.
141
142 Write `/etc/vole/vole.toml`:
143
144 ```toml
145 data_dir = "/var/lib/vole/data"
146 http_addr = ":80"
147 https_addr = ":443"
148 public_url = "https://forge.example.com"
149 acme_email = "you@example.com"
150 ssh_addr = "0.0.0.0:2222"
151 ```
152
153 The hardened unit needs one capability to bind ports 80 and 443:
154
155 ```sh
156 sudo install -d -m 0755 /etc/systemd/system/vole.service.d
157 sudo tee /etc/systemd/system/vole.service.d/bind.conf >/dev/null <<'EOF'
158 [Service]
159 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
160 AmbientCapabilities=CAP_NET_BIND_SERVICE
161 EOF
162 sudo systemctl daemon-reload
163 ```
164
165 Copy your public key to the server, then create the admin and start Vole:
166
167 ```sh
168 sudo -u vole vole admin --config /etc/vole/vole.toml \
169 account create admin --key /tmp/your-key.pub --role admin
170 sudo systemctl enable --now vole
171 ```
172
173 Return to [Point DNS at the server](#4-point-dns-at-the-server) and continue.
174 For a proxy setup, leave `https_addr` empty, use
175 `http_addr = "127.0.0.1:8080"`, and follow
176 [Running behind a proxy](../configuration.md#running-behind-a-proxy).
177
178 ## Put sshd in front of Vole
179
180 Vole's own SSH listener answers on 2222 so it does not fight sshd, and every clone
181 URL then carries `:2222`. The other arrangement is to let the system sshd do the
182 authentication and keep Vole behind it:
183
184 ```
185 client --ssh:22--> system sshd
186 | AuthorizedKeysCommand -> vole ssh-authorized-keys
187 | forced command -> vole ssh-exec --session <token>
188 v
189 vole ssh-exec (the git account; no data access)
190 | one framed request over a local socket
191 v
192 vole serve (the only writer)
193 ```
194
195 A key is still a Vole account; sshd asks `vole ssh-authorized-keys` whether it is,
196 and the forced command it runs hands the session to the running service over
197 `/run/vole/ssh.sock`. Because sshd owns 22, `ssh_addr = "0.0.0.0:22"` puts no port
198 in any URL, and `git clone ssh://git@forge.example.com/demo.git` works.
199
200 Nothing else about the instance moves: `vole serve` is still the only writer, and
201 Vole's own listener stays the default for development.
202
203 ### A fresh cloud-init instance
204
205 `SSH_PORT=22` renders the front-door configuration, adds `ssh_listen = "socket"`,
206 and appends the sshd include on first boot:
207
208 ```sh
209 SSH_PORT=22 ./render.sh > user-data.yaml
210 ```
211
212 ### An existing instance
213
214 The package creates the `git` account and ships the drop-in at
215 `/usr/share/vole/sshd/vole.conf`; it does not install it, and it never edits
216 `/etc/ssh`. Four steps, in this order:
217
218 1. Read the drop-in. It names the `git` account the package created. If you set
219 `ssh_user` to something else, change its `Match User` line to that account and
220 give the account `/usr/lib/vole/ssh-shell` as its shell.
221
222 2. Append one line at the **end** of `/etc/ssh/sshd_config`:
223
224 ```
225 Include /usr/share/vole/sshd/vole.conf
226 ```
227
228 It must be last. A `Match` block applies to everything after it, so an include
229 placed above other settings would silently scope them to the `git` account.
230
231 ```sh
232 echo 'Include /usr/share/vole/sshd/vole.conf' | sudo tee -a /etc/ssh/sshd_config
233 sudo sshd -t && sudo systemctl reload ssh # on RHEL the unit is sshd
234 ```
235
236 3. Set the three settings in `/etc/vole/vole.toml`:
237
238 ```toml
239 ssh_listen = "socket"
240 ssh_addr = "0.0.0.0:22"
241 ssh_public_host_key_file = "/etc/ssh/ssh_host_ed25519_key.pub"
242 ```
243
244 `ssh_addr` is now only what generated clone URLs say; Vole binds no TCP port
245 of its own. `ssh_socket` defaults to `/run/vole/ssh.sock`, which is the path
246 the package creates for it.
247
248 4. Restart Vole:
249
250 ```sh
251 sudo systemctl restart vole
252 ```
253
254 Then check the three answers that matter:
255
256 ```sh
257 ssh git@forge.example.com # refused: this account runs no shell
258 vole whoami --remote ssh://git@forge.example.com/demo.git
259 git clone ssh://git@forge.example.com/demo.git
260 ```
261
262 ### On macOS
263
264 A full macOS deployment — service variants, paths, the service account, and the
265 launchd caveats — lives on [Deploy Vole on macOS](macos.md). This section is only
266 the sshd front door. The `Match` block is the same; everything around it is not.
267 The release still attaches `vole-darwin-sshd.conf`, but `vole ssh-config` renders
268 the drop-in with the real binary and config paths, which is what a Homebrew
269 install needs:
270
271 ```sh
272 vole ssh-config --platform darwin > /etc/ssh/vole.conf
273 ```
274
275 Render it before you install it. The header it prints carries the macOS steps;
276 the `--vole`, `--config`, and `--socket` flags replace the defaults it names.
277
278 1. Enable Remote Login and append one line at the **end** of `/etc/ssh/sshd_config`:
279
280 ```sh
281 sudo systemsetup -setremotelogin on
282 echo 'Include /etc/ssh/vole.conf' | sudo tee -a /etc/ssh/sshd_config
283 ```
284
285 2. Check and reload sshd:
286
287 ```sh
288 sudo sshd -t && sudo launchctl kickstart -k system/com.openssh.sshd
289 ```
290
291 3. Install the shell wrapper and create the forced-command account. The account's
292 login shell has to exec exactly one thing, so a three-line wrapper hands off to
293 `vole ssh-shell`. Put it where the drop-in names it, pointing at your prefix
294 (`/usr/local` for a system install, `/opt/homebrew` for Homebrew on Apple
295 Silicon):
296
297 ```sh
298 sudo mkdir -p /usr/local/lib/vole
299 printf '#!/bin/sh\nexec /usr/local/bin/vole ssh-shell "$@"\n' | sudo tee /usr/local/lib/vole/ssh-shell
300 sudo chmod 0755 /usr/local/lib/vole/ssh-shell
301 sudo sysadminctl -addUser git -fullName "Vole git" -shell /usr/local/lib/vole/ssh-shell
302 ```
303
304 Then set the three settings in `vole.toml` and put `ssh_socket` where both
305 accounts can reach it.
306
307 4. Decide the socket directory's group. macOS has no `/run` or tmpfiles, so the
308 operator creates the shared directory. Use one shared group: create it, put
309 the service account (`_vole`) and `git` in it, and make the directory
310 `_vole:git` with setgid so the socket inherits the group:
311
312 ```sh
313 sudo dseditgroup -o create -r "Vole front door" vole
314 sudo dseditgroup -o edit -a _vole -t user vole
315 sudo dseditgroup -o edit -a git -t user vole
316 sudo mkdir -p /usr/local/var/vole
317 sudo chown _vole:git /usr/local/var/vole
318 sudo chmod 2770 /usr/local/var/vole
319 ```
320
321 `ssh_socket` then names `/usr/local/var/vole/ssh.sock`, and the socket's `0660`
322 is reachable by both because setgid carries the shared group onto it. A single
323 shared group is the simple answer; a `vole`/`git` pair adds nothing here
324 because only these two accounts ever touch the socket.
325
326 5. Restart Vole the way you started it.
327
328 `AuthorizedKeysCommandUser` is the account `vole serve` runs as. Start the
329 service with the LaunchAgent or LaunchDaemon in
330 [Deploy Vole on macOS](macos.md).
331
332 `vole whoami` returning your account name means sshd resolved your key to it and
333 the forced command reached the service.
334
335 The port disappears from every remote the same way, because they all use the same
336 SSH endpoint. A command that acts on a repository names it in the URL;
337 `vole admin` and `vole runner` name only the instance:
338
339 ```sh
340 vole whoami --role --remote ssh://forge.example.com/demo.git
341 vole secret list demo --remote ssh://forge.example.com/demo.git
342 vole change show 42 --remote ssh://forge.example.com/demo.git
343 vole run list --remote ssh://forge.example.com/demo.git
344 vole admin --remote ssh://forge.example.com account invite admin
345 vole runner --remote ssh://forge.example.com
346 ```
347
348 Inside a clone, `--remote origin` is the shorter form of the repository ones.
349
350 A `:2222` in an example elsewhere on this site belongs to Vole's own listener;
351 drop it for an instance whose sshd is the front door.
352
353 ### Migrate an existing instance
354
355 - Nothing changes until you opt in. An instance that keeps `ssh_listen = "tcp"`
356 behaves exactly as before, on 2222.
357 - Clients need a new `known_hosts` entry for the host on 22. The old
358 `[host]:2222` entry becomes unused and does no harm:
359 `ssh-keyscan forge.example.com >> ~/.ssh/known_hosts`.
360 - Remotes drop the port:
361 `git remote set-url origin ssh://git@forge.example.com/demo.git`. A remote
362 still naming `:2222` keeps working only while the built-in listener is up, so
363 change the remotes before you switch.
364 - Runners: replace `--remote ssh://git@host:2222` with
365 `--remote ssh://git@host`, and re-pin `runner_known_hosts` with `ssh-keyscan
366 host` (no `-p`). The packaged runner template renders both shapes with
367 `SSH_PORT`. A runner that keeps `:2222` fails its first lease with a
368 connection error, not an authentication error.
369 - CI jobs that act as a bot change nothing: the host key they verify comes from
370 the lease, and in this mode that is sshd's key.
371 - Backups change: `/etc/ssh/ssh_host_ed25519_key` is now part of what must
372 survive a restore, and `data/ssh_host_ed25519_key` is only used by direct mode.
373
374 To go back, reverse the four steps: set `ssh_listen = "tcp"` and `ssh_addr` to the
375 built-in listener's address, remove the `Include` line, `sshd -t`, reload the SSH
376 service (`ssh` on Debian and Ubuntu, `sshd` on RHEL), restart Vole, and put
377 `:2222` back in the remotes and runner arguments.
378
379 ## Troubleshoot
380
381 | Symptom | Check |
382 |---|---|
383 | Every connection times out | Public address, provider firewall, and security-group rules |
384 | Certificate warning or failure | `dig +short forge.example.com`, ports 80 and 443, and `journalctl -u vole` for ACME errors |
385 | First boot did not configure Vole | `/var/log/vole-first-boot.log`, package URL, and package architecture |
386 | Git cannot connect on 2222 | Inbound port 2222 and `ssh_listen`; with the front door there is no 2222 |
387 | `ssh git@forge.example.com` says "this account runs no shell" | Correct: the front-door account runs only the forced command |
388 | Push is refused with `Permission denied (publickey)` | `journalctl -u sshd` for `AuthorizedKeysCommand` errors, `vole whoami`, and the key rendered into user data |
389 | Push fails but fetch works | The remote still names `:2222` while the built-in listener is off |
390 | A clone verifies the wrong host key | A stale `[host]:2222` entry in `known_hosts`; the front door's entry is plain `host` |
391
392 Editing user data after creation does not rerun cloud-init. Change
393 `/etc/vole/vole.toml` and restart Vole for configuration updates:
394
395 ```sh
396 sudo -e /etc/vole/vole.toml
397 sudo systemctl restart vole
398 ```
399
400 ## Next
401
402 - [Deploy Vole on macOS](macos.md) — the launchd service, paths, and service
403 account on a Mac.
404 - [Back up an instance](../operations.md#back-up-an-instance) — provider
405 snapshots do not replace an application backup and restore test.
406 - [Set up a CI runner](runner.md) — run repository code on a separate machine.
407 - [Packages and upgrades](../packaging.md#upgrading) — install later releases
408 after taking a backup.