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 6.5 KiB
1# Backup and restore
2
3Back up every part of an instance that Git cannot rebuild, and test recovery
4before you need it. A backup that has never been restored is an assumption, not
5a recovery plan.
6
7The procedures below run from the instance directory containing `vole.toml` and
8`data/`. Start Vole at least once before backing it up so it creates its SSH host
9key. Use an account that can read all instance files. Commands for a packaged
10Linux service use `sudo`; for a local instance, stop `vole serve` with `Ctrl+C`
11and run the Vole commands as the instance owner.
12
13## What to back up
14
15| Back up | Rebuild instead |
16|---|---|
17| `data/instance.db` — accounts, access rules, CI history, release channels, and sealed secrets | `data/index.db` — rebuild with `vole admin index rebuild` |
18| `data/repos/` — source and collaboration history | |
19| `data/lfs/` — large files and build artifacts | |
20| `data/logs/` — CI attempt logs | |
21| `data/ssh_host_ed25519_key` — Vole's SSH host key | |
22| `data/audit.log` — privileged-action history | |
23| `data/acme/` — automatic HTTPS account and certificates | Vole can request new certificates, but backing them up avoids that work |
24| `data/secrets.key` — store separately from the rest of the backup | |
25
26[Instance data](configuration.md#instance-data) explains the storage model.
27
28## Back up an instance
29
30The procedure creates an application backup in `backup/` and stores the
31secrets-encryption key separately in `key-backup/`.
32
33### 1. Stop writes
34
35For a point-in-time copy of every file, stop the packaged service:
36
37```sh
38sudo systemctl stop vole
39```
40
41Stopping the service interrupts web and Git access. If you cannot stop it, the
42database command below is safe while Vole runs, but clone every repository
43instead of copying live repository directories and expect the other files to be
44only an approximate point in time.
45
46### 2. Create private backup directories
47
48```sh
49install -d -m 0700 backup key-backup
50```
51
52### 3. Copy the authoritative database
53
54```sh
55vole admin db backup backup
56```
57
58This writes `backup/instance.db` with SQLite `VACUUM INTO`, preserving recent
59transactions in the write-ahead log. A plain copy of a live database can miss
60those transactions. The command skips the derived `index.db` and does not copy
61`secrets.key`.
62
63Use `vole admin db list` to see the databases and their backup classification.
64
65### 4. Copy repositories and stored files
66
67```sh
68cp -a data/repos backup/
69cp -a data/lfs backup/
70cp -a data/logs backup/
71cp -a data/acme backup/ 2>/dev/null || true
72cp data/ssh_host_ed25519_key backup/
73cp data/audit.log backup/
74```
75
76An instance using the [sshd front door](deploy/linux.md#put-sshd-in-front-of-vole)
77presents the system SSH host key instead. Copy that private key too:
78
79```sh
80sudo install -m 0600 /etc/ssh/ssh_host_ed25519_key backup/ssh_host_ed25519_key.sshd
81```
82
83A restore that omits the active host key changes the identity that Git clients
84and CI runners verify.
85
86### 5. Store the secrets key separately
87
88```sh
89install -m 0600 data/secrets.key key-backup/secrets.key
90```
91
92If `secrets_key` names another path, copy that file instead.
93
94!!! danger "Keep the key out of the database backup"
95 A copy containing both `instance.db` and `secrets.key` is effectively a copy
96 of the repository secrets in plaintext. Store the key separately. Losing it
97 makes the sealed secret rows unreadable.
98
99### 6. Restart and move the backups off the machine
100
101```sh
102sudo systemctl start vole
103```
104
105Move both backup sets to protected off-machine storage and record which one
106holds the encryption key. The database contains account metadata, access rules,
107CI history, and sealed secret ciphertext, so treat it as private even without
108the key.
109
110## Restore an instance
111
112Restore a complete backup set into an empty data directory. Do not merge it with
113files from a different point in time or leave a running server writing to it.
114
115### 1. Stop Vole and preserve the current directory
116
117On a packaged installation:
118
119```sh
120sudo systemctl stop vole
121mv data data.before-restore
122install -d -m 0750 data
123```
124
125Keep `data.before-restore` until the restored instance passes verification. For
126a local instance, stop `vole serve` first and run the same commands as its owner.
127
128### 2. Restore one backup set
129
130From the instance directory, copy the files back:
131
132```sh
133cp backup/instance.db data/
134cp -a backup/repos data/
135cp -a backup/lfs data/
136cp -a backup/logs data/
137cp -a backup/acme data/ 2>/dev/null || true
138cp backup/ssh_host_ed25519_key data/
139cp backup/audit.log data/
140install -m 0600 key-backup/secrets.key data/secrets.key
141```
142
143If `secrets_key` names another path, restore the key there instead. For an sshd
144front-door instance, also restore
145`backup/ssh_host_ed25519_key.sshd` to `/etc/ssh/ssh_host_ed25519_key` with mode
146`0600`, then restart or reload sshd according to your distribution.
147
148On a packaged installation, return ownership to the service account:
149
150```sh
151chown -R vole:vole data
152chmod 0600 data/secrets.key data/ssh_host_ed25519_key
153```
154
155### 3. Rebuild derived indexes and revoke restored sessions
156
157From a local instance directory, run:
158
159```sh
160vole admin index rebuild
161vole admin account revoke-sessions --all
162```
163
164For the packaged installation, run them as the service account:
165
166```sh
167sudo -u vole vole admin --config /etc/vole/vole.toml index rebuild
168sudo -u vole vole admin --config /etc/vole/vole.toml account revoke-sessions --all
169```
170
171Revoking sessions prevents browser cookies from the old system from outliving
172the restored revocation state. Rebuilding the index does not restore any unique
173data; it reconstructs derived repository, activity, and search records from Git.
174
175### 4. Start Vole and verify recovery
176
177```sh
178sudo systemctl start vole
179```
180
181Check all of the following before returning the instance to service:
182
183- account sign-in and an SSH clone;
184- source, issue, and change-request pages;
185- CI history and a stored artifact;
186- a release download and any hosted sites;
187- runner connectivity and the expected SSH host key.
188
189Once those checks pass, remove `data.before-restore` according to your retention
190policy. If `instance.db` is unrecoverable, repositories remain usable, but you
191must recreate accounts, credentials, access rules, release channels, and CI
192history. Finished runs and in-flight queue state cannot be reconstructed from
193Git.
194
195## Next
196
197- [Upgrade an installed server](install.md#upgrade-an-installed-server) — install
198 a release after a tested backup.
199- [Instance data](configuration.md#instance-data) — authoritative and derived
200 storage.
201- [LFS and file locking](lfs.md#clean-up-unused-objects) — reclaim stored objects.
202