Skip to content

Docker Compose

deploy/compose runs a whole Drusite server on one machine: drusite-server, PostgreSQL 18 with pgvector, and SeaweedFS as the S3-compatible store. This page turns the quick start into a server for real use.

Prerequisites

  • A Linux machine (or any with Docker) with Docker Engine and Compose v2.
  • A domain name pointing at it, such as notes.example.com.
  • A reverse proxy for HTTPS. The example below adds Caddy to the same Compose project; Reverse proxies and TLS covers nginx and Traefik.

1. Get the files and make the secrets

Terminal window
git clone --depth 1 https://github.com/drusitehq/drusite.git
cp -r drusite/deploy/compose /srv/drusite && cd /srv/drusite
./setup.sh

setup.sh refuses to run twice, so it can’t overwrite your master key. What it writes:

File in secrets/ What it is
postgres_password PostgreSQL’s superuser password, used only by the first start’s initdb script
db_password, database_url The password of drusite, the ordinary role the server connects as, and its URL
s3.json, s3_secret_key SeaweedFS’s credentials, and the server’s copy of the secret
master_key The master key (drusite-server keys generate)

Back up secrets/ now, somewhere other than this machine. See the master key, backups and restore.

2. Choose the version

compose.yaml runs ghcr.io/drusitehq/drusite-server:${DRUSITE_VERSION:-1}: the newest 1.x release whenever the image is pulled. To choose when you upgrade, pin a full version in a .env file beside compose.yaml:

Terminal window
echo DRUSITE_VERSION=1.3.2 > .env

3. Edit drusite.toml

At least:

public_url = "https://notes.example.com"

public_url is where people and apps reach the server. Sign-in links, passkeys and OAuth redirects are built from it, so it must be the address in the browser, https included.

Then the sign-in methods. The file has passkeys and passwords on and sign-up off; see Sign-in methods to change that, add OIDC, or set up email. Every other setting is in the configuration reference. Check the result without starting anything:

Terminal window
docker compose run --rm drusite check-config
config OK. Login methods:
Passkeys
Password

4. Start it and make the first account

Terminal window
docker compose up -d
docker compose run --rm drusite account create you@example.com --name "Your Name"

Open the printed link, and add a passkey or a password on the account page it shows.

HTTPS with Caddy

Caddy gets a certificate on its own. Add it to the project with a compose.override.yaml beside compose.yaml:

services:
caddy:
image: caddy:2
restart: unless-stopped
ports: ["80:80", "443:443"]
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy:/data
drusite:
ports: !reset []
volumes:
caddy:

and a Caddyfile:

notes.example.com {
request_body {
max_size 110MB
}
reverse_proxy drusite:8080
}

ports: !reset [] stops the server’s port 8080 being published on the host, so only Caddy reaches it. max_size lets attachments up to [attachments] max_bytes (100 MiB by default) through. Caddy passes WebSockets as they are, which sync needs.

Day-to-day

To Run
See the logs docker compose logs -f drusite
Check it’s ready curl -s https://notes.example.com/readyz
Run a server command docker compose run --rm drusite <command> (all of them)
Let someone back in docker compose run --rm drusite account recover them@example.com
Upgrade docker compose pull && docker compose up -d (read first)
Back up The master key, backups and restore

Using your own PostgreSQL or object store

Delete the postgres, seaweedfs or bucket service from compose.yaml (and from the server’s depends_on), then point drusite.toml at yours. PostgreSQL and object storage say what each needs.

Publishing pages on their own host

To serve published pages from a host of their own, uncomment [publish] in drusite.toml and the 8443:8443 port in compose.yaml, then expose only that port (or that host name) to the internet.