Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Kubernetes with Helm

The chart runs the server alone. Bring PostgreSQL with pgvector and an S3-compatible store: an operator such as CloudNativePG for the database, and SeaweedFS, MinIO, Garage, Ceph or a cloud store for files. Every value is explained in Helm chart values.

Prerequisites

  • A Kubernetes cluster, and Helm 3.8 or newer (for OCI charts).
  • PostgreSQL 16+ with pgvector 0.8+, with a database and an ordinary role for Drusite.
  • An S3-compatible bucket, and credentials for it.
  • An Ingress controller (or a Gateway) that passes WebSockets, and a certificate for your host.

1. Make the Secret

The chart mounts one Secret’s keys as files under /run/secrets/drusite/. The default config reads three:

kubectl create namespace drusite
kubectl -n drusite create secret generic drusite \
  --from-literal=database-url='postgres://drusite:PASSWORD@postgres.example.test:5432/drusite' \
  --from-literal=s3-secret-access-key='SECRET' \
  --from-literal=master-key="$(docker run --rm ghcr.io/pranavajk1/drusite-server:1 keys generate)"

Keep a copy of master-key outside the cluster: see the master key, backups and restore. If you use External Secrets, Sealed Secrets or Vault, make the same Secret with those instead.

2. Write your values

values.yaml:

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

  [database]
  url_file = "/run/secrets/drusite/database-url"

  [storage]
  endpoint = "https://s3.example.com"
  bucket = "drusite"
  access_key_id = "drusite"
  secret_access_key_file = "/run/secrets/drusite/s3-secret-access-key"

  [keys]
  source = "file"
  path = "/run/secrets/drusite/master-key"

  [auth.passkeys]
  enabled = true

secret:
  name: drusite

ingress:
  enabled: true
  className: nginx
  host: notes.example.com
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 110m
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    cert-manager.io/cluster-issuer: letsencrypt
  tls:
    - hosts: [notes.example.com]
      secretName: notes-tls

config is the whole config file, so add sign-in methods, AI and anything else from the configuration reference to it. Values that change per environment can come from env instead (DRUSITE__AUTH__SELF_SIGNUP, say).

3. Install

helm install drusite oci://ghcr.io/pranavajk1/charts/drusite \
  --version 1.0.0 -n drusite -f values.yaml
kubectl -n drusite rollout status deploy/drusite

The pod runs the migrations before it listens; its startup probe allows five minutes for that. Then make the first account:

kubectl -n drusite exec deploy/drusite -- drusite-server account create you@example.com

Upgrading

helm upgrade drusite oci://ghcr.io/pranavajk1/charts/drusite \
  --version 1.0.1 -n drusite -f values.yaml

The chart’s version is the server’s: chart 1.0.1 runs server 1.0.1 unless image.tag says otherwise. Read Upgrading before a minor or major version.

More than one replica

Server pods hold no state, so replicaCount: 2 or more works behind the Service. Each pod has its own connection pool ([database] max_connections, 16 by default), so size PostgreSQL’s max_connections for all of them. Migrations take a lock, so pods starting together don’t run them twice.

Verify the chart and image

Both are signed with cosign by the workflow that built them:

cosign verify ghcr.io/pranavajk1/charts/drusite:1.0.0 \
  --certificate-identity-regexp '^https://github.com/pranavajk1/drusite/\.github/workflows/image\.yml@' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Releases and update channels has the image’s command.