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/operations.md −327

@@ -1,327 +0,0 @@
1 # Operations
2
3 Use these runbooks to protect and recover a Vole instance. Repository history is
4 only part of the state: accounts, CI records, logs, secrets, artifacts, and host
5 keys live beside the repositories and need their own backup plan.
6
7 ## Production baseline
8
9 Before exposing an instance, verify these controls:
10
11 - **Set the canonical origin.** Use an HTTPS `public_url` and either Vole's ACME
12 listener or a TLS proxy that preserves `Host`. See
13 [Configuration](configuration.md#public-url).
14 - **Separate the write transport.** Firewall Vole's SSH port to the people who
15 push, and put the system sshd in front rather than exposing a second listener:
16 with the [front door](deploy/index.md#put-sshd-in-front-of-vole) there is one
17 SSH endpoint on 22, and `vole serve` binds no TCP port of its own.
18 - **Remove development shortcuts.** Leave `dev_only`, `dev_login`, and
19 `open_registration` disabled unless their policies are intentional.
20 - **Set quotas on shared instances.** Repository ref, metadata, object, and LFS
21 quotas default to unlimited. Start with the example in
22 [Set resource limits](configuration.md#set-resource-limits) and adjust from
23 measurements.
24 - **Keep anonymous work bounded.** Review HTTP read, SSH connection, file-size,
25 and sign-in limits in the [configuration reference](reference/configuration.md).
26 - **Preserve private responses.** Do not strip `private` or `no-store` headers at
27 a caching proxy. Vole already compresses textual responses; avoid double
28 compression.
29 - **Use a separate runner machine.** Keep repository code and job secrets away
30 from the forge's account database and host key. See
31 [Set up a runner](deploy/runner.md).
32 - **Retain the packaged sandbox.** Do not run the forge as root to bind a low
33 port; grant only `CAP_NET_BIND_SERVICE` as shown in
34 [Packages](packaging.md#what-the-package-installs).
35 - **Ship audit records off-host.** Local append-only files are not tamper-evident.
36 - **Test a restore.** A backup that has never been restored is an assumption, not
37 a recovery plan.
38
39 ## Back up an instance
40
41 Back up all authoritative state, not only the instance database. The procedure
42 below creates an application copy in `backup/` and stores the secrets-encryption
43 key separately in `key-backup/`. Run it from the instance directory containing
44 `vole.toml` and `data/`, as an account that can read all instance files and write
45 the backups.
46
47 For a point-in-time copy, stop writes first. On a packaged installation:
48
49 ```sh
50 sudo systemctl stop vole
51 ```
52
53 Stopping the service interrupts web and Git access. If you cannot stop it, use
54 the online-safe database backup command below and clone each repository instead
55 of copying a live repository directory.
56
57 ### 1. Create private backup directories
58
59 ```sh
60 install -d -m 0700 backup key-backup
61 ```
62
63 ### 2. Copy the databases consistently
64
65 ```sh
66 vole admin db backup backup
67 ```
68
69 This writes a consistent copy of the authoritative instance database —
70 `instance.db` — with `VACUUM INTO`, which preserves SQLite WAL contents while
71 the instance runs. A plain file copy of a live database can miss recent
72 transactions, and copying a database without its `-wal` file can roll it back.
73 The derived `data/index.db` is skipped because it is rebuilt from the
74 repositories. `vole admin db list` shows both files and which one a backup needs.
75
76 ### 3. Copy repositories and stored files
77
78 ```sh
79 cp -a data/repos backup/
80 cp -a data/lfs backup/
81 cp -a data/logs backup/
82 cp -a data/acme backup/ 2>/dev/null || true
83 cp data/ssh_host_ed25519_key backup/
84 cp data/audit.log backup/
85 ```
86
87 `data/ssh_host_ed25519_key` is the host key of Vole's own SSH listener. An
88 instance running the [sshd front door](deploy/index.md#put-sshd-in-front-of-vole)
89 presents sshd's key instead, so also copy the private half of that:
90
91 ```sh
92 sudo install -m 0600 /etc/ssh/ssh_host_ed25519_key backup/ssh_host_ed25519_key.sshd
93 ```
94
95 A restore that omits it hands every CI job a key that cannot verify the host.
96
97 `data/index.db` is derived and does not need a backup: `vole admin index rebuild`
98 recreates it from the repositories. The authoritative state is the single
99 `instance.db` copied by `vole admin db backup`.
100
101 ### 4. Copy the secrets key to separate protected storage
102
103 ```sh
104 install -m 0600 data/secrets.key key-backup/secrets.key
105 ```
106
107 If `secrets_key` names another path, copy that file instead.
108
109 A copy containing both `instance.db` and `secrets.key` is effectively a copy of
110 the secret plaintext. Losing the key makes the restored secret rows unreadable.
111
112 ### 5. Restart a packaged service
113
114 ```sh
115 sudo systemctl start vole
116 ```
117
118 ### 6. Move both backups off the machine
119
120 Record which backup holds the encryption key and test the restore procedure
121 below.
122
123 The database backup contains public keys and hashes of session and enrollment
124 tokens, not plaintext sessions or passwords. Treat it as private because it also
125 contains account metadata, access rules, CI history, and sealed secret
126 ciphertext.
127
128 ## Restore an instance
129
130 Stop the service before replacing its state. Restoring over a running instance
131 can mix files from different points in time.
132
133 ### 1. Stop Vole and prepare an empty data directory
134
135 ```sh
136 sudo systemctl stop vole
137 ```
138
139 ### 2. Restore these paths from the same backup
140
141 ```text
142 data/instance.db
143 data/secrets.key
144 data/repos/
145 data/lfs/
146 data/logs/
147 data/ssh_host_ed25519_key
148 ssh_host_ed25519_key.sshd # copied from /etc/ssh, front-door instances only
149 data/audit.log
150 data/acme/ # when automatic HTTPS is enabled
151 ```
152
153 Restore `secrets.key` from its separate protected copy. Ensure the restored files
154 belong to the service account and private keys have mode `0600`.
155
156 ### 3. Rebuild derived repository and search indexes
157
158 ```sh
159 vole admin index rebuild
160 ```
161
162 ### 4. Revoke browser sessions from the restored database
163
164 ```sh
165 vole admin account revoke-sessions --all
166 ```
167
168 Restored sessions must not outlive the cookies and revocation state of the system
169 they came from.
170
171 ### 5. Start Vole and verify the instance
172
173 ```sh
174 sudo systemctl start vole
175 ```
176
177 Then check account sign-in, an SSH clone, a repository page, CI history, a stored
178 artifact, and any hosted sites.
179
180 If the instance database is unrecoverable, repositories remain usable, but you
181 must recreate accounts, keys, passkeys, access rules, release channels, and CI
182 history. Current refs can be queued again, but finished CI history and in-flight
183 work are lost.
184
185 ## Upgrade to the instance database
186
187 Before this version, the account database was `data/users.db` and release
188 channels were `data/channels.db`. Both now live in `data/instance.db`. Vole does
189 not move the file itself: a rename under a running server can lose the `-wal`
190 file that a hook subprocess still has open, and creating a fresh empty database
191 beside the old one would look like a successful upgrade.
192
193 An instance installed from a release has no `channels.db`; the channel feature
194 never shipped. Only an instance tracking `main` in that window can have one.
195
196 ### 1. Stop Vole
197
198 ```sh
199 sudo systemctl stop vole
200 ```
201
202 ### 2. Move the account database
203
204 Take the write-ahead file with it. A plain `mv` of the database alone silently
205 rolls back the transactions still in `users.db-wal`.
206
207 ```sh
208 mv data/users.db data/instance.db
209 mv data/users.db-wal data/instance.db-wal 2>/dev/null || true
210 rm -f data/users.db-shm
211 ```
212
213 ### 3. Move any release channels
214
215 If `data/channels.db` exists, copy its rows into the new `data/instance.db`, then
216 delete it with its siblings. The channel table has no foreign keys, so the rows
217 transfer as they are. This is the one step that needs SQLite's `sqlite3` command
218 line tool; the Vole package does not install it, and a package-installed instance
219 never took this branch.
220
221 ```sh
222 sqlite3 data/instance.db "ATTACH 'data/channels.db' AS old;
223 INSERT OR IGNORE INTO release_channels SELECT * FROM old.release_channels;"
224 rm -f data/channels.db data/channels.db-wal data/channels.db-shm
225 ```
226
227 ### 4. Start Vole and verify
228
229 ```sh
230 sudo systemctl start vole
231 ```
232
233 `vole admin db list` should show `instance.db` as present and authoritative.
234 Confirm that accounts sign in, a repository page renders, and any channel URL
235 still resolves. Vole refuses to start while `data/users.db` or
236 `data/channels.db` is left beside the new file, and says which one to move.
237
238 ## Audit log
239
240 `data/audit.log` records roster and key changes, access rules, forced overrides,
241 admin commands, sessions, and pushes. Each tab-separated record has:
242
243 ```text
244 timestamp action actor subject detail
245 ```
246
247 Actions use lower-case dotted names such as `acl.update`, `push.force`, `channel.set`, and
248 `session.create`. Fields are escaped and capped at 4 KiB so user-controlled text
249 cannot add rows or columns. The file is owner-only (`0600`), and Vole rejects
250 unsafe file types and ownership.
251
252 Privileged changes fail closed when their audit record cannot be written.
253 Ordinary pushes and web metadata writes are already durable in Git, so an audit
254 write failure is logged rather than making the accepted change appear rejected.
255 A log that cannot be opened safely prevents `vole serve` and `vole admin` from
256 starting.
257
258 Instance admins can read paginated records at **Admin → Audit log**. Ship an
259 append-only copy to storage the Vole service account cannot modify. Anyone who
260 can write the local data directory can alter the local log.
261
262 ## Restart the server
263
264 A clean restart stops new CI leases and waits up to one minute for leased jobs to
265 report. Jobs that report in time are stored; jobs still running when the
266 connection closes become eligible for another attempt after their leases expire.
267
268 Plan long builds around restarts. For runner shutdown behavior, see
269 [Stopping a runner](runner.md#stopping-a-runner).
270
271 ## Clean up stored files
272
273 Preview garbage collection before deleting anything:
274
275 ```sh
276 vole admin gc --dry-run
277 vole admin gc --grace 24h
278 vole admin gc
279 ```
280
281 Garbage collection removes unreferenced objects from the shared LFS and artifact
282 store and repairs repository links into it. Reachable repository files, archived
283 CI logs, and published artifacts are retained. The default one-hour grace period
284 protects uploads that have not yet been referenced by a push.
285
286 CI logs under `data/logs/` are ordinary files and are not swept. Garbage
287 collection can run while people push; schedule it when storage growth requires
288 it rather than as a mandatory daily job.
289
290 ## Rebuild indexes
291
292 `data/index.db` is derived and safe to rebuild:
293
294 ```sh
295 vole admin index rebuild
296 ```
297
298 This restores repository, issue, change, activity, and search indexes from Git
299 and stored records. It does not restore `data/instance.db`, accounts, secrets,
300 logs, or artifacts.
301
302 ## Security notes
303
304 - Restrict the SSH host key and `secrets.key` to the Vole user. With the sshd
305 front door the host key is sshd's, and `/etc/ssh/ssh_host_ed25519_key` belongs
306 to root. Vole creates
307 private state with restrictive modes and tightens unsafe world access at
308 startup; startup fails if it cannot protect a required secret.
309 - Encryption at rest protects a copied secrets database without its key. It does
310 not protect values from someone who can read both files on a compromised host.
311 - Vole authenticates transport credentials and records pushes; it does not sign
312 Git commits, approvals, or CI results. A clone alone does not prove who pushed
313 a commit.
314 - The web interface is read-only for anonymous visitors. Git over HTTP is
315 read-only even for public repositories.
316 - Account names remain reserved after retirement so historical references cannot
317 resolve to a different person.
318 - Repository secrets are delivered to accounts that may run the repository's
319 jobs — the `runner` role, maintainers, and admins — and can be read by the
320 people controlling those machines. Container isolation does not change that
321 trust relationship.
322
323 ## Next
324
325 - [Packages and upgrades](packaging.md) — upgrade after a restorable backup.
326 - [Instance data](reference/configuration.md#instance-data) — authoritative and
327 derived storage.