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/cloud-init.md +225
| @@ -0,0 +1,225 @@ | |||
| 1 | # Cloud-init | ||
| 2 | |||
| 3 | ## Requirements | ||
| 4 | |||
| 5 | - A DNS name such as `forge.example.com` that you can point at the server. | ||
| 6 | - The SSH public key for the first instance admin. | ||
| 7 | - The release `.deb` URL for the server's architecture. Copy it from the | ||
| 8 | [current stable release](https://rodent.software/vole/channels/stable). | ||
| 9 | - A Vole source checkout and an [installed Vole binary](../install.md) on your | ||
| 10 | computer for rendering and remote administration. | ||
| 11 | - `envsubst`, provided by `gettext-base` on Debian and Ubuntu or `gettext` | ||
| 12 | elsewhere. | ||
| 13 | |||
| 14 | !!! warning "Account names are permanent" | ||
| 15 | Choose the admin name before rendering the file. There is no rename command. | ||
| 16 | |||
| 17 | ## 1. Render the first-boot file | ||
| 18 | |||
| 19 | From the source checkout: | ||
| 20 | |||
| 21 | ```sh | ||
| 22 | cd deploy/cloud-init | ||
| 23 | |||
| 24 | HOSTNAME=forge.example.com \ | ||
| 25 | ADMIN_ACCOUNT=admin \ | ||
| 26 | ADMIN_EMAIL=you@example.com \ | ||
| 27 | ADMIN_SSH_KEY="$(cat ~/.ssh/id_ed25519.pub)" \ | ||
| 28 | SSH_PORT=2222 \ | ||
| 29 | VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \ | ||
| 30 | ./render.sh > user-data.yaml | ||
| 31 | ``` | ||
| 32 | |||
| 33 | This example uses Vole's own listener on 2222, matching the verification commands | ||
| 34 | below. Set `SSH_PORT=22` instead to put the system sshd in front of Vole and make | ||
| 35 | clone URLs portless; | ||
| 36 | [Put sshd in front of Vole](#put-sshd-in-front-of-vole) explains that choice. | ||
| 37 | |||
| 38 | Inspect `user-data.yaml` before giving it to a provider. It contains the public | ||
| 39 | SSH key, package URL, and complete first-boot configuration. | ||
| 40 | |||
| 41 | | Variable | Default | Purpose | | ||
| 42 | |---|---|---| | ||
| 43 | | `HOSTNAME` | required | DNS name used for `public_url` and passkeys | | ||
| 44 | | `ADMIN_ACCOUNT` | required | Permanent name of the first instance admin | | ||
| 45 | | `ADMIN_SSH_KEY` | required | That account's public key | | ||
| 46 | | `VOLE_PACKAGE_URL` | required | Debian package URL from the [current stable release](https://rodent.software/vole/channels/stable) | | ||
| 47 | | `ADMIN_EMAIL` | empty | Contact address for the certificate authority | | ||
| 48 | | `INSTANCE_NAME` | `Vole` | Display name for this forge | | ||
| 49 | | `TLS_MODE` | `acme` | `acme` manages certificates; `proxy` serves loopback HTTP for your TLS proxy | | ||
| 50 | | `SSH_PORT` | `2222` | `22` lets the system sshd authenticate and drops the port from clone URLs; anything else is Vole's own listener | | ||
| 51 | |||
| 52 | For `TLS_MODE=proxy`, configure the proxy and client-IP header as described in | ||
| 53 | [Running behind a proxy](../configuration.md#running-behind-a-proxy). | ||
| 54 | |||
| 55 | ## 2. Create the machine | ||
| 56 | |||
| 57 | A small team can start with 2 vCPU, 4 GB of memory, and 40 GB of disk. Increase | ||
| 58 | disk for large repositories, LFS objects, and CI artifacts. Give the server a | ||
| 59 | public IPv4 address and enable provider backups. | ||
| 60 | |||
| 61 | Paste `user-data.yaml` into the provider's user-data field: | ||
| 62 | |||
| 63 | | Provider | Suggested image and size | User-data location | | ||
| 64 | |---|---|---| | ||
| 65 | | Hetzner Cloud | Ubuntu 24.04, CX22 | **Add Server → Cloud config** | | ||
| 66 | | DigitalOcean | Ubuntu 24.04 LTS x64, Basic 2 vCPU / 4 GB | **Create Droplet → Advanced options → User data** | | ||
| 67 | | AWS | Canonical Ubuntu 24.04 LTS, `t3.medium`, 40 GiB encrypted gp3 | **Launch instance → Advanced details → User data** | | ||
| 68 | |||
| 69 | On AWS, use a public subnet with auto-assigned public IPv4. Debian 13 is also | ||
| 70 | supported on Hetzner and DigitalOcean. Provider names and console layouts can | ||
| 71 | change; the requirement is an Ubuntu or Debian machine that accepts cloud-init | ||
| 72 | user data. | ||
| 73 | |||
| 74 | ## 3. Open the required ports | ||
| 75 | |||
| 76 | | Direction | TCP port | Allowed source | Purpose | | ||
| 77 | |---|---:|---|---| | ||
| 78 | | Inbound | 22 | Your administrators | Shell access, and Git over SSH when sshd is the front door | | ||
| 79 | | Inbound | 2222 | People who push | Vole Git over SSH when Vole's own listener serves it | | ||
| 80 | | Inbound | 80 | Anywhere | ACME challenge and HTTPS redirect | | ||
| 81 | | Inbound | 443 | Anywhere | Forge over HTTPS | | ||
| 82 | | Outbound | any | Package and certificate providers | Installation and renewal | | ||
| 83 | |||
| 84 | With `SSH_PORT=22` there is no inbound 2222 to open: sshd already answers on 22, | ||
| 85 | and Vole is reached only through it and over the local socket. Keep 2222 closed | ||
| 86 | unless you also run the built-in listener. | ||
| 87 | |||
| 88 | Use the provider firewall or AWS security group. Hetzner and DigitalOcean servers | ||
| 89 | can be open until a firewall is attached; AWS instances normally require inbound | ||
| 90 | rules. For `TLS_MODE=proxy`, expose only the ports your arrangement needs and | ||
| 91 | keep Vole's HTTP listener on loopback. | ||
| 92 | |||
| 93 | ## 4. Point DNS at the server | ||
| 94 | |||
| 95 | Create an `A` record for `forge.example.com` with the machine's public IPv4 | ||
| 96 | address. Vole cannot obtain a certificate until this name resolves to the server. | ||
| 97 | |||
| 98 | Cloud-init runs only on first boot. Setup output is written to | ||
| 99 | `/var/log/vole-first-boot.log`; service output is available with | ||
| 100 | `journalctl -u vole`. | ||
| 101 | |||
| 102 | Editing user data after creation does not rerun cloud-init. Change | ||
| 103 | `/etc/vole/vole.toml` and restart Vole for configuration updates: | ||
| 104 | |||
| 105 | ```sh | ||
| 106 | sudo -e /etc/vole/vole.toml | ||
| 107 | sudo systemctl restart vole | ||
| 108 | ``` | ||
| 109 | |||
| 110 | ## 5. Verify and enroll the admin | ||
| 111 | |||
| 112 | Open `https://forge.example.com`. The first request can take a few seconds while | ||
| 113 | Vole obtains its certificate. | ||
| 114 | |||
| 115 | From your computer, issue the admin's one-time passkey enrollment link: | ||
| 116 | |||
| 117 | ```sh | ||
| 118 | vole admin --remote ssh://git@forge.example.com:2222 account invite admin | ||
| 119 | ``` | ||
| 120 | |||
| 121 | With `SSH_PORT=22` the remote is `ssh://git@forge.example.com` — no port. The | ||
| 122 | commands below use `:2222` for the built-in listener shown in step 1; drop it for | ||
| 123 | the front door. | ||
| 124 | |||
| 125 | Open the link in a private browser window and register a passkey. Then create and | ||
| 126 | clone a repository: | ||
| 127 | |||
| 128 | ```sh | ||
| 129 | vole admin --remote ssh://git@forge.example.com:2222 \ | ||
| 130 | repo create demo | ||
| 131 | vole admin --remote ssh://git@forge.example.com:2222 \ | ||
| 132 | acl set-default-role demo reader | ||
| 133 | git clone ssh://git@forge.example.com:2222/demo.git | ||
| 134 | ``` | ||
| 135 | |||
| 136 | Omit `set-default-role` if `demo` should remain private. | ||
| 137 | |||
| 138 | ## Put sshd in front of Vole (optional) {: #put-sshd-in-front-of-vole } | ||
| 139 | |||
| 140 | Choosing `SSH_PORT=22` in step 1 puts the system sshd on port 22 and configures | ||
| 141 | Vole to answer over a local socket. Clone URLs lose `:2222`, sshd owns the host | ||
| 142 | key that clients verify, and runners must pin that key instead of Vole's. | ||
| 143 | |||
| 144 | ### A fresh cloud-init instance | ||
| 145 | |||
| 146 | Set `SSH_PORT=22` in the complete render command from step 1. The rendered file | ||
| 147 | adds `ssh_listen = "socket"`, appends the sshd include on first boot, and removes | ||
| 148 | the port from generated clone URLs. Runners must use `ssh://git@forge.example.com` | ||
| 149 | and pin sshd's host key rather than Vole's. | ||
| 150 | |||
| 151 | ## Set up a runner with cloud-init | ||
| 152 | |||
| 153 | From a Vole source checkout on your computer: | ||
| 154 | |||
| 155 | ### 1. Render the runner's first-boot configuration | ||
| 156 | |||
| 157 | ```sh | ||
| 158 | cd deploy/cloud-init | ||
| 159 | FORGE_HOST=forge.example.com \ | ||
| 160 | SSH_PORT=2222 \ | ||
| 161 | VOLE_PACKAGE_URL=https://rodent.software/vole/releases/v0.2.0/artifacts/vole_0.2.0-1_amd64.deb \ | ||
| 162 | ./render.sh runner > runner-user-data.yaml | ||
| 163 | ``` | ||
| 164 | |||
| 165 | Use the same `SSH_PORT` as the forge: `22` for its sshd front door, `2222` for | ||
| 166 | Vole's own listener. The rendered runner takes its remote and its `ssh-keyscan` | ||
| 167 | from it, so a mismatch fails the first lease. | ||
| 168 | |||
| 169 | `render.sh` requires `envsubst`, provided by `gettext-base` on Debian and Ubuntu | ||
| 170 | or `gettext` on other distributions. Inspect the rendered file before using it. | ||
| 171 | |||
| 172 | ### 2. Create the runner machine | ||
| 173 | |||
| 174 | Create a machine with your provider and paste `runner-user-data.yaml` into its | ||
| 175 | user-data or cloud-config field. Use the same Ubuntu or Debian image and package | ||
| 176 | architecture. Allow inbound shell SSH on port 22 only from your addresses; the | ||
| 177 | runner makes outbound connections to the forge and container registries. | ||
| 178 | |||
| 179 | Size memory for `RUNNER_JOBS × RUNNER_MEMORY`. Leave additional room for the | ||
| 180 | runner and host, and size disk for saved checkouts, caches, and OCI images. | ||
| 181 | Image storage is bounded by the runtime's own prune: `--image-max-age` (default | ||
| 182 | `168h`) sets the age, `0` keeps every image, and `--container-pull never` keeps | ||
| 183 | every tagged image because that runner cannot fetch one again. | ||
| 184 | |||
| 185 | ### 3. Wait for first boot | ||
| 186 | |||
| 187 | Setup output is in `/var/log/vole-runner-first-boot.log` on the runner. The | ||
| 188 | configuration creates an unprivileged `ci-runner` user, installs rootless Podman, | ||
| 189 | generates the runner's SSH key, pins the forge's host key, and enables the | ||
| 190 | service. | ||
| 191 | |||
| 192 | First boot pins the first host key returned by `ssh-keyscan`. Before allowing | ||
| 193 | production jobs, compare `/etc/vole/runner_known_hosts` with the forge's host key | ||
| 194 | fingerprint through a trusted channel. Replace the file if it does not match. | ||
| 195 | |||
| 196 | ### Runner cloud-init settings | ||
| 197 | |||
| 198 | | Variable | Default | Purpose | | ||
| 199 | |---|---|---| | ||
| 200 | | `FORGE_HOST` | required | Forge DNS name; `SSH_PORT` decides what SSH means | | ||
| 201 | | `SSH_PORT` | `2222` | `22` reaches the instance through its sshd, with no port in the remote | | ||
| 202 | | `VOLE_PACKAGE_URL` | required | Debian package URL from the [current stable release](https://rodent.software/vole/channels/stable) | | ||
| 203 | | `RUNNER_HOSTNAME` | `vole-runner` | Machine host name | | ||
| 204 | | `RUNNER_RUNTIME` | `podman` | OCI runtime | | ||
| 205 | | `RUNNER_NETWORK` | `bridge` | Maximum network offered to jobs | | ||
| 206 | | `RUNNER_DIR` | `/var/lib/vole-runner` | Checkouts, caches, and runner home | | ||
| 207 | | `RUNNER_LABEL_NAMES` | `linux` | Space-separated labels matched by `runs-on` | | ||
| 208 | | `RUNNER_JOBS` | `1` | Concurrent job slots | | ||
| 209 | | `RUNNER_MEMORY` | `4G` | Memory limit per job container | | ||
| 210 | | `RUNNER_PIDS` | `2048` | Process limit per job container | | ||
| 211 | | `RUNNER_TMPFS` | `1G` | Memory-backed `/tmp` size per job | | ||
| 212 | | `RUNNER_DISK_RESERVE` | `2G` | Free space preserved below `RUNNER_DIR` | | ||
| 213 | |||
| 214 | The unit's `MemoryMax=90%` is a host-level backstop, not a replacement for | ||
| 215 | per-job limits. [Running several jobs at once](../runner.md#running-several-jobs-at-once) | ||
| 216 | explains how to size concurrent slots. | ||
| 217 | |||
| 218 | Register and authorize the runner under [Runners](../runner.md#register-and-authorize-the-runner). | ||
| 219 | |||
| 220 | ## Next | ||
| 221 | |||
| 222 | - [Deploy on Linux](linux.md) — install on a machine you already manage. | ||
| 223 | - [Deploy on macOS](macos.md) — Homebrew and launchd. | ||
| 224 | - [Deploy on Windows](windows.md) — the MSI and Windows service. | ||
| 225 | - [Runners](../runner.md) — register and verify the runner. | ||