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/sites.md +53−44
| @@ -1,82 +1,93 @@ | |||
| 1 | 1 | # Sites | |
| 2 | 2 | ||
| 3 | Vole serves static files from a repository branch at | ||
| 4 | `<repo>.<pages_domain>`. Publish a build directory as a snapshot or push the | ||
| 5 | branch directly; Vole does not run a build when a visitor requests the site. | ||
| 3 | Publish a static site from a repository branch, a local build directory, or CI. | ||
| 4 | Vole serves each public repository at `<repo>.<pages_domain>` using the same | ||
| 5 | instance and Git storage as the forge. | ||
| 6 | 6 | ||
| 7 | 7 | ## Enable sites | |
| 8 | 8 | ||
| 9 | 9 | An instance admin sets the site domain and branch in `vole.toml`: | |
| 10 | 10 | ||
| 11 | 11 | ```toml | |
| 12 | pages_domain = "pages.example.com" | ||
| 12 | pages_domain = "pages.example.net" | ||
| 13 | 13 | pages_ref = "pages" | |
| 14 | pages_procs = 4 | ||
| 15 | pages_cache_bytes = 33554432 | ||
| 16 | 14 | ``` | |
| 17 | 15 | ||
| 18 | `pages_domain` is empty by default, which disables sites. Point a wildcard DNS | ||
| 19 | record such as `*.pages.example.com` at the instance. | ||
| 16 | Restart Vole after changing the configuration. `pages_domain` is empty by | ||
| 17 | default, which disables sites. Point a wildcard DNS record such as | ||
| 18 | `*.pages.example.net` at the instance. | ||
| 20 | 19 | ||
| 21 | 20 | With [automatic HTTPS](configuration.md#automatic-https-with-acme), Vole obtains | |
| 22 | a certificate for each public site host on its first request. It does not obtain | ||
| 23 | wildcard certificates. With a TLS proxy, preserve the `Host` header so Vole can | ||
| 24 | select the requested site; see | ||
| 25 | [Running behind a proxy](configuration.md#running-behind-a-proxy). | ||
| 21 | a certificate for each public site host on its first request; it does not obtain | ||
| 22 | a wildcard certificate. Behind a TLS proxy, preserve the `Host` header so Vole | ||
| 23 | can select the site. See [Running behind a | ||
| 24 | proxy](configuration.md#running-behind-a-proxy). | ||
| 26 | 25 | ||
| 27 | Use a separate registrable domain for untrusted sites—for example, | ||
| 28 | `pages.example.net` when the forge is `forge.example.com`. A subdomain such as | ||
| 29 | `pages.example.com` is same-site with the forge and shares browser security | ||
| 30 | assumptions. See [Same-site risk](#same-site-risk). | ||
| 26 | !!! warning "Use a separate registrable domain" | ||
| 27 | Serve sites from `pages.example.net` when the forge is | ||
| 28 | `forge.example.com`. Site authors control browser content, and a separate | ||
| 29 | registrable domain keeps that content from sharing the forge's same-site | ||
| 30 | security assumptions. See [Same-site risk](#same-site-risk). | ||
| 31 | |||
| 32 | Only public repositories have public sites. A private repository's site returns | ||
| 33 | `404`; there is no browser sign-in on a site host. | ||
| 31 | 34 | ||
| 32 | 35 | ## Publish a build directory | |
| 33 | 36 | ||
| 34 | From a repository clone, build the site and deploy the output directory: | ||
| 37 | From a repository clone, build your static site into a directory. For a minimal | ||
| 38 | first deployment, create one yourself: | ||
| 35 | 39 | ||
| 36 | 40 | ```sh | |
| 37 | npm run build | ||
| 38 | vole pages deploy dist | ||
| 39 | vole pages status | ||
| 41 | mkdir -p dist | ||
| 42 | printf '<h1>Hello from Vole</h1>\n' > dist/index.html | ||
| 40 | 43 | ``` | |
| 41 | 44 | ||
| 42 | `deploy` replaces the configured site branch with the files in `dist/`. A file | ||
| 43 | removed from the build disappears from the site. Publishing identical files does | ||
| 44 | not create another change. | ||
| 45 | |||
| 46 | Preview or remove a deployment: | ||
| 45 | Preview the deployment, publish it, and inspect its status: | ||
| 47 | 46 | ||
| 48 | 47 | ```sh | |
| 49 | 48 | vole pages deploy dist --dry-run | |
| 50 | vole pages unpublish | ||
| 49 | vole pages deploy dist | ||
| 50 | vole pages status | ||
| 51 | 51 | ``` | |
| 52 | 52 | ||
| 53 | If the instance uses a branch other than `pages`, pass | ||
| 54 | `--branch <branch>` to each command. | ||
| 53 | You need the `maintainer` or `runner` role. For a repository named `demo` with | ||
| 54 | the configuration above, the site is | ||
| 55 | `https://demo.pages.example.net/` once DNS and HTTPS are configured. | ||
| 56 | |||
| 57 | `deploy` replaces the configured site branch with the directory's contents. A | ||
| 58 | file removed from the next build disappears from the site. Publishing identical | ||
| 59 | files does not create another change. | ||
| 55 | 60 | ||
| 56 | 61 | Dotfiles including `.nojekyll` and `.well-known/` are published. Vole skips | |
| 57 | 62 | `.git` and symbolic links so deployment cannot include files outside the chosen | |
| 58 | 63 | build directory. | |
| 59 | 64 | ||
| 65 | If the instance uses a branch other than `pages`, pass `--branch <branch>` to | ||
| 66 | each command. Remove the site and its branch with: | ||
| 67 | |||
| 68 | ```sh | ||
| 69 | vole pages unpublish | ||
| 70 | ``` | ||
| 71 | |||
| 60 | 72 | ## Publish with Git | |
| 61 | 73 | ||
| 62 | You can push the branch without the Vole CLI: | ||
| 74 | You can publish the branch without the Vole CLI. Use a separate clone or | ||
| 75 | worktree so the orphan site branch does not disturb your source checkout: | ||
| 63 | 76 | ||
| 64 | 77 | ```sh | |
| 65 | 78 | git switch --orphan pages | |
| 66 | printf '<h1>Hello</h1>\n' > index.html | ||
| 79 | printf '<h1>Hello from Vole</h1>\n' > index.html | ||
| 67 | 80 | git add index.html | |
| 68 | 81 | git commit -m "Publish the site" | |
| 69 | 82 | git push origin pages | |
| 70 | 83 | ``` | |
| 71 | 84 | ||
| 72 | Pushing the site branch by hand needs the `runner` or `maintainer` role; a | ||
| 73 | read-only or contributor account cannot publish it. For a repository named | ||
| 74 | `demo`, the site is then `https://demo.pages.example.com/` when sites and TLS are | ||
| 75 | configured. | ||
| 85 | A manual site-branch push also needs the `maintainer` or `runner` role. A | ||
| 86 | read-only or contributor account cannot publish it. | ||
| 76 | 87 | ||
| 77 | A workflow can deploy its build output instead, using a runner account that holds | ||
| 78 | the `runner` role. See [Publish a website](workflows.md#publish-a-website); Vole | ||
| 79 | rejects an older run that would roll back a newer branch. | ||
| 88 | A workflow can deploy its build output instead. See | ||
| 89 | [Publish a website](workflows.md#publish-a-website); Vole rejects an older run | ||
| 90 | that would roll back a newer branch. | ||
| 80 | 91 | ||
| 81 | 92 | ## Serving behavior | |
| 82 | 93 | ||
| @@ -85,10 +96,8 @@ rejects an older run that would roll back a newer branch. | |||
| 85 | 96 | - The file's Git hash supplies its `ETag`, and the commit time supplies | |
| 86 | 97 | `Last-Modified`, allowing `304` responses for unchanged files. | |
| 87 | 98 | - Vole checks branch and visibility changes once per second. | |
| 88 | - Only public repositories have public sites. A private repository's site returns | ||
| 89 | `404`; there is no browser sign-in on a site host. | ||
| 90 | - The repository header links to the site only after the configured branch exists | ||
| 91 | and the repository is public. | ||
| 99 | - The repository header links to the site after the configured branch exists and | ||
| 100 | the repository is public. | ||
| 92 | 101 | ||
| 93 | 102 | ## Same-site risk | |
| 94 | 103 | ||
| @@ -96,7 +105,7 @@ Hosted sites contain author-controlled content on host names you control. When | |||
| 96 | 105 | the forge and sites share a registrable domain, a malicious site is same-site | |
| 97 | 106 | with the forge. It can participate in top-level navigations that carry | |
| 98 | 107 | `SameSite=Lax` cookies, attempt window or frame interactions, and benefit from | |
| 99 | any future domain-wide cookie. | ||
| 108 | future domain-wide cookies. | ||
| 100 | 109 | ||
| 101 | 110 | Vole's CSRF tokens, `Cross-Origin-Opener-Policy`, and frame rules provide | |
| 102 | 111 | additional boundaries, but a separate registrable domain removes the underlying | |
| @@ -107,5 +116,5 @@ the forge itself. | |||
| 107 | 116 | ||
| 108 | 117 | - [Workflows](workflows.md#publish-a-website) — deploy from CI. | |
| 109 | 118 | - [Releases](releases.md) — distribute versioned files rather than a live site. | |
| 110 | - [Configuration](configuration.md) — configure the instance's public origin and | ||
| 111 | TLS. | ||
| 119 | - [Configuration](configuration.md) — configure the public origin, TLS, and site | ||
| 120 | limits. | ||