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.
Merge release channels into the account database and rename it instance.db
3047be84e9bce79372051c09854ce9b05f12a9bf · Keenan Nemetz · 17d ago · parent 262e516e
Merge release channels into the account database and rename it instance.db The instance keeps four SQLite files instead of five. Release channels were in a file of their own only because they were added beside the derived index; they are authoritative source state, like the roster, so they belong in the file an operator restores. Nothing has to be migrated: channels.db never shipped in a release, so only an instance tracking main can have one. The account database is now data/instance.db. The package comments already called it that; only the filename disagreed. Moving an existing instance is an operator step, by decision: a rename under a live server can lose the -wal file a hook subprocess still has open. Vole refuses to start while data/users.db is still in place, and says what to move, rather than creating an empty database beside it that would look like a successful upgrade. The list of databases now lives in Config.Databases, which TightenSecrets, the hook plumbing, and the admin commands read, so a missed -wal file is no longer a nine-file change. `vole admin account backup <path>` becomes `vole admin db backup <dir>` and covers every authoritative database; `db list` and `db check` answer what to back up and whether it is intact.
forge/channel/channel.go +13−5
| @@ -2,8 +2,10 @@ | |||
| 2 | 2 | // name to one immutable release. | |
| 3 | 3 | // | |
| 4 | 4 | // A channel is consumed from the instance's public URL, not cloned, so the source | |
| 5 | // of truth is an authoritative SQLite database rather than the repository's | ||
| 6 | // metadata branch. The target tag name and tag object are recorded; the web and | ||
| 5 | // of truth is the instance database rather than the repository's metadata branch. | ||
| 6 | // It lives beside the roster in instance.db, not in the derived index, because a | ||
| 7 | // channel move has no Git worktree to touch and an index rebuild must not be able | ||
| 8 | // to discard one. The target tag name and tag object are recorded; the web and | ||
| 7 | 9 | // the SSH verbs resolve the tag in the repository and report a dangling channel | |
| 8 | 10 | // when it no longer matches. | |
| 9 | 11 | package channel | |
| @@ -13,6 +15,7 @@ import ( | |||
| 13 | 15 | "encoding/hex" | |
| 14 | 16 | "errors" | |
| 15 | 17 | "fmt" | |
| 18 | "os" | ||
| 16 | 19 | "regexp" | |
| 17 | 20 | "strings" | |
| 18 | 21 | "time" | |
| @@ -91,13 +94,18 @@ func validate(ch *Channel) error { | |||
| 91 | 94 | return nil | |
| 92 | 95 | } | |
| 93 | 96 | ||
| 94 | // Store is the authoritative channel table. It is a separate database from the | ||
| 95 | // derived web index: a channel is source state, not a row an index rebuild may | ||
| 97 | // Store is the authoritative channel table. It lives in the instance database | ||
| 98 | // with the roster: a channel is source state, not a row an index rebuild may | ||
| 96 | 99 | // discard. | |
| 97 | 100 | type Store struct{ db *sql.DB } | |
| 98 | 101 | ||
| 99 | // Open opens or creates the channel database. | ||
| 102 | // Open opens the channel table in an existing instance database. The file is the | ||
| 103 | // one the roster, sessions and access rules already use, so nothing here may | ||
| 104 | // create it: a missing database is an instance that was never initialised. | ||
| 100 | 105 | func Open(path string) (*Store, error) { | |
| 106 | if _, err := os.Stat(path); err != nil { | ||
| 107 | return nil, fmt.Errorf("channel: %s is missing; run vole admin init", path) | ||
| 108 | } | ||
| 101 | 109 | db, err := sql.Open("sqlite3", path+"?_busy_timeout=5000&_journal_mode=WAL") | |
| 102 | 110 | if err != nil { | |
| 103 | 111 | return nil, err | |