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.
Keep the authoritative instance in one database
1a9b383890c40885709804293cd3a75e775f06a0 · Keenan Nemetz · 3d ago · parent 12221a79
Keep the authoritative instance in one database Move the CI queue and the sealed secret rows into instance.db, leaving index.db as the one derived database. Backups now copy the single authoritative file, and the index stays disposable. Hooks and the SSH front door use the instance database for run credentials and required checks. The admin db commands and documentation now describe one authoritative database plus the derived index. This was migrated once by hand on the rodent.software instance; there is no migration command and no legacy-layout check in the shipped code.
forge/config/config.go +4−21
| @@ -280,9 +280,10 @@ func (c *Config) ReposDir() string { return filepath.Join(c.DataDir, "repos") } | |||
| 280 | 280 | ||
| 281 | 281 | // InstanceDB is the one database of authoritative instance state: accounts and | |
| 282 | 282 | // the names they have ever held, SSH keys, passkeys, browser sessions, access | |
| 283 | // rules, LFS locks, page-view counters, and release channels. None of it is | ||
| 284 | // derived from Git and none of it is rebuilt by an index rebuild, which is why | ||
| 285 | // it is one file: everything here has to survive a restore together. | ||
| 283 | // rules, LFS locks, page-view counters, release channels, the CI queue and run | ||
| 284 | // history, and the sealed secret store. None of it is derived from Git and none | ||
| 285 | // of it is rebuilt by an index rebuild, which is why it is one file: everything | ||
| 286 | // here has to survive a restore together. | ||
| 286 | 287 | func (c *Config) InstanceDB() string { return filepath.Join(c.DataDir, "instance.db") } | |
| 287 | 288 | ||
| 288 | 289 | // LegacyInstanceDB is where the roster lived before release channels joined it. | |
| @@ -300,11 +301,6 @@ func (c *Config) LegacyChannelsDB() string { return filepath.Join(c.DataDir, "ch | |||
| 300 | 301 | func (c *Config) AuditLog() string { return filepath.Join(c.DataDir, "audit.log") } | |
| 301 | 302 | func (c *Config) IndexDB() string { return filepath.Join(c.DataDir, "index.db") } | |
| 302 | 303 | ||
| 303 | // SecretsDB holds each repository's sealed secrets. It is a separate file from | ||
| 304 | // the instance database because it is the one database whose contents are | ||
| 305 | // encrypted, and a copy of it without SecretsKeyPath is ciphertext. | ||
| 306 | func (c *Config) SecretsDB() string { return filepath.Join(c.DataDir, "secrets.db") } | ||
| 307 | |||
| 308 | 304 | // SecretsKeyPath is the AES-256 key that seals those values. It is created on | |
| 309 | 305 | // first use at 0600; losing it means losing every stored value, and restoring a | |
| 310 | 306 | // copy of the database beside a newly generated key is a restore that cannot read | |
| @@ -316,14 +312,6 @@ func (c *Config) SecretsKeyPath() string { | |||
| 316 | 312 | return filepath.Join(c.DataDir, "secrets.key") | |
| 317 | 313 | } | |
| 318 | 314 | ||
| 319 | // RunsDB holds the CI queue and finished runs. It is authoritative for work that has | ||
| 320 | // not happened yet — a queued or leased job exists only there — while the finished | ||
| 321 | // half is derived from the records on each repository's metadata branch, and pending | ||
| 322 | // work is reconciled from the refs. Deleting it loses the attempts that were in | ||
| 323 | // flight; the current tip of every ref is queued once and `vole admin index rebuild` | ||
| 324 | // restores the finished history. | ||
| 325 | func (c *Config) RunsDB() string { return filepath.Join(c.DataDir, "runs.db") } | ||
| 326 | |||
| 327 | 315 | // Database is one SQLite file the instance owns. The list it belongs to is what | |
| 328 | 316 | // `vole admin db` reports and backs up, so it is also the one place a new file | |
| 329 | 317 | // has to be declared. | |
| @@ -333,9 +321,6 @@ type Database struct { | |||
| 333 | 321 | // Rebuildable is true for a database Vole can recreate from the repositories | |
| 334 | 322 | // on disk. A backup may skip it, and losing it costs time, not history. | |
| 335 | 323 | Rebuildable bool | |
| 336 | // Sealed is true for a database whose contents are ciphertext without | ||
| 337 | // Config.SecretsKeyPath. It still belongs in a backup, next to the key. | ||
| 338 | Sealed bool | ||
| 339 | 324 | } | |
| 340 | 325 | ||
| 341 | 326 | // Databases lists every SQLite file in the data directory, authoritative ones | |
| @@ -345,8 +330,6 @@ type Database struct { | |||
| 345 | 330 | func (c *Config) Databases() []Database { | |
| 346 | 331 | return []Database{ | |
| 347 | 332 | {Name: "instance.db", Path: c.InstanceDB()}, | |
| 348 | {Name: "runs.db", Path: c.RunsDB()}, | ||
| 349 | {Name: "secrets.db", Path: c.SecretsDB(), Sealed: true}, | ||
| 350 | 333 | {Name: "index.db", Path: c.IndexDB(), Rebuildable: true}, | |
| 351 | 334 | } | |
| 352 | 335 | } | |