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.
server/hook/hook_test.go +14−14
| @@ -19,10 +19,10 @@ import ( | |||
| 19 | 19 | ) | |
| 20 | 20 | ||
| 21 | 21 | type fixture struct { | |
| 22 | t *testing.T | ||
| 23 | m *repo.Meta | ||
| 24 | head string | ||
| 25 | usersDB string | ||
| 22 | t *testing.T | ||
| 23 | m *repo.Meta | ||
| 24 | head string | ||
| 25 | instanceDB string | ||
| 26 | 26 | } | |
| 27 | 27 | ||
| 28 | 28 | func newFixture(t *testing.T, blob string) *fixture { | |
| @@ -66,16 +66,16 @@ func newFixture(t *testing.T, blob string) *fixture { | |||
| 66 | 66 | if err != nil { | |
| 67 | 67 | t.Fatal(err) | |
| 68 | 68 | } | |
| 69 | return &fixture{t: t, m: m, head: commit, usersDB: testUsersDB(root)} | ||
| 69 | return &fixture{t: t, m: m, head: commit, instanceDB: testInstanceDB(root)} | ||
| 70 | 70 | } | |
| 71 | 71 | ||
| 72 | // testUsersDB is the instance database a test fixture uses: one file holding the | ||
| 72 | // testInstanceDB is the instance database a test fixture uses: one file holding the | ||
| 73 | 73 | // roster and the access rules, which is what the server has. | |
| 74 | func testUsersDB(root string) string { return filepath.Join(root, "users.db") } | ||
| 74 | func testInstanceDB(root string) string { return filepath.Join(root, "instance.db") } | ||
| 75 | 75 | ||
| 76 | 76 | func testACLs(t *testing.T, root string) *access.Store { | |
| 77 | 77 | t.Helper() | |
| 78 | acls, err := access.Open(testUsersDB(root)) | ||
| 78 | acls, err := access.Open(testInstanceDB(root)) | ||
| 79 | 79 | if err != nil { | |
| 80 | 80 | t.Fatal(err) | |
| 81 | 81 | } | |
| @@ -96,8 +96,8 @@ func (f *fixture) run(actor, ref string, maxBlob int64) (int, string) { | |||
| 96 | 96 | func (f *fixture) runWith(cfg Config, ref string) (int, string) { | |
| 97 | 97 | f.t.Helper() | |
| 98 | 98 | cfg.RepoDir = f.m.Dir | |
| 99 | if cfg.UsersDB == "" { | ||
| 100 | cfg.UsersDB = f.usersDB | ||
| 99 | if cfg.InstanceDB == "" { | ||
| 100 | cfg.InstanceDB = f.instanceDB | ||
| 101 | 101 | } | |
| 102 | 102 | var out bytes.Buffer | |
| 103 | 103 | cfg.In = strings.NewReader(git.ZeroSHA + " " + f.head + " " + ref + "\n") | |
| @@ -110,8 +110,8 @@ func (f *fixture) runWith(cfg Config, ref string) (int, string) { | |||
| 110 | 110 | func (f *fixture) runFrom(cfg Config, old, ref string) (int, string) { | |
| 111 | 111 | f.t.Helper() | |
| 112 | 112 | cfg.RepoDir = f.m.Dir | |
| 113 | if cfg.UsersDB == "" { | ||
| 114 | cfg.UsersDB = f.usersDB | ||
| 113 | if cfg.InstanceDB == "" { | ||
| 114 | cfg.InstanceDB = f.instanceDB | ||
| 115 | 115 | } | |
| 116 | 116 | var out bytes.Buffer | |
| 117 | 117 | cfg.In = strings.NewReader(old + " " + f.head + " " + ref + "\n") | |
| @@ -175,11 +175,11 @@ func TestContributorCanPushOnlyTheirNamespace(t *testing.T) { | |||
| 175 | 175 | func TestInstanceRoleAppliesOnlyToPublicReposAndAdminEverywhere(t *testing.T) { | |
| 176 | 176 | t.Parallel() | |
| 177 | 177 | f := newFixture(t, "hello\n") | |
| 178 | ident, err := identity.Open(f.usersDB) | ||
| 178 | ident, err := identity.Open(f.instanceDB) | ||
| 179 | 179 | if err != nil { | |
| 180 | 180 | t.Fatal(err) | |
| 181 | 181 | } | |
| 182 | ident.AuditPath = filepath.Join(filepath.Dir(f.usersDB), "audit.log") | ||
| 182 | ident.AuditPath = filepath.Join(filepath.Dir(f.instanceDB), "audit.log") | ||
| 183 | 183 | defer ident.Close() | |
| 184 | 184 | if _, _, err := ident.CreateWithInviteRole("invited", access.Contribute, "test", 0); err != nil { | |
| 185 | 185 | t.Fatal(err) | |