Files
Docwell/Docker/README.md
T
tajniak81andClaude Opus 5.5 ad26727521
CI / go (Server) (push) Successful in 16m33s
CI / go (Web-App) (push) Successful in 12m1s
CI / frontend (push) Failing after 6m32s
CI / desktop (ubuntu-latest) (push) Failing after 21m52s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / mobile (push) Failing after 5m2s
CI / docker (push) Successful in 18m56s
Docs / build (push) Successful in 10m45s
Docs / deploy (push) Skipped
Add production compose variants and base docwell-db on the PocketBase image
Docker/ and Docker-AIO/ each get docker-compose.prod.yml plus S3,
SeaweedFS and SeaweedFS-split variants, with matching .env.prod*.example
templates and a README.

docwell-db is now built FROM tajniak81/pocketbase-docker-root, which
creates the superuser and serves PocketBase on 8090; data moves to
/pb/pb_data. The boot hook applies DOCWELL_S3_* settings when set.
The AIO start script accepts PB_ENCRYPTION_KEY. The base image is
amd64-only, so the docwell-db release builds amd64 only for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 11:39:01 +01:00

6.2 KiB

Docwell: separate services

docwell-db (PocketBase), docwell-server and docwell-web, each in its own container. For everything in one container, see ../Docker-AIO.

Compose file Env template Uploaded files live in Use it for
docker-compose.yml .env.example the pb_data volume development: builds this checkout (--build), Mailpit with --profile dev
docker-compose.prod.yml .env.prod.example the pb_data volume production, released images
docker-compose.prod.s3.yml .env.prod.s3.example an S3 bucket that already exists elsewhere production with AWS S3, MinIO, an existing SeaweedFS...
docker-compose.prod.seaweedfs.yml .env.prod.seaweedfs.example SeaweedFS in this stack, one container production, self-hosted object store
docker-compose.prod.seaweedfs.split.yml .env.prod.seaweedfs.split.example SeaweedFS in this stack, one container per role + admin UI the same, with the SeaweedFS admin UI and per-role control

Every production file is self-contained: pick one, copy its template to .env, and pass the file with -f.

cp .env.prod.example .env      # then edit: passwords, URLs, ports
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d

The web app is on WEB_PORT (3000) and the API, the /collab websocket and the admin panel (/admin/) on SERVER_PORT (8080). Both are public, because the browser calls the API directly. Set DOCWELL_WEB_URL, DOCWELL_PUBLIC_URL and DOCWELL_COLLAB_URL to the addresses browsers use. The first account that signs up becomes the instance admin.

The PocketBase image

docwell-db is built FROM tajniak81/pocketbase-docker-root (source: freefall-dev/PocketBase-docker, root variant), with Docwell's pb_migrations and pb_hooks copied into /pb. That image downloads a pinned PocketBase release and checks it against the published checksums. On every start its entrypoint creates the superuser from PB_ADMIN_EMAIL and PB_ADMIN_PASSWORD if it does not exist yet, then starts pocketbase serve, which applies pending migrations.

  • Data lives in /pb/pb_data in the container.
  • The PocketBase version follows the base image tag, set by PB_IMAGE in Database/Dockerfile (docker build --build-arg PB_IMAGE=tajniak81/pocketbase-docker-root:0.40.6 Database).
  • The base image is published for linux/amd64 only, so docwell-db is amd64-only for now.
  • PB_ENCRYPTION_KEY (exactly 32 characters, openssl rand -hex 16) turns on PocketBase's settings encryption, which keeps the stored SMTP password and S3 secret encrypted. Set it before the first start and keep a copy.

Changing the PocketBase password

The entrypoint only creates the superuser. Once it exists, a new PB_ADMIN_PASSWORD in .env is not written to the database, and docwell-server, which signs in with the value from .env, can no longer connect. Change it in the database first, then in .env:

docker compose -f docker-compose.prod.yml exec db \
  /pb/pocketbase superuser upsert admin@example.com 'the-new-password' --dir /pb/pb_data
# now set PB_ADMIN_PASSWORD to the same value in .env, then:
docker compose -f docker-compose.prod.yml up -d

(With PB_ENCRYPTION_KEY set, add --encryptionEnv=PB_ENCRYPTION_KEY to that command.)

File storage

By default uploaded files sit in pb_data/storage, next to the database. The S3 and SeaweedFS files move them into a bucket instead; the database and PocketBase's own backups stay in pb_data either way. Clients never see the bucket: every file goes through docwell-server.

The storage settings come from the DOCWELL_S3_* variables, which docwell-db's boot hook writes into PocketBase on every start. While DOCWELL_S3_ENABLED is set they win over the admin panel's Storage screen; with the plain docker-compose.prod.yml (no DOCWELL_S3_*) the admin panel is in charge. "Test the saved bucket" in that screen checks the connection either way.

  • External S3 (prod.s3): the endpoint and the bucket must already exist. For a gateway on the Docker host itself, use http://host.docker.internal:8333; the file maps that name. Set DOCWELL_S3_FORCE_PATH_STYLE=false for AWS S3.
  • SeaweedFS (prod.seaweedfs): weed server -s3 in one container. The S3 credentials from .env are the gateway's only identity; a one-shot seaweedfs-init container creates the bucket.
  • SeaweedFS split (prod.seaweedfs.split): master, volume, filer and S3 gateway in separate containers plus the SeaweedFS admin UI on 127.0.0.1:${SEAWEED_ADMIN_PORT} (23646), which needs SEAWEED_ADMIN_PASSWORD. seaweedfs-init writes PocketBase's identity into the filer's IAM store (the one the admin UI edits) on every start and refuses to let the gateway start without it. Both SeaweedFS files lay out SEAWEED_DATA the same way, so you can switch between them without moving data.

Back up SEAWEED_DATA together with PB_DATA: once S3 is on, the attachments live there.

Switching an existing install to S3

PocketBase does not copy files that were uploaded before the switch; they stop loading until they are in the bucket. Copy them while Docwell is stopped:

docker compose -f docker-compose.prod.yml down
# Copy everything under pb_data/storage/ into the bucket root, keeping the paths,
# e.g. with the AWS CLI (or `mc mirror`, `rclone copy`):
docker run --rm -v docwell_pb_data:/pb_data:ro --network docwell_default \
  -e AWS_ACCESS_KEY_ID=... -e AWS_SECRET_ACCESS_KEY=... \
  amazon/aws-cli s3 sync /pb_data/storage s3://docwell/ --endpoint-url http://seaweedfs:8333
docker compose -f docker-compose.prod.seaweedfs.yml up -d

For the in-stack SeaweedFS, start seaweedfs and seaweedfs-init first (docker compose -f docker-compose.prod.seaweedfs.yml up -d seaweedfs-init), so there is a bucket to copy into.

Upgrading

docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d

Migrations run when docwell-db starts. Pin DOCWELL_VERSION in production, and take a backup first (admin panel → Backups, or a copy of the pb_data volume).