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 the front-door docs as one path through the project
b7383c19b91e9879dd4f20f9ccfb96e4381cebbd · Keenan Nemetz · 20d ago · parent 3696bd51
Rewrite the front-door docs as one path through the project README now says what Vole is and where the collaboration history lives, DEVELOPMENT goes from a checkout to a running throwaway instance, and CONTRIBUTING states the workflow in the order a contributor meets it. Build and check details live in DEVELOPMENT instead of being repeated in CONTRIBUTING, so the links point at the pages that own them. Refs: 01M7B4S415PAZ840QG714MSXA0
DEVELOPMENT.md +195−23
| @@ -1,22 +1,138 @@ | |||
| 1 | 1 | # Developing Vole | |
| 2 | 2 | ||
| 3 | ## Build | ||
| 3 | This guide takes you from a source checkout to a working build, local tests, and | ||
| 4 | a throwaway development instance. For the issue and review workflow, read | ||
| 5 | [CONTRIBUTING.md](CONTRIBUTING.md). | ||
| 6 | |||
| 7 | ## Prerequisites | ||
| 8 | |||
| 9 | You need: | ||
| 10 | |||
| 11 | - **Go with toolchain management.** `go.mod` selects Go 1.27.4 and downloads | ||
| 12 | that toolchain when needed. | ||
| 13 | - **A C compiler and SQLite development headers.** Install `libsqlite3-dev` on | ||
| 14 | Debian or Ubuntu, or `sqlite-devel` on Fedora or RHEL. Vole links SQLite | ||
| 15 | dynamically and requires FTS5 for global search; those distribution packages | ||
| 16 | provide both. | ||
| 17 | - **Git and the OpenSSH client.** The test suite invokes Git and `ssh`. | ||
| 18 | - **Python 3** for the documentation and deployment checks. | ||
| 19 | - **Optional: Docker, Podman, or nerdctl** to run the complete verification | ||
| 20 | workflow in its container image. | ||
| 21 | |||
| 22 | The resulting binary needs `libsqlite3.so.0` on the machine that runs it. | ||
| 23 | |||
| 24 | ## Build Vole | ||
| 25 | |||
| 26 | Clone the repository, then build from its root: | ||
| 4 | 27 | ||
| 5 | 28 | ```sh | |
| 29 | git clone <repository-url> | ||
| 30 | cd vole | ||
| 6 | 31 | go build -tags libsqlite3,sqlite_fts5 -o vole ./cmd/vole | |
| 32 | ./vole version | ||
| 7 | 33 | ``` | |
| 8 | 34 | ||
| 9 | That needs a C compiler, the SQLite development headers, and a `go` new enough for | ||
| 10 | `go.mod`; [Install § Build from source](docs/install.md#build-from-source) lists | ||
| 11 | them and explains the two build tags. | ||
| 35 | A source build without version linker flags prints: | ||
| 36 | |||
| 37 | ```text | ||
| 38 | 0.2.0 | ||
| 39 | ``` | ||
| 12 | 40 | ||
| 13 | ## Test | ||
| 41 | The `libsqlite3` tag links the system SQLite library instead of the driver's | ||
| 42 | bundled copy. The `sqlite_fts5` tag enables full-text search. The release build | ||
| 43 | uses the same tags; [Install](docs/install.md#build-from-source) covers other | ||
| 44 | ways to get `vole`. | ||
| 45 | |||
| 46 | ## Run tests | ||
| 47 | |||
| 48 | Run the complete test suite with the same SQLite tags as the build: | ||
| 14 | 49 | ||
| 15 | 50 | ```sh | |
| 16 | go test -tags sqlite_fts5 ./... | ||
| 51 | CGO_ENABLED=1 go test -tags libsqlite3,sqlite_fts5 ./... | ||
| 17 | 52 | ``` | |
| 18 | 53 | ||
| 19 | ## Documentation | ||
| 54 | Run one package or test while iterating: | ||
| 55 | |||
| 56 | ```sh | ||
| 57 | CGO_ENABLED=1 go test -tags libsqlite3,sqlite_fts5 ./server/web | ||
| 58 | CGO_ENABLED=1 go test -tags libsqlite3,sqlite_fts5 \ | ||
| 59 | -run '^TestDevLogin' ./server/web | ||
| 60 | ``` | ||
| 61 | |||
| 62 | Add regression tests with the code they cover. Run the race-enabled suite before | ||
| 63 | pushing; the commands are under [Run individual checks](#run-individual-checks). | ||
| 64 | |||
| 65 | ## Run a throwaway instance | ||
| 66 | |||
| 67 | Use a temporary instance to exercise the server and web interface without | ||
| 68 | touching a real Vole installation. Keep these commands in the same shell so the | ||
| 69 | environment variables remain set. | ||
| 70 | |||
| 71 | 1. Create an instance, an account, and a private repository: | ||
| 72 | |||
| 73 | ```sh | ||
| 74 | export VOLE_DEV="$(mktemp -d)" | ||
| 75 | ./vole admin init --dir "$VOLE_DEV" | ||
| 76 | export VOLE_CONFIG="$VOLE_DEV/vole.toml" | ||
| 77 | ./vole admin account create dev | ||
| 78 | ./vole admin repo create playground --owner dev | ||
| 79 | ``` | ||
| 80 | |||
| 81 | The temporary account does not need an SSH key because the next step enables | ||
| 82 | browser-only development login. | ||
| 83 | |||
| 84 | 2. Enable development login in the temporary configuration: | ||
| 85 | |||
| 86 | ```sh | ||
| 87 | cat >>"$VOLE_CONFIG" <<'EOF' | ||
| 88 | dev_only = true | ||
| 89 | dev_login = "dev" | ||
| 90 | EOF | ||
| 91 | ``` | ||
| 92 | |||
| 93 | Development login signs loopback browser requests in as `dev` without a | ||
| 94 | credential. Vole refuses this configuration on a public listener. Never copy | ||
| 95 | these settings to a real instance. | ||
| 96 | |||
| 97 | 3. Start the server: | ||
| 98 | |||
| 99 | ```sh | ||
| 100 | ./vole serve | ||
| 101 | ``` | ||
| 102 | |||
| 103 | The startup log reports the default SSH listener as `127.0.0.1:2222` and the | ||
| 104 | HTTP listener as `127.0.0.1:8080`. | ||
| 105 | |||
| 106 | Open <http://127.0.0.1:8080/>. The home page lists `playground`, and the | ||
| 107 | development session lets you exercise pages that require an account. | ||
| 108 | |||
| 109 | 4. Stop Vole with `Ctrl+C`, then remove the temporary state: | ||
| 110 | |||
| 111 | ```sh | ||
| 112 | rm -rf "$VOLE_DEV" | ||
| 113 | unset VOLE_CONFIG VOLE_DEV | ||
| 114 | ``` | ||
| 115 | |||
| 116 | After changing server code, stop the server, rebuild `./vole`, and start it | ||
| 117 | again. Configuration discovery and listener settings are documented in | ||
| 118 | [Configuration](docs/configuration.md). | ||
| 119 | |||
| 120 | ## Navigate the code | ||
| 121 | |||
| 122 | `cmd/vole` is the command-line front end. The reusable packages implement | ||
| 123 | administration, metadata, CI, storage, clients, and network servers. | ||
| 124 | [Architecture § Using Vole as a library](docs/architecture.md#using-vole-as-a-library) | ||
| 125 | contains the package map, and the rest of that page explains the trust and | ||
| 126 | storage models. | ||
| 127 | |||
| 128 | Keep command parsing and user-facing output in `cmd/vole`; put logic shared by | ||
| 129 | multiple callers in the appropriate library package. | ||
| 130 | |||
| 131 | ## Update documentation | ||
| 132 | |||
| 133 | The docs are a MkDocs site rendered from `docs/` into `dist/site`, which | ||
| 134 | `vole pages deploy dist/site` publishes as a snapshot. Build it the way the | ||
| 135 | verify workflow does before you rely on the rendered result: | ||
| 20 | 136 | ||
| 21 | 137 | ```sh | |
| 22 | 138 | python3 -m venv .venv-docs | |
| @@ -25,28 +141,84 @@ pip install -r requirements.txt | |||
| 25 | 141 | mkdocs build --strict | |
| 26 | 142 | ``` | |
| 27 | 143 | ||
| 28 | The site is written to `dist/site`, which `vole pages deploy dist/site` | ||
| 29 | publishes. `mkdocs serve` rebuilds it while you edit. The theme in `docs-theme/` | ||
| 30 | uses the same Everforest dark/medium palette and fonts as the forge, so a docs | ||
| 31 | change does not need a separate visual language. | ||
| 144 | `mkdocs serve` rebuilds the site while you edit. Its navigation is the `nav` | ||
| 145 | list in `mkdocs.yml`, so a new page needs an entry there as well as a link. The | ||
| 146 | theme in `docs-theme/` uses the same Everforest dark/medium palette and fonts as | ||
| 147 | the forge, so a docs change does not need a separate visual language. | ||
| 148 | |||
| 149 | Check relative Markdown links after editing documentation: | ||
| 150 | |||
| 151 | ```sh | ||
| 152 | python3 scripts/check-links.py | ||
| 153 | ``` | ||
| 154 | |||
| 155 | `docs/cli.md` is generated from the command definitions. Do not edit it by hand. | ||
| 156 | After changing command help or options, regenerate it from the source: | ||
| 157 | |||
| 158 | ```sh | ||
| 159 | go run -tags libsqlite3,sqlite_fts5 ./cmd/vole help --markdown > docs/cli.md | ||
| 160 | ``` | ||
| 161 | |||
| 162 | Include the regenerated reference in the same change as the command change. The | ||
| 163 | verify workflow fails when the file differs from the generated output. | ||
| 32 | 164 | ||
| 33 | 165 | ## Before you push | |
| 34 | 166 | ||
| 167 | Validate workflow definitions, then run the complete verification workflow: | ||
| 168 | |||
| 169 | ```sh | ||
| 170 | ./vole workflow check | ||
| 171 | ./vole workflow run verify | ||
| 172 | ``` | ||
| 173 | |||
| 174 | `verify` runs formatting, vet, build, license and vulnerability scans, package | ||
| 175 | and deployment checks, Markdown link checks, the generated CLI-reference check, | ||
| 176 | the documentation build, and the race test suite. Its steps live in | ||
| 177 | [`.vole/workflows/verify.yaml`](.vole/workflows/verify.yaml), and its container | ||
| 178 | image and environment live in | ||
| 179 | [`.vole/images/verify.yaml`](.vole/images/verify.yaml). | ||
| 180 | |||
| 181 | A local run needs Docker, Podman, or nerdctl and network access for module and | ||
| 182 | scanner downloads. It executes in the workflow image rather than using the tools | ||
| 183 | on your `PATH`, so a local run and CI execute the same commands. | ||
| 184 | |||
| 185 | ### Run individual checks | ||
| 186 | |||
| 187 | When iterating, or when no container runtime is available, run the checks | ||
| 188 | relevant to your change: | ||
| 189 | |||
| 190 | ```sh | ||
| 191 | gofmt -l . | ||
| 192 | CGO_ENABLED=1 go vet -tags libsqlite3,sqlite_fts5 ./... | ||
| 193 | go build -tags libsqlite3,sqlite_fts5 ./... | ||
| 194 | CGO_ENABLED=1 go test -tags libsqlite3,sqlite_fts5 -race -count=1 ./... | ||
| 195 | python3 scripts/check-deploy.py | ||
| 196 | python3 scripts/check-links.py | ||
| 197 | ``` | ||
| 198 | |||
| 199 | `gofmt -l .` should print nothing. Format changed Go files with `gofmt -w`. | ||
| 200 | |||
| 201 | These individual commands do not replace the license, vulnerability, packaging, | ||
| 202 | documentation-build, or generated-reference steps in `verify`. If you cannot run | ||
| 203 | the complete workflow, say which checks remain unrun in your change request. | ||
| 204 | |||
| 205 | ## Fuzz parsers and validators | ||
| 206 | |||
| 207 | Fuzz targets live beside the parsers and validators they exercise. Their seed | ||
| 208 | corpora run during ordinary `go test ./...`. To spend longer on one target, name | ||
| 209 | it and give it a time budget: | ||
| 210 | |||
| 35 | 211 | ```sh | |
| 36 | vole workflow run verify | ||
| 212 | go test -tags libsqlite3,sqlite_fts5 -run '^$' \ | ||
| 213 | -fuzz '^FuzzSplitCommand$' -fuzztime=60s ./server/ssh | ||
| 37 | 214 | ``` | |
| 38 | 215 | ||
| 39 | `verify` is everything CI runs: formatting, vet, build, the license and | ||
| 40 | vulnerability scans, the packages, the deployment files, Markdown links, the | ||
| 41 | documentation build, and the tests. Its steps live in | ||
| 42 | [`.vole/workflows/verify.yaml`](.vole/workflows/verify.yaml), so a local run and a | ||
| 43 | pushed run execute the same commands in the same image. That means it needs a | ||
| 44 | container runtime (Docker, Podman, or nerdctl) rather than the tools on your | ||
| 45 | `PATH`, and network access for module downloads: the job declares | ||
| 46 | `network: bridge`, so the runner that takes it is started with | ||
| 47 | `--container-network bridge`, and a local run defaults to the same network. | ||
| 216 | When a fuzz run finds a failure, Go writes the input under | ||
| 217 | `testdata/fuzz/<FuzzName>/`. Commit that input with the fix so it becomes a | ||
| 218 | regression test. | ||
| 48 | 219 | ||
| 49 | ## Using Vole as a library | ||
| 220 | ## Use Vole as a library | ||
| 50 | 221 | ||
| 51 | Vole is also a Go library. See | ||
| 222 | You can build tools that talk to an instance or embed parts of Vole without | ||
| 223 | running the command. See | ||
| 52 | 224 | [Architecture § Using Vole as a library](docs/architecture.md#using-vole-as-a-library). | |