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: