Files
Docwell/Docs-Site/guide/configuration.md
T
tajniak81andClaude Opus 5.5 3c7403ddf9 Create the first superadmin from DOCWELL_ADMIN_EMAIL on start
When DOCWELL_ADMIN_EMAIL and DOCWELL_ADMIN_PASSWORD are set (and
optionally DOCWELL_ADMIN_NAME), docwell-server creates that account as
superadmin on start while the instance has no accounts. Once any account
exists it changes nothing, so restarts never reset the password or a role
changed in the admin panel. Without them, the first sign-up still wins.

Pass the variables through every compose file, document them in the
.env examples and the configuration, access and quick-start guides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:32:29 +01:00

86 lines
6.6 KiB
Markdown

# Configuration
Docwell is configured with environment variables, set in `.env` (separate services) or in the
`environment:` section of `docker-compose.yml`. Many settings can also be changed later in the
[admin panel](./administration); where both exist, the table says which wins.
## Database (docwell-db)
docwell-db is a stock PocketBase image (`tajniak81/pocketbase-docker-root`); docwell-server creates and updates
Docwell's collections in it when it starts. Change the image with `DB_IMAGE`.
| Variable | Default | What it does |
| --- | --- | --- |
| `PB_ADMIN_EMAIL` | `admin@docwell.test` | The internal PocketBase superuser. docwell-server signs in with it. |
| `PB_ADMIN_PASSWORD` | *(required)* | Its password. Also the key file links are signed with: changing it ends open file links (they renew on reload). docwell-db only uses it to *create* the superuser; to change it later, see *Changing the PocketBase password* in `Docker/README.md`. The all-in-one image applies a new value at every start. |
| `PB_ENCRYPTION_KEY` | | Exactly 32 characters. Encrypts PocketBase's stored settings (SMTP password, S3 secret). Set it before the first start and keep a copy. |
## API server (docwell-server)
| Variable | Default | What it does |
| --- | --- | --- |
| `DOCWELL_ADDR` | `:8080` | Listen address. |
| `DOCWELL_PB_URL` | `http://127.0.0.1:8070` | Where docwell-db is. Keep it on a private network. |
| `DOCWELL_PB_EMAIL`, `DOCWELL_PB_PASSWORD` | *(required)* | The PocketBase superuser (`PB_ADMIN_EMAIL`, `PB_ADMIN_PASSWORD`). |
| `DOCWELL_PUBLIC_URL` | `http://localhost:8080` | The API's public address. Exported pages link attachments here. |
| `DOCWELL_WEB_URL` | `http://localhost:3000` | The web app's address, for invite and share links, and for the links in PocketBase's emails. |
| `DOCWELL_CORS_ORIGINS` | `http://localhost:5173,http://localhost:3000` | Comma-separated origins allowed to call the API from a browser: the web app's address. |
| `DOCWELL_SIGNUP_ENABLED` | `true` | Self-service sign-up, until a superadmin saves *Authentication* in the admin panel. |
| `DOCWELL_SIGNUP_DOMAINS` | | Comma-separated email domains allowed to sign up (empty: any), with the same rule. |
| `DOCWELL_ADMIN_EMAIL`, `DOCWELL_ADMIN_PASSWORD` | | Creates the first account as superadmin when the server starts and there are no accounts yet. Set both or neither; the password needs 8 characters or more. Once any account exists the server ignores them, so a restart never resets the password or the role. Empty: the first person to sign up becomes the superadmin. |
| `DOCWELL_ADMIN_NAME` | `Admin` | The display name of that account. |
| `DOCWELL_MAX_UPLOAD_MB` | `50` | Largest attachment, 1 to 100. |
| `DOCWELL_DATA_DIR` | `./data` (`/data` in the image) | The search index. It is rebuilt from the database when missing, so a volume is optional but makes restarts faster. |
| `DOCWELL_SHUTDOWN_TIMEOUT` | `15s` | How long to wait for requests and open pages to finish saving on shutdown. |
| `DOCWELL_AUDIT_RETENTION_DAYS` | `365` | How long the audit log keeps entries. `0` keeps them forever. |
| `DOCWELL_WEBHOOKS_ALLOW_LOCAL` | `false` | Let webhooks call loopback and link-local addresses. For development only. |
### PocketBase settings
docwell-server writes these into PocketBase every time it starts.
| Variable | Default | What it does |
| --- | --- | --- |
| `DOCWELL_APP_NAME` | | The name in emails. When set it is applied at every start and overrides *Branding*. |
| `DOCWELL_MAIL_FROM` | `no-reply@docwell.localhost` | Sender address. When set it overrides *Email → Sender address* at every start. |
| `DOCWELL_SMTP_HOST` | | Mail server, for PocketBase's emails (verification, password reset, sign-in links) and docwell-server's own (invites, notifications). When set, all `DOCWELL_SMTP_*` values are applied at every start and override *Admin panel → Email*. Leave it empty to manage mail in the admin panel. |
| `DOCWELL_SMTP_PORT` | `587` | |
| `DOCWELL_SMTP_USERNAME` | | |
| `DOCWELL_SMTP_PASSWORD` | | |
| `DOCWELL_SMTP_TLS` | `false` | `true` for implicit TLS (usually port 465). Port 587 upgrades with STARTTLS on its own. |
| `DOCWELL_S3_ENABLED` | | `true` stores uploaded files in the S3 bucket below, `false` on local disk; either way it is applied at every start and overrides *Admin panel → Storage*. Leave it empty to manage storage in the admin panel. |
| `DOCWELL_S3_ENDPOINT` | | S3 endpoint, for example `https://s3.eu-central-1.amazonaws.com` or `http://seaweedfs:8333`. |
| `DOCWELL_S3_BUCKET` | `docwell` | The bucket. It must exist. |
| `DOCWELL_S3_REGION` | `us-east-1` | |
| `DOCWELL_S3_ACCESS_KEY`, `DOCWELL_S3_SECRET` | | Credentials. |
| `DOCWELL_S3_FORCE_PATH_STYLE` | `true` | `false` for AWS S3; `true` for MinIO and SeaweedFS. |
## Web app (docwell-web)
| Variable | Default | What it does |
| --- | --- | --- |
| `DOCWELL_WEB_ADDR` | `:3000` | Listen address. |
| `DOCWELL_API_URL` | `http://localhost:8080` | The API's address, as browsers reach it. |
| `DOCWELL_COLLAB_URL` | `ws://localhost:8080/collab` | The live-editing WebSocket (`wss://` behind HTTPS). |
| `DOCWELL_DRAWIO_URL` | | The Draw.io editor to embed for diagrams. Empty uses the public `https://embed.diagrams.net`; point it at a self-hosted [jgraph/drawio](https://hub.docker.com/r/jgraph/drawio) to keep drawings on your network. |
| `DOCWELL_PROXY_TARGET` | | When set (for example `http://server:8080`), docwell-web forwards `/api`, `/collab` and `/admin` to docwell-server, so browsers only talk to one address. The all-in-one image does this. |
## Compose
| Variable | Default | What it does |
| --- | --- | --- |
| `DOCWELL_REGISTRY` | `ghcr.io/docwell` | Where `docker compose pull` gets the images. For images released on a Gitea server, `<gitea host>/<owner>`. A Gitea served over plain http must be listed under `insecure-registries` in Docker's `daemon.json`. |
| `DOCWELL_VERSION` | `latest` | Which release to run, for example `0.1.0`. |
| `DB_IMAGE`, `SERVER_IMAGE`, `WEB_IMAGE`, `AIO_IMAGE` | | Production compose files only: one image named outright, overriding the two above. |
| `PB_DATA`, `SERVER_DATA` | named volumes | Production compose files only: a host path to bind-mount instead. |
The production compose files (`docker-compose.prod*.yml` in `Docker/` and `Docker-AIO/`, each with an
`.env.prod*.example` template) also set ports and bind addresses; their READMEs list the S3 and SeaweedFS variants.
## Volumes
| Volume | Holds | Back it up? |
| --- | --- | --- |
| `pb_data` (docwell-db `/pb/pb_data`, all-in-one `/pb_data`) | the database, uploaded files (unless S3 is on), backups | **Yes** |
| `server_data` (docwell-server `/data`) | the search index | No: it is rebuilt from the database |