Docker: S3 and SeaweedFS stacks, matching DriverVault

Docker/ gets the same deployment shapes as DriverVault: plain, SeaweedFS
in the stack, SeaweedFS split into its roles, and an external S3 endpoint,
each as a build-from-source and a registry compose file with an .env
example of the same name, plus a README.

The API Server now reads PB_S3_* on boot and points PocketBase's file
storage at the bucket (only when the settings differ), then asks
PocketBase to test it. It never turns S3 off. Plugin state gets an
api_data volume, since the image could not write plugins.json.

The PocketBase image pinned v0.22.21, which cannot run the v0.23+
migrations or `superuser upsert`; it now pins v0.39.11. Starting from an
empty database also exposed two migration bugs: the seed tried to create
a passwordless account, and the documents collection saved its
self-relation with a blank target. Both are fixed; databases that already
ran them are unaffected.

Verified on Docker: the SeaweedFS and split stacks come up healthy from
an empty database, uploads land in the bucket, and a restart is a no-op.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-17 17:50:20 +01:00
1 parent bc41d8b128
commit 5be676fc97
26 files changed
+2557 -72

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
package api
import (
"testing"
"pilotvault/apiserver/internal/config"
)
func TestStorageSameExceptSecret(t *testing.T) {
a := storageSettings{Enabled: true, Bucket: "pilotvault", Region: "us-east-1",
Endpoint: "http://seaweedfs:8333", AccessKey: "k", Secret: "s1", ForcePathStyle: true}
// PocketBase masks the secret on read, so a differing secret alone matches.
b := a
b.Secret = "******"
if !a.sameExceptSecret(b) {
t.Fatal("secret-only difference should compare equal")
}
b = a
b.Endpoint = "http://seaweedfs-s3:8333"
if a.sameExceptSecret(b) {
t.Fatal("endpoint change should force a write")
}
if a.sameExceptSecret(storageSettings{}) {
t.Fatal("a fresh PocketBase (S3 off) should force a write")
}
}
func TestStorageConfigured(t *testing.T) {
full := config.Config{S3Enabled: true, S3Bucket: "b", S3Endpoint: "http://e",
S3AccessKey: "k", S3Secret: "s"}
if !full.StorageConfigured() {
t.Fatal("fully described bucket should be configured")
}
for name, mut := range map[string]func(*config.Config){
"disabled": func(c *config.Config) { c.S3Enabled = false },
"no endpoint": func(c *config.Config) { c.S3Endpoint = "" },
"no key": func(c *config.Config) { c.S3AccessKey = "" },
"no secret": func(c *config.Config) { c.S3Secret = "" },
} {
c := full
mut(&c)
if c.StorageConfigured() {
t.Errorf("%s: should not be configured", name)
}
}
}