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.
Rebuild the docs as a MkDocs site
1f8afe73515d58c14774878f30f33bfe318d0c3b · Keenan Nemetz · 21d ago · parent 7c02af12
Rebuild the docs as a MkDocs site Replace the mdBook configuration with MkDocs and a local theme that uses Vole's Everforest dark/medium palette. Move the contents order into nav, make docs/index.md the homepage, and carry the install, quickstart, deployment, and reference pages into the new tree. Add the docs build to verify, with pinned requirements and python3-venv in the image, so a broken nav entry or theme asset fails before a pages deploy.
docs/deploy/index.md +295
| @@ -0,0 +1,295 @@ | |||
| 1 | # Deploying Vole to a server | ||
| 2 | |||
| 3 | Vole is one binary, one configuration file, and one directory of state. It needs | ||
| 4 | no database server, no cache, and no object store, so "deploying" means: get one | ||
| 5 | small machine, install the package, say what address people will reach it on, and | ||
| 6 | start it. | ||
| 7 | |||
| 8 | This page does that for you. The machine configures itself on its first boot from | ||
| 9 | a file you paste into the provider's console — no Terraform, no API token, and | ||
| 10 | nothing to install on your own computer except the shell you already have. It | ||
| 11 | works the same on Hetzner Cloud, DigitalOcean, AWS, and any other provider that | ||
| 12 | accepts user data; only the form you paste into is different, and [the provider | ||
| 13 | differences](#create-the-machine) are one table. | ||
| 14 | |||
| 15 | If the machine already exists and you have shell access, skip to [a machine you | ||
| 16 | already have](#a-machine-you-already-have). | ||
| 17 | |||
| 18 | ## What you need | ||
| 19 | |||
| 20 | - **A DNS name** you can point at the machine, such as `forge.example.com`. | ||
| 21 | Vole puts this in `public_url`, and browsers bind a passkey to that address, so | ||
| 22 | pick the name you intend to keep. | ||
| 23 | - **An SSH key.** It becomes the first account, and it is how you push. Any key | ||
| 24 | you already use with another forge works. | ||
| 25 | - **A package file.** Vole's releases are published on its own instance, at | ||
| 26 | [rodent.software/vole/releases](https://rodent.software/vole/releases). Open | ||
| 27 | the release you want and copy the URL of the file for your machine's | ||
| 28 | architecture: `…/vole/releases/<tag>/artifacts/vole_<version>-1_amd64.deb`, or | ||
| 29 | `arm64` instead of `amd64`. | ||
| 30 | |||
| 31 | There is no container image. Vole is one process whose state is a directory on | ||
| 32 | local disk, so a container would add a layer without removing one, and it would | ||
| 33 | cost the service unit's hardening. If your machines are already managed by | ||
| 34 | Compose or Kubernetes, give the forge a small virtual machine of its own; the | ||
| 35 | first-boot file works there unchanged. | ||
| 36 | |||
| 37 | ## Render the first-boot file | ||
| 38 | |||
| 39 | From a clone of the Vole repository, on your own computer: | ||
| 40 | |||
| 41 | ```sh | ||
| 42 | cd deploy/cloud-init | ||
| 43 | |||
| 44 | HOSTNAME=forge.example.com \ | ||
| 45 | ADMIN_ACCOUNT=admin \ | ||
| 46 | ADMIN_EMAIL=you@example.com \ | ||
| 47 | ADMIN_SSH_KEY="$(cat ~/.ssh/id_ed25519.pub)" \ | ||
| 48 | VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \ | ||
| 49 | ./render.sh > user-data.yaml | ||
| 50 | ``` | ||
| 51 | |||
| 52 | Open `user-data.yaml` before you paste it. It is the whole setup, and it is the | ||
| 53 | last chance to notice a wrong account name: names are permanent. | ||
| 54 | |||
| 55 | The values you pass. Everything else has a working default. | ||
| 56 | |||
| 57 | | Variable | Default | What it does | | ||
| 58 | |---|---|---| | ||
| 59 | | `HOSTNAME` | required | The name the instance answers on. It becomes `public_url`, and passkeys bind to it | | ||
| 60 | | `ADMIN_ACCOUNT` | required | The first account, made an instance admin. Permanent | | ||
| 61 | | `ADMIN_SSH_KEY` | required | That account's public key | | ||
| 62 | | `VOLE_PACKAGE_URL` | required | The `.deb` for the machine's architecture | | ||
| 63 | | `ADMIN_EMAIL` | empty | Contact address for the certificate authority | | ||
| 64 | | `INSTANCE_NAME` | `Vole` | What the landing page calls this forge | | ||
| 65 | | `TLS_MODE` | `acme` | `proxy` leaves TLS to a proxy you run, and serves plain HTTP on loopback | | ||
| 66 | |||
| 67 | `render.sh` needs `envsubst`, which is in `gettext-base` on Debian and Ubuntu or | ||
| 68 | `gettext` elsewhere. Without it, edit `deploy/cloud-init/vole.yaml` by hand: each | ||
| 69 | placeholder is a value with the same name. | ||
| 70 | |||
| 71 | ## Create the machine | ||
| 72 | |||
| 73 | One Ubuntu 24.04 or Debian 13 machine, 2 vCPU, 4 GB of memory, and 40 GB of disk | ||
| 74 | is enough for a small team. Raise the disk if you expect big pushes or LFS. These | ||
| 75 | are the settings that differ by provider: | ||
| 76 | |||
| 77 | | Provider | Image | Size | Where the first-boot file goes | Firewall | | ||
| 78 | |---|---|---|---|---| | ||
| 79 | | Hetzner Cloud | Ubuntu 24.04 (Debian 13 works too) | CX22: 2 vCPU, 4 GB, 40 GB | **Cloud config** on **Add Server** | a **Firewall** in the project. A new server is open until you add one | | ||
| 80 | | DigitalOcean | Ubuntu 24.04 LTS x64 (Debian 13 works too) | Basic: 2 vCPU, 4 GB, 80 GB | **Advanced options → user data** on **Create Droplet** | a **Cloud Firewall** under Networking. A new droplet is open until you add one | | ||
| 81 | | AWS | Ubuntu Server 24.04 LTS (HVM), published by Canonical | `t3.medium`: 2 vCPU, 4 GB, 40 GiB gp3, encrypted | **Advanced details → User data** on **Launch instance** | the security group you create during launch. A new instance allows nothing inbound, so it is required | | ||
| 82 | |||
| 83 | On every provider: | ||
| 84 | |||
| 85 | - Use the SSH key you rendered into the file, not a new one. | ||
| 86 | - Turn backups on. They are a snapshot of the machine, not a backup of the | ||
| 87 | instance — see [backups](#backups-are-still-your-job). | ||
| 88 | - Give the machine a public IPv4 address. On AWS that means the default VPC's | ||
| 89 | public subnet with **auto-assign public IPv4** enabled; without a public | ||
| 90 | address the machine cannot fetch its package or its certificate. | ||
| 91 | - Turn monitoring on where it is free. It is the quickest way to see a build | ||
| 92 | filling the disk. | ||
| 93 | |||
| 94 | An Elastic IP (or a reserved address) is optional. It keeps the address across a | ||
| 95 | stop and start, which saves one DNS edit; both the name in `public_url` and the | ||
| 96 | SSH host key clients pin survive an address change, so it is convenience rather | ||
| 97 | than correctness. | ||
| 98 | |||
| 99 | ## Ports the server needs open | ||
| 100 | |||
| 101 | | Direction | Protocol | Port | Source | | ||
| 102 | |---|---|---|---| | ||
| 103 | | in | tcp | 22 | your team's addresses, for shell access | | ||
| 104 | | in | tcp | 2222 | your team's addresses. This is Git over SSH, the write transport | | ||
| 105 | | in | tcp | 80 | anywhere, for the certificate challenge | | ||
| 106 | | in | tcp | 443 | anywhere | | ||
| 107 | | out | any | any | anywhere, so the server can fetch its package and certificate | | ||
| 108 | |||
| 109 | AWS labels the first column **Type**: use SSH for port 22 and Custom TCP for the | ||
| 110 | rest. Restricting 2222 to your team is the cheapest way to keep the write side | ||
| 111 | private; if you leave it open, Vole still authenticates every connection by key. | ||
| 112 | |||
| 113 | ## A machine you already have | ||
| 114 | |||
| 115 | If the machine is already running and you have shell access, install the package | ||
| 116 | and point it at your name. This is the same result the first-boot script | ||
| 117 | produces, done by hand. | ||
| 118 | |||
| 119 | ```sh | ||
| 120 | # On the machine, as a user with sudo. | ||
| 121 | curl -fsSLO https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb | ||
| 122 | sudo apt install ./vole_0.2.0-1_amd64.deb | ||
| 123 | ``` | ||
| 124 | |||
| 125 | The package creates the `vole` service account, `/var/lib/vole`, and an instance | ||
| 126 | under the shipped configuration. Then write the configuration people will reach: | ||
| 127 | |||
| 128 | ```toml | ||
| 129 | # /etc/vole/vole.toml | ||
| 130 | data_dir = "/var/lib/vole/data" | ||
| 131 | |||
| 132 | http_addr = ":80" | ||
| 133 | https_addr = ":443" | ||
| 134 | public_url = "https://forge.example.com" | ||
| 135 | acme_email = "you@example.com" | ||
| 136 | |||
| 137 | ssh_addr = "0.0.0.0:2222" | ||
| 138 | ``` | ||
| 139 | |||
| 140 | Ports 80 and 443 are below 1024, and the packaged unit drops every capability, so | ||
| 141 | grant the one that binds them: | ||
| 142 | |||
| 143 | ```sh | ||
| 144 | sudo install -d -m 0755 /etc/systemd/system/vole.service.d | ||
| 145 | sudo tee /etc/systemd/system/vole.service.d/bind.conf >/dev/null <<'EOF' | ||
| 146 | [Service] | ||
| 147 | CapabilityBoundingSet=CAP_NET_BIND_SERVICE | ||
| 148 | AmbientCapabilities=CAP_NET_BIND_SERVICE | ||
| 149 | EOF | ||
| 150 | ``` | ||
| 151 | |||
| 152 | Then create the first account and start the service: | ||
| 153 | |||
| 154 | ```sh | ||
| 155 | sudo systemctl daemon-reload | ||
| 156 | sudo -u vole vole admin --config /etc/vole/vole.toml \ | ||
| 157 | account create admin --key /tmp/your-key.pub --role admin | ||
| 158 | sudo systemctl enable --now vole | ||
| 159 | ``` | ||
| 160 | |||
| 161 | `--role admin` is what makes this account an instance admin. The first one has to | ||
| 162 | be granted on the host; after that, admins can manage the instance over SSH with | ||
| 163 | `vole admin --remote`. Continue with [point the name at | ||
| 164 | it](#point-the-name-at-it) and [check it works](#check-it-works). | ||
| 165 | |||
| 166 | If you would rather run a proxy than let Vole hold the certificate, leave | ||
| 167 | `https_addr` empty, set `http_addr = "127.0.0.1:8080"`, and name the header your | ||
| 168 | proxy sets with the client address: | ||
| 169 | |||
| 170 | ```toml | ||
| 171 | git_http_client_ip_header = "X-Forwarded-For" | ||
| 172 | ``` | ||
| 173 | |||
| 174 | ## What happens on first boot | ||
| 175 | |||
| 176 | The machine installs the package, writes a configuration that answers on your | ||
| 177 | name, creates the first account as an instance admin, and starts the service. | ||
| 178 | That takes about two minutes. | ||
| 179 | |||
| 180 | Vole then obtains its own TLS certificate, so there is no proxy to configure. The | ||
| 181 | certificate is requested the first time a browser arrives on the name, so the | ||
| 182 | first visit after DNS starts answering can take a few seconds; if it fails, wait a | ||
| 183 | minute and reload. | ||
| 184 | |||
| 185 | When it is up: | ||
| 186 | |||
| 187 | - `https://forge.example.com` is the forge. | ||
| 188 | - `ssh://git@forge.example.com:2222/` is where repositories are cloned from. | ||
| 189 | - The account you created is an instance admin. It has no passkey yet, so the | ||
| 190 | browser cannot sign it in until you issue one. | ||
| 191 | |||
| 192 | Your own shell access to the machine is on port 22 and stays useful for upgrades | ||
| 193 | and backups. Vole's Git over SSH is on port 2222 and is a separate listener. | ||
| 194 | |||
| 195 | ## Point the name at it | ||
| 196 | |||
| 197 | Create an `A` record for `forge.example.com` pointing at the machine's IPv4 | ||
| 198 | address, wherever the name's DNS lives. Vole cannot obtain a certificate for a | ||
| 199 | name that does not resolve to it yet, and it retries, so a record created a few | ||
| 200 | minutes after the machine is fine. | ||
| 201 | |||
| 202 | ## Check it works | ||
| 203 | |||
| 204 | Open `https://forge.example.com`. The first request may take a few seconds while | ||
| 205 | the certificate is issued; if it fails, wait a minute and reload. | ||
| 206 | |||
| 207 | Issue a passkey for the admin account from your laptop: | ||
| 208 | |||
| 209 | ```sh | ||
| 210 | vole admin --remote ssh://git@forge.example.com:2222 account invite admin | ||
| 211 | ``` | ||
| 212 | |||
| 213 | Then create a repository, and clone it: | ||
| 214 | |||
| 215 | ```sh | ||
| 216 | vole admin --remote ssh://git@forge.example.com:2222 repo create demo --owner admin | ||
| 217 | vole admin --remote ssh://git@forge.example.com:2222 acl set-default-role demo read | ||
| 218 | git clone ssh://git@forge.example.com:2222/demo.git | ||
| 219 | ``` | ||
| 220 | |||
| 221 | ## Adding a CI runner | ||
| 222 | |||
| 223 | A runner is a second machine, not a second process: it executes repository code | ||
| 224 | and can read every secret a job declares. Create it the same way, but render the | ||
| 225 | runner's file, and open only port 22. | ||
| 226 | |||
| 227 | ```sh | ||
| 228 | ./render.sh runner > runner-user-data.yaml # FORGE_HOST=forge.example.com and VOLE_PACKAGE_URL | ||
| 229 | ``` | ||
| 230 | |||
| 231 | The runner needs one more step per repository before it takes work; see | ||
| 232 | [CI runners](runner.md). | ||
| 233 | |||
| 234 | ## If something is not right | ||
| 235 | |||
| 236 | - **Everything times out.** The firewall or security group has no inbound rule | ||
| 237 | for the port, or the machine has no public IPv4 address. | ||
| 238 | - **The browser shows a certificate warning.** DNS is not answering with the | ||
| 239 | server's address yet, or ports 80 and 443 are blocked. Check | ||
| 240 | `dig +short forge.example.com`, then `journalctl -u vole | grep -i acme`. | ||
| 241 | - **The server is up but the forge is not.** First-boot output is in | ||
| 242 | `/var/log/vole-first-boot.log`; the service log is `journalctl -u vole`. The | ||
| 243 | usual cause is a package URL that 404s or is for the other architecture. | ||
| 244 | - **Nothing listens on 2222.** The firewall is not applied to the server, or its | ||
| 245 | source addresses do not include where you are pushing from. | ||
| 246 | - **Pushing is refused.** `vole whoami --remote ssh://git@forge.example.com:2222` | ||
| 247 | says which account your key is; if it is not the one you expected, the key was | ||
| 248 | not the one in `user-data.yaml`. | ||
| 249 | |||
| 250 | ## First boot happens once | ||
| 251 | |||
| 252 | The file you paste configures the machine when it is created and then never | ||
| 253 | again. Editing it afterwards changes nothing — that is how cloud-init works, not a | ||
| 254 | limitation of this page. | ||
| 255 | |||
| 256 | To change something later, edit the instance's configuration and restart it: | ||
| 257 | |||
| 258 | ```sh | ||
| 259 | sudo -e /etc/vole/vole.toml | ||
| 260 | sudo systemctl restart vole | ||
| 261 | ``` | ||
| 262 | |||
| 263 | To change something the first boot did — the account name, the TLS arrangement — | ||
| 264 | create a new machine. That is cheap; the repositories come with a clone. | ||
| 265 | |||
| 266 | ## Backups are still your job | ||
| 267 | |||
| 268 | A cloud's daily snapshot is the fastest way to get a machine back after a bad | ||
| 269 | upgrade, and it is not a backup of the instance. Two of Vole's files must be kept | ||
| 270 | apart from any copy of the data directory: the SSH host key that people's clients | ||
| 271 | pin, and `secrets.key`, which unseals repository secrets. A copy that holds both | ||
| 272 | the data and that key is a copy of plaintext. | ||
| 273 | |||
| 274 | The procedure that covers this is short, and worth running once before you trust | ||
| 275 | it: | ||
| 276 | |||
| 277 | - [Operations § Back up an instance](../operations.md#back-up-an-instance) | ||
| 278 | - [Operations § Restore an instance](../operations.md#restore-an-instance) | ||
| 279 | |||
| 280 | ## Upgrading | ||
| 281 | |||
| 282 | The first boot is not configuration management. Upgrades are a package install on | ||
| 283 | the machine: | ||
| 284 | |||
| 285 | - [Packages § Upgrading](../packaging.md#upgrading) | ||
| 286 | |||
| 287 | `users.db` is migrated in place the first time a newer binary reads it, and that | ||
| 288 | migration cannot be undone, so take a backup first. | ||
| 289 | |||
| 290 | ## The files behind these guides | ||
| 291 | |||
| 292 | Everything above lives under `deploy/` in this repository: the two first-boot | ||
| 293 | files (`cloud-init/vole.yaml` and `cloud-init/runner.yaml`) and | ||
| 294 | `cloud-init/render.sh`, which fills them in. Read them before you run them; they | ||
| 295 | are short, and `deploy/README.md` says why they are the whole deployment story. | ||