# Docwell: all-in-one PocketBase, docwell-server and docwell-web in one container, behind one port. For small self-hosted installs; for separate, individually scalable services see [`../Docker`](../Docker/README.md). Each shape of storage has one self-contained compose file per way of getting the image, and an `.env` template of the same name (`docker-compose.s3.yml` takes `.env.s3.example`, `docker-compose.prod.seaweedfs.yml` takes `.env.prod.seaweedfs.example`, and so on): | Uploaded files live in | From source (`up -d --build`) | Production (`pull`) | Image | |---|---|---|---| | the `pb_data` volume | `docker-compose.yml` | `docker-compose.prod.yml` | `Dockerfile` | | an S3 bucket that already exists elsewhere (AWS S3, MinIO, another SeaweedFS...) | `docker-compose.s3.yml` | `docker-compose.prod.s3.yml` | `Dockerfile` | | SeaweedFS, one `weed server -s3` process | `docker-compose.seaweedfs.yml`: in a container beside this one | `docker-compose.prod.seaweedfs.yml`: built into the image | `Dockerfile` / `Dockerfile.seaweedfs` | | SeaweedFS, one process per role, plus its admin UI | `docker-compose.seaweedfs.split.yml`: in containers beside this one | `docker-compose.prod.seaweedfs.split.yml`: built into the image | `Dockerfile` / `Dockerfile.seaweedfs.split` | ```bash cp .env.prod.example .env # then edit: passwords, DOCWELL_WEB_URL docker compose -f docker-compose.prod.yml pull docker compose -f docker-compose.prod.yml up -d ``` From source, from this directory: ```bash cp .env.example .env # then edit docker compose up -d --build ``` `docker-compose.yml` also runs without a `.env`: `PB_ADMIN_PASSWORD=... docker compose up -d` pulls the released image with every other setting at its default. Open `DOCWELL_WEB_URL` (http://localhost:3000); the admin panel is at `/admin/`. **The first account that signs up becomes the instance admin.** ## SeaweedFS: beside the container or inside it The from-source SeaweedFS files keep the Docwell image unchanged and run SeaweedFS in containers of their own beside it, plus a one-shot `seaweedfs-init` that creates the bucket (PocketBase never creates one). Adding or dropping the object store needs no rebuild, and a SeaweedFS upgrade is a change of `SEAWEED_IMAGE`. The production SeaweedFS files go the other way and **build it into the image**: one service, one container. - `Dockerfile.seaweedfs` (image `docwell-seaweedfs`) copies the `weed` binary from the official image, pinned by the `SEAWEED_VERSION` build arg, and [`start-seaweedfs.sh`](start-seaweedfs.sh) runs `weed server -s3` and creates the bucket before handing over to [`start.sh`](start.sh). Volumes: `PB_DATA`, `SERVER_DATA`, `SEAWEED_DATA`. - `Dockerfile.seaweedfs.split` (image `docwell-seaweedfs-split`) runs master, volume, filer, S3 gateway and the admin UI as separate processes from [`start-seaweedfs-split.sh`](start-seaweedfs-split.sh), which also seeds the bucket and PocketBase's identity. Volumes: the three above plus `SEAWEED_ADMIN_DATA`. What survives of "split" in one container is per-role metrics ports and the admin UI; what does not is restarting or spreading the roles one by one. Inside, every SeaweedFS role listens on the container's loopback, the volume server on **8081** because 8080 is docwell-server. Nothing of SeaweedFS is published except the split image's admin UI, on loopback by default. `start.sh` watches the SeaweedFS processes with its own three, so the container exits and restarts as a whole if any of them stops. The cost of baking it in: a new SeaweedFS means a new image. The release workflow publishes both images next to `docwell`, so `pull` works as it does for `docker-compose.prod.yml`; on a host with this checkout, `docker compose -f docker-compose.prod.seaweedfs.yml build` builds it instead, and `push` sends it to `AIO_IMAGE`. Switching between any of the SeaweedFS files needs no migration: master, volume and filer share one data mount (`/data` in the side containers, `/seaweed/data` in the baked-in images) in exactly the layout `weed server -dir` writes. ### Identities in the split files SeaweedFS reads credentials from, in descending priority, an `-s3.config` file, the filer's IAM store, then `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`, and a higher source *replaces* a lower one. The single-process files use the environment variables, so nothing else may write identities there: the first user added in a panel would displace PocketBase's key. The split files seed PocketBase's identity into the filer's store instead, the same store the admin UI writes, and refuse to start the gateway if it is not there. Rotating `DOCWELL_S3_SECRET` in `.env` and restarting updates that identity in place. Set `SEAWEED_ADMIN_PASSWORD`: `weed admin` serves the panel with no login when it is empty, and a panel that can mint bucket credentials is the bucket. The split files and image refuse to start without it. ## How it differs from `Docker/` - **One port.** docwell-web proxies `/api`, `/collab` and `/admin` to docwell-server inside the container, so only `DOCWELL_WEB_URL` needs setting. PocketBase listens on the container's loopback; it has no published port. - **The superuser follows `.env`.** The start script runs `pocketbase superuser upsert` on every boot, so a new `PB_ADMIN_PASSWORD` is applied by restarting. - **PocketBase binary.** The image downloads the PocketBase release itself (`PB_VERSION` in the [`Dockerfile`](Dockerfile)) rather than using `tajniak81/pocketbase-docker-root`, because that image is amd64-only and the all-in-one image is published for amd64 and arm64. - Data lives in `/pb_data` (database, uploads, backups) and `/data` (search index) in the container, plus `/seaweed/data` (and `/seaweed/admin`) in the SeaweedFS images. `PB_ENCRYPTION_KEY` (exactly 32 characters, `openssl rand -hex 16`) turns on PocketBase's settings encryption. Set it before the first start and keep a copy. ## File storage The `DOCWELL_S3_*` variables are written into PocketBase by docwell-server on every start, and while they are set they win over the admin panel's **Storage** screen. Only uploaded files move to the bucket; the database and PocketBase's backups stay in `pb_data`. The details of each storage option, and how to copy the files of an existing install into a bucket (PocketBase does **not** move them for you), are in [`../Docker/README.md`](../Docker/README.md#file-storage); they apply here unchanged, with `docwell-aio_pb_data` as the volume name and `/pb_data/storage` as the source path. Back up `SEAWEED_DATA` together with `PB_DATA`: once S3 is on, the attachments live there.