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,9 +49,14 @@ migrate(
if (dirty) app.save(u)
return
}
// An account with no seed password is one expected to pre-exist (it is
// only reconciled above). On a fresh database there is nothing to
// reconcile, and PocketBase refuses an auth record without a password —
// which would abort the whole migration — so skip it.
if (!password) return
u = new Record(uc)
u.set('email', email)
if (password) u.setPassword(password)
u.setPassword(password)
u.set('role', role)
u.set('verified', true)
u.set('emailVisibility', false)
@@ -106,16 +106,8 @@ migrate(
{ name: 'notes', type: 'text', max: 2000 },
// -- versioning (replaces_id chain) + audit --
{
name: 'replaces',
type: 'relation',
required: false,
collectionId: '', // self-reference; patched to documents.id after save
cascadeDelete: false,
minSelect: 0,
maxSelect: 1,
presentable: false,
},
// `replaces` (self-relation, the version chain) is added after the
// first save below — its target id does not exist until then.
{ name: 'version', type: 'number', min: 1 },
{
name: 'uploaded_by',
@@ -152,12 +144,23 @@ migrate(
})
app.save(documents)
// Point the self-referential `replaces` relation at the now-created
// collection (its id wasn't known before the first save).
// Add the self-referential `replaces` relation now that the collection has
// an id. PocketBase rejects a relation with a blank collectionId, so it
// cannot be part of the first save.
const saved = app.findCollectionByNameOrId('documents')
const replaces = saved.fields.find((f) => f.name === 'replaces')
if (replaces) {
replaces.collectionId = saved.id
if (!saved.fields.getByName('replaces')) {
saved.fields.add(
new Field({
name: 'replaces',
type: 'relation',
required: false,
collectionId: saved.id,
cascadeDelete: false,
minSelect: 0,
maxSelect: 1,
presentable: false,
}),
)
app.save(saved)
}
},