Files
Docwell/Docker-AIO/docker-compose.prod.seaweedfs.split.yml
T
tajniak81andClaude Opus 5.5 f7a2ded680
CI / go (Media) (push) Successful in 13m22s
CI / go (Server) (push) Failing after 24m20s
CI / go (Web-App) (push) Successful in 14m3s
CI / frontend (push) Failing after 9m19s
CI / mobile (push) Failing after 6m19s
CI / docker (push) Successful in 20m37s
CI / desktop (ubuntu-latest) (push) Successful in 1h9m43s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Give the all-in-one setup every storage shape, from source and baked in
Docker-AIO now has one compose file per storage shape for each way of
getting the image, each with an .env template of the same name:
- From source: docker-compose.yml (now with .env.example),
  docker-compose.s3.yml, docker-compose.seaweedfs.yml and
  docker-compose.seaweedfs.split.yml. The SeaweedFS ones run it in
  containers beside the plain image, as the prod files did before.
- Production: docker-compose.prod.seaweedfs*.yml now run one container
  from new images with SeaweedFS built in. Dockerfile.seaweedfs runs
  `weed server -s3`; Dockerfile.seaweedfs.split runs master, volume,
  filer, S3 gateway and admin UI as separate processes, and seeds
  PocketBase's key into the filer's IAM store so the admin UI cannot
  displace it.

SeaweedFS listens on the container's loopback (volume server on 8081,
as docwell-server has 8080); only the split image's admin UI is
published, on loopback by default. start.sh now also watches the
processes a wrapper started, so the container restarts as a whole when
any SeaweedFS role stops. The release workflow publishes the two new
images, docwell-seaweedfs and docwell-seaweedfs-split.

Existing SeaweedFS installs keep their data: every file uses the
`weed server -dir` layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:29:46 +01:00

147 lines
7.9 KiB
YAML

name: docwell-aio
# Production Docwell all-in-one with SeaweedFS split into its roles, all built
# into ONE image: Dockerfile.seaweedfs.split runs master, volume, filer, S3
# gateway and the SeaweedFS admin UI as separate processes in the same
# container as PocketBase, docwell-server and docwell-web. One service, one
# container, four volumes. What the split still buys in here: the admin UI
# (Object Store -> Users mints and revokes S3 keys) and per-role metrics ports.
# For SeaweedFS in containers of its own (upgrade by tag, per-role restart),
# use docker-compose.seaweedfs.split.yml; the data volume is interchangeable.
#
# Self-contained: one file, no overlays. Everything an operator needs to set
# lives in .env.
#
# 1. cp .env.prod.seaweedfs.split.example .env (then edit it: passwords, URL, S3 keys)
# 2. docker compose -f docker-compose.prod.seaweedfs.split.yml pull
# (or `build`, on a host with this checkout)
# 3. docker compose -f docker-compose.prod.seaweedfs.split.yml up -d
#
# `image:` and `build:` are both set, so the same file pulls the released
# docwell-seaweedfs-split image or builds it; a built one can be `push`ed to AIO_IMAGE and
# pulled elsewhere. What baking SeaweedFS in costs: a new SeaweedFS is a new
# image (SEAWEED_VERSION), not a tag change.
#
# PocketBase keeps uploaded files (attachments, images, avatars) in the bucket
# instead of on the pb_data volume; the database and PocketBase's own backups
# stay on PB_DATA. Clients cannot tell: files are always fetched through
# docwell-server, never from a bucket URL.
#
# Before switching a stack that already has uploads: PocketBase does NOT copy
# existing files into the bucket. See README.md.
#
# Traffic flow (browser): one port. docwell-web serves the app and proxies
# /api, /collab and /admin to docwell-server inside the container; PocketBase
# and every SeaweedFS role but the admin UI listen on the container's loopback.
#
# On every boot the container creates the bucket and seeds the S3 identity, creates or
# updates the PocketBase superuser from PB_ADMIN_*, and docwell-server brings
# the collections up to Docwell's schema and writes the env-driven settings
# (mail, app URL, file storage). All idempotent, so restarts and upgrades are
# safe.
services:
docwell:
build:
# The repository root (one level up from this compose file).
context: ..
dockerfile: Docker-AIO/Dockerfile.seaweedfs.split
args:
# Bare names: passed only when set, so an unset one keeps the
# Dockerfile's pin.
- PB_VERSION
- SEAWEED_VERSION
image: "${AIO_IMAGE:-${DOCWELL_REGISTRY:-ghcr.io/docwell}/docwell-seaweedfs-split:${DOCWELL_VERSION:-latest}}"
container_name: docwell-aio
restart: unless-stopped
environment:
# The PocketBase superuser the bundled server signs in with. REQUIRED.
PB_ADMIN_EMAIL: "${PB_ADMIN_EMAIL:?set PB_ADMIN_EMAIL in .env}"
PB_ADMIN_PASSWORD: "${PB_ADMIN_PASSWORD:?set PB_ADMIN_PASSWORD in .env}"
# Encrypts PocketBase's stored settings (SMTP password, S3 secret).
# Exactly 32 characters; blank = off. Set it before the first boot and
# never lose it: the settings cannot be read without it.
PB_ENCRYPTION_KEY: "${PB_ENCRYPTION_KEY:-}"
# The public address: links in auth emails and share links point here.
DOCWELL_WEB_URL: "${DOCWELL_WEB_URL:-http://localhost:3000}"
DOCWELL_PUBLIC_URL: "${DOCWELL_WEB_URL:-http://localhost:3000}"
DOCWELL_CORS_ORIGINS: "${DOCWELL_WEB_URL:-http://localhost:3000}"
DOCWELL_APP_NAME: "${DOCWELL_APP_NAME:-}"
DOCWELL_DRAWIO_URL: "${DOCWELL_DRAWIO_URL:-}"
# Defaults until a superadmin saves sign-up rules in the admin panel.
DOCWELL_SIGNUP_ENABLED: "${DOCWELL_SIGNUP_ENABLED:-true}"
# Optional: creates the first account as superadmin while there are no accounts.
DOCWELL_ADMIN_EMAIL: "${DOCWELL_ADMIN_EMAIL:-}"
DOCWELL_ADMIN_PASSWORD: "${DOCWELL_ADMIN_PASSWORD:-}"
DOCWELL_ADMIN_NAME: "${DOCWELL_ADMIN_NAME:-}"
DOCWELL_SIGNUP_DOMAINS: "${DOCWELL_SIGNUP_DOMAINS:-}"
DOCWELL_MAX_UPLOAD_MB: "${DOCWELL_MAX_UPLOAD_MB:-50}"
DOCWELL_AUDIT_RETENTION_DAYS: "${DOCWELL_AUDIT_RETENTION_DAYS:-}"
# Verification, password reset and sign-in codes, sent by PocketBase.
DOCWELL_MAIL_FROM: "${DOCWELL_MAIL_FROM:-}"
DOCWELL_SMTP_HOST: "${DOCWELL_SMTP_HOST:-}"
DOCWELL_SMTP_PORT: "${DOCWELL_SMTP_PORT:-587}"
DOCWELL_SMTP_USERNAME: "${DOCWELL_SMTP_USERNAME:-}"
DOCWELL_SMTP_PASSWORD: "${DOCWELL_SMTP_PASSWORD:-}"
DOCWELL_SMTP_TLS: "${DOCWELL_SMTP_TLS:-false}"
# --- File storage: the SeaweedFS inside this container -----------------
# The image fixes the rest (DOCWELL_S3_ENABLED, the loopback endpoint,
# path style, the region). Applied by docwell-server on every start, so
# these win over the admin panel's Storage screen.
#
# The key pair does double duty: it is the gateway's identity, which
# takes it out of its default allow-anyone mode, and what PocketBase
# signs in with. No safe defaults: without it the container refuses to
# start.
DOCWELL_S3_BUCKET: "${DOCWELL_S3_BUCKET:-docwell}"
DOCWELL_S3_ACCESS_KEY: "${DOCWELL_S3_ACCESS_KEY:?set DOCWELL_S3_ACCESS_KEY in .env}"
DOCWELL_S3_SECRET: "${DOCWELL_S3_SECRET:?set DOCWELL_S3_SECRET in .env}"
# --- SeaweedFS admin UI ------------------------------------------------
# Cluster view and Object Store -> Users, where S3 keys are minted and
# revoked. It can hand out keys to the bucket, so its password is
# required (weed turns the login off when it is empty, and the container
# refuses to start without one).
WEED_ADMIN_USER: "${SEAWEED_ADMIN_USER:-admin}"
WEED_ADMIN_PASSWORD: "${SEAWEED_ADMIN_PASSWORD:?set SEAWEED_ADMIN_PASSWORD in .env}"
# Optional view-only login.
WEED_ADMIN_READONLY_USER: "${SEAWEED_ADMIN_READONLY_USER:-}"
WEED_ADMIN_READONLY_PASSWORD: "${SEAWEED_ADMIN_READONLY_PASSWORD:-}"
volumes:
# Named volumes by default; set them to host paths in .env for bind
# mounts.
# Database, uploads made before S3 was on, PocketBase backups.
- "${PB_DATA:-pb_data}:/pb_data"
# The search index, rebuilt from the database when missing.
- "${SERVER_DATA:-server_data}:/data"
# SeaweedFS: from here on the attachments live here. Back it up
# together with PB_DATA.
- "${SEAWEED_DATA:-seaweed_data}:/seaweed/data"
# The admin UI's session key and maintenance settings; no object data.
- "${SEAWEED_ADMIN_DATA:-seaweed_admin}:/seaweed/admin"
ports:
# The app: API, /collab websocket and /admin panel.
- "${WEB_BIND:-0.0.0.0}:${WEB_PORT:-3000}:3000"
# The SeaweedFS admin UI. Loopback by default: it is storage plumbing,
# not one of the app's panels. Set SEAWEED_ADMIN_BIND=0.0.0.0 only
# behind a reverse proxy.
- "${SEAWEED_ADMIN_BIND:-127.0.0.1}:${SEAWEED_ADMIN_PORT:-23646}:23646"
# Nothing else of SeaweedFS is published: PocketBase reaches the gateway
# inside the container, and the volume server serves file content by id
# with no authentication.
healthcheck:
# Declared here as well as in the image, so it holds for any image tag.
# Every SeaweedFS role and the app (the version endpoint answers through
# docwell-web's proxy, so all three app processes) must answer.
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:9333/cluster/status >/dev/null && wget -qO- http://127.0.0.1:8081/healthz >/dev/null && wget -qO- http://127.0.0.1:8888/healthz >/dev/null && wget -qO- http://127.0.0.1:8333/healthz >/dev/null && wget -qO- http://127.0.0.1:23646/health >/dev/null && wget -qO- http://127.0.0.1:3000/api/v1/version >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 60s
volumes:
pb_data:
server_data:
# The `weed server -dir` layout, shared with every other SeaweedFS file here.
seaweed_data:
seaweed_admin: