Files
Docwell/Docs-Site/guide/configuration.md
T
tajniak81andClaude Opus 5.5 9d674e9699
CI / go (Media) (push) Successful in 14m33s
CI / go (Server) (push) Failing after 23m30s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 9m30s
CI / desktop (ubuntu-latest) (push) Successful in 1h21m24s
CI / mobile (push) Failing after 4m16s
CI / docker (push) Successful in 1h1m25s
Docs / build (push) Successful in 14m59s
Docs / deploy (push) Skipped
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Add invite links with approval, sharing switches, page views and unused-file cleanup
Phase G of docs/AFFINE.md (ADR-17):

- Invite links: one per workspace (member or guest, optional end date,
  optional admin approval) on a new /join page. Requests are approved
  (optionally as another role) or declined from workspace settings;
  join_request, join_approved and join_declined notifications reach the
  inbox, phones and the email digest. Workspace admins decide, else the
  organization's admins, else superadmins. Signup honours ?redirect=.
- Workspace switches: allowSharing (off makes every share link answer 404
  until it is back on) and urlPreview (chat apps may show private pages'
  titles). docwell-web writes title and Open Graph tags for known
  link-preview bots, asking docwell-server via DOCWELL_PREVIEW_API_URL;
  search engines are left out.
- Page analytics: page_views counts opens per page, person and day from
  the existing visit call and share-link reads; editors see totals, a
  daily chart and recent viewers in the Info panel. analytics.prune
  drops rows after 400 days.
- Unused files: attachments whose id appears in no page's Yjs state,
  page icon or comment (older than a day) are listed and deleted from
  workspace settings.
- Migration, schema snapshot, OpenAPI, generated clients, translations
  in five languages, phone inbox, compose files and user docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:59:55 +01:00

93 lines
8.8 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 and the AI vectors (`ai.db`). Both are rebuilt from the database when missing, so a volume is optional but makes restarts faster (and saves embedding every page again). |
| `DOCWELL_SECRET_KEY` | — | Encrypts the API keys of AI providers, the passwords and Google sign-ins of people's calendars, and their Readwise tokens. Without it, a key derived from `DOCWELL_PB_PASSWORD` is used; changing whichever is in use means entering the keys and passwords again. |
| `DOCWELL_MEDIA_URL` | — (`http://media:8090` in the compose stacks) | docwell-media, which cuts recordings over 25 MB into pieces for transcription with ffmpeg. Blank: the server uses its own ffmpeg if it has one (the all-in-one image does), and otherwise cuts only MP3 and WAV. If docwell-media cannot be reached, the server falls back the same way. |
| `DOCWELL_MEDIA_TOKEN` | — | Shared secret between docwell-server and docwell-media; set the same value on both, or leave both blank. |
| `DOCWELL_GOOGLE_CLIENT_ID`, `DOCWELL_GOOGLE_CLIENT_SECRET` | — | A Google OAuth app (web application) people sign in to for **Connect Google Calendar**. Enable the Google Calendar API in its project, add the scope `calendar.readonly`, and register `{DOCWELL_PUBLIC_URL}/api/v1/oauth/google/callback` as a redirect URI. Blank turns it off. |
| `DOCWELL_MICROSOFT_CLIENT_ID`, `DOCWELL_MICROSOFT_CLIENT_SECRET` | — | A Microsoft Entra app registration (web platform, a client secret, delegated permissions `Notes.Read`, `User.Read`, `offline_access`) for importing OneNote notebooks. Register `{DOCWELL_PUBLIC_URL}/api/v1/oauth/microsoft/callback` as a redirect URI. Blank turns it off. |
| `DOCWELL_MICROSOFT_TENANT` | `common` | Who may sign in to the Microsoft app: `common` (work, school and personal accounts), `organizations`, `consumers`, or your tenant id. |
| `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, people's calendars, Readwise and OneNote imports, and the AI providers of workspaces, call loopback and link-local addresses (private networks are always allowed, so a CalDAV server on your LAN works). For development only (AI providers set up in the admin panel may always use local addresses). |
### 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. |
| `DOCWELL_PREVIEW_API_URL` | `DOCWELL_PROXY_TARGET`, else `DOCWELL_API_URL` | Where docwell-web asks docwell-server for the titles that chat apps (Slack, Teams, Discord, …) show when a page link is posted. The compose files set it to `http://server:8080`. |
## 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 |