Object storage: SeaweedFS, MinIO, AWS S3
Attachments (images, PDFs, any file on a page) and meeting recordings go to an S3-compatible object store. Each is sealed with its workspace’s key before it leaves the server (or on the members’ devices, in an encrypted workspace), so the store only ever holds ciphertext. Page documents themselves live in PostgreSQL, not here.
Any store that speaks S3 works. These are three common choices; Garage, Ceph’s RGW, Cloudflare R2, Backblaze B2 and Wasabi are set up the same way.
What the server needs
- One bucket, which exists before the server starts. The server doesn’t create it.
- Credentials that can read, write, delete and list in it. On every start the server writes,
reads back and deletes a small object under
_drusite/to prove it can, and stops if it can’t. Its readiness check reads an object that may not exist, which on AWS answers 403 rather than 404 unless the credentials may list the bucket. - Objects are stored under
workspaces/<workspace>/blobs/<id>, afterprefixif you set one to share a bucket.
SeaweedFS
What the Compose file runs. SeaweedFS’s S3 gateway listens on port 8333 and
reads its users from a JSON file (setup.sh writes it as secrets/s3.json):
{"identities": [{"name": "drusite",
"credentials": [{"accessKey": "drusite", "secretKey": "A-LONG-RANDOM-SECRET"}],
"actions": ["Admin", "Read", "Write", "List", "Tagging"]}]}
Make the bucket with weed shell:
echo 's3.bucket.create -name drusite' | weed shell -master=seaweedfs:9333
and point Drusite at it:
[storage]
endpoint = "http://seaweedfs:8333"
bucket = "drusite"
access_key_id = "drusite"
secret_access_key_file = "/run/secrets/s3_secret_key"
MinIO
With an existing MinIO server at minio.example.test:9000, make a bucket, a policy limited to
it, and a user for Drusite with the mc client:
mc alias set local https://minio.example.test:9000 ADMIN_USER ADMIN_PASSWORD
mc mb local/drusite
cat > drusite-policy.json <<'JSON'
{"Version": "2012-10-17", "Statement": [
{"Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": ["arn:aws:s3:::drusite"]},
{"Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
"Resource": ["arn:aws:s3:::drusite/*"]}]}
JSON
mc admin policy create local drusite drusite-policy.json
mc admin user add local drusite A-LONG-RANDOM-SECRET
mc admin policy attach local drusite --user drusite
[storage]
endpoint = "https://minio.example.test:9000"
bucket = "drusite"
access_key_id = "drusite"
secret_access_key_file = "/run/secrets/s3-secret-access-key"
AWS S3
Leave out endpoint, and set the bucket’s region:
[storage]
bucket = "drusite-notes-example"
region = "eu-west-1"
Without access_key_id and secret_access_key, the server finds credentials the way AWS’s own
tools do: the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables, a web identity token
(EKS’s IAM roles for service accounts), or the instance’s metadata (an EC2 instance profile or
an ECS task role). Prefer a role to long-lived keys. Its policy:
{"Version": "2012-10-17", "Statement": [
{"Effect": "Allow", "Action": ["s3:ListBucket"],
"Resource": ["arn:aws:s3:::drusite-notes-example"]},
{"Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
"Resource": ["arn:aws:s3:::drusite-notes-example/*"]}]}
Block public access on the bucket. The server encrypts every object already, so default server-side encryption adds nothing for Drusite but costs nothing either.
Path style and virtual-hosted style
By default the server asks for https://endpoint/bucket/key (path style), which self-hosted
stores expect. Set virtual_hosted_style = true
for https://bucket.endpoint/key, if your store wants that.
Sizes
The largest file a page can hold is [attachments] max_bytes,
100 MiB by default, which also caps a meeting recording (about three hours of speech). Raise it
and your reverse proxy’s body size limit together.
Backups
Copy the bucket with your store’s replication, rclone sync, mc mirror or aws s3 sync. The
database and the bucket go together: backups and restore says how.