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.
Restructure documentation around reader tasks
348a43c364fbb04be834af44a7cd43a0931fa280 · Keenan Nemetz · 20d ago · parent b7383c19
Restructure documentation around reader tasks Group the site by getting started, collaboration, CI, publishing, and administration. Rewrite the guides as executable procedures and move issue formats, merge semantics, configuration defaults, customization, and access-control mechanics into dedicated references. Verify the quickstart and review flow against a throwaway instance, execute the service recipe, inspect the rendered site, and run the complete verify workflow. Closes: 01M7B6X6RDYBAP3JVA5SYSA1K8
docs/go-modules.md +52−68
| @@ -1,96 +1,80 @@ | |||
| 1 | 1 | # Go modules | |
| 2 | 2 | ||
| 3 | A public repository on a Vole instance is a Go module. The import path is the | ||
| 4 | instance's host and the repository name: | ||
| 3 | Vole serves Go module discovery metadata for every public repository. A module's | ||
| 4 | import path is the instance host followed by the repository name, with no separate | ||
| 5 | vanity-import service: | ||
| 5 | 6 | ||
| 6 | 7 | ```text | |
| 7 | https://<host>/<repository> | ||
| 8 | <host>/<repository> | ||
| 8 | 9 | ``` | |
| 9 | 10 | ||
| 10 | Vole serves the metadata the `go` command looks for, so an import path needs no | ||
| 11 | vanity service, no redirect, and no separate web host in front of the forge. | ||
| 12 | Vole itself is published this way: `rodent.software/vole`. | ||
| 11 | For example, Vole's own module is `rodent.software/vole`. | ||
| 13 | 12 | ||
| 14 | ## How the lookup works | ||
| 13 | ## Configure a module | ||
| 15 | 14 | ||
| 16 | `go get` cannot clone an arbitrary URL from an import path, so it first asks the | ||
| 17 | path for directions: it fetches `https://<host>/<repository>?go-get=1` and reads | ||
| 18 | the `<meta name="go-import">` tag in the answer. Vole answers for a public | ||
| 19 | repository with that repository's Git transport: | ||
| 15 | Set the instance's canonical origin: | ||
| 20 | 16 | ||
| 21 | ```console | ||
| 22 | $ curl -s 'https://rodent.software/vole?go-get=1' | ||
| 23 | <!doctype html> | ||
| 24 | ... | ||
| 25 | <meta name="go-import" content="rodent.software/vole git https://rodent.software/vole.git"> | ||
| 17 | ```toml | ||
| 18 | public_url = "https://forge.example.com" | ||
| 26 | 19 | ``` | |
| 27 | 20 | ||
| 28 | Then `go` clones the repository over the smart-HTTP transport and resolves the | ||
| 29 | package from the tag it finds there, exactly as it would for a module on any | ||
| 30 | other forge. The transport lives beside the pages: `/<repository>` is the | ||
| 31 | repository and `/<repository>.git` is its Git URL, so the tag's clone URL and the | ||
| 32 | page a person opens are the same name. | ||
| 21 | Make the repository public and use the matching module path in its `go.mod`: | ||
| 33 | 22 | ||
| 34 | A package inside the module (`rodent.software/vole/server/web`) resolves from the | ||
| 35 | same tag: the go command asks the full path first, and the tag it gets names the | ||
| 36 | repository prefix. That path is not a page, and it does not need to be — the | ||
| 37 | probe is answered before the router, for any path whose first segment names a | ||
| 38 | public repository. | ||
| 23 | ```go | ||
| 24 | module forge.example.com/demo | ||
| 25 | ``` | ||
| 39 | 26 | ||
| 40 | Add the repository to a project as usual: | ||
| 27 | From another Go project, fetch it normally: | ||
| 41 | 28 | ||
| 42 | ```console | ||
| 43 | $ go get rodent.software/vole | ||
| 44 | $ go doc rodent.software/vole/server/web | ||
| 29 | ```sh | ||
| 30 | go get forge.example.com/demo | ||
| 45 | 31 | ``` | |
| 46 | 32 | ||
| 47 | ## What the instance must have | ||
| 33 | The host cannot include a port in a Go module path. An instance available only at | ||
| 34 | `https://forge.example.com:8443` can serve Git and web pages, but its repositories | ||
| 35 | cannot use that host and port as import paths; clone them by URL instead. | ||
| 48 | 36 | ||
| 49 | - `public_url` set to the origin people use, in `[server]` in the | ||
| 50 | configuration file. The metadata's import prefix is that origin's host name; | ||
| 51 | without `public_url` Vole falls back to the request's host, which is not | ||
| 52 | something the go command's discovery can rely on. | ||
| 53 | - The host in the import path is the host name alone. A module path cannot carry | ||
| 54 | a port, so an instance reached only at `https://forge.example.com:8443` can | ||
| 55 | still serve its pages, but its repositories are not importable paths; clone | ||
| 56 | them by URL instead. | ||
| 37 | ## How discovery works | ||
| 57 | 38 | ||
| 58 | ## Which repositories answer | ||
| 39 | The `go` command requests the import path with `?go-get=1` and reads the returned | ||
| 40 | `go-import` metadata: | ||
| 59 | 41 | ||
| 60 | Only a repository an anonymous reader may read, which is the same rule that makes | ||
| 61 | its pages public. The tag is fetched without credentials — that is the discovery | ||
| 62 | protocol — so answering for a private repository would confirm to anyone who | ||
| 63 | guessed the name that it exists. Vole answers 404 for those, like every other | ||
| 64 | private path. | ||
| 42 | ```sh | ||
| 43 | curl -s 'https://rodent.software/vole?go-get=1' | ||
| 44 | ``` | ||
| 65 | 45 | ||
| 66 | A private repository is therefore not resolvable from its import path. Clone it | ||
| 67 | where the build runs and point a `replace` at that checkout, or mirror the code in | ||
| 68 | a repository that is public. | ||
| 46 | The HTML includes: | ||
| 69 | 47 | ||
| 70 | ## Naming | ||
| 48 | ```html | ||
| 49 | <meta name="go-import" content="rodent.software/vole git https://rodent.software/vole.git"> | ||
| 50 | ``` | ||
| 71 | 51 | ||
| 72 | The import path is `<host>/<repository>`, so the repository name is also the last | ||
| 73 | element of every import path inside the module. Every name is available for this | ||
| 74 | except the four the forge keeps at the root for reasons a URL cannot avoid: | ||
| 75 | `static` (assets), and `robots.txt`, `sitemap.xml`, and `sitemap-pages.xml` | ||
| 76 | (crawlers only look for those at the root). The forge's own pages live under | ||
| 77 | `/-/`, a prefix no repository name can start with, so `admin`, `login`, `activity` | ||
| 78 | and the rest are ordinary repository names. | ||
| 52 | Go then clones `https://rodent.software/vole.git` and resolves packages and | ||
| 53 | versions from its Git refs. A package below the repository root uses the same | ||
| 54 | metadata: `rodent.software/vole/server/web` resolves within the | ||
| 55 | `rodent.software/vole` module. | ||
| 79 | 56 | ||
| 80 | Because the name is the import path, renaming a repository that other modules | ||
| 81 | import breaks them: there is no forwarding layer in front of the forge. Rename | ||
| 82 | the pages, or keep the name a published module depends on. | ||
| 57 | The repository page is `/<repository>`, and its Git transport is | ||
| 58 | `/<repository>.git`. Both names therefore agree with the import path. | ||
| 83 | 59 | ||
| 84 | ## Vole's own module | ||
| 60 | ## Public and private repositories | ||
| 85 | 61 | ||
| 86 | The Vole repository is `rodent.software/vole`, so fetching the source is: | ||
| 62 | Go discovery is anonymous. Vole answers metadata requests only when an anonymous | ||
| 63 | reader can clone the repository, and returns `404` for private repositories so | ||
| 64 | the probe does not disclose their existence. | ||
| 87 | 65 | ||
| 88 | ```console | ||
| 89 | $ go get rodent.software/vole | ||
| 90 | ``` | ||
| 66 | For a private module, clone it where the build runs and use a `replace` directive | ||
| 67 | to point at that checkout, or mirror a public repository for downstream users. | ||
| 68 | Renaming a published repository changes its import path and breaks downstream | ||
| 69 | modules; keep the original name or update those modules. | ||
| 91 | 70 | ||
| 92 | and building from a checkout uses the same path: | ||
| 71 | Repository names are unique on an instance. The reserved root names are `static`, | ||
| 72 | `robots.txt`, `sitemap.xml`, and `sitemap-pages.xml`; names beginning with `-` are | ||
| 73 | also unavailable because forge pages live under `/-/`. | ||
| 93 | 74 | ||
| 94 | ```sh | ||
| 95 | go build -tags libsqlite3,sqlite_fts5 -o vole rodent.software/vole/cmd/vole | ||
| 96 | ``` | ||
| 75 | ## Next | ||
| 76 | |||
| 77 | - [Configuration](configuration.md#public-url) — set the origin used in import | ||
| 78 | metadata. | ||
| 79 | - [Releases](releases.md) — publish the tags Go resolves as module versions. | ||
| 80 | - [Sites](sites.md) — host project documentation beside the module. | ||