For administrators
← All topics

Installing on your own server

What the server needs, how to start draften, the first sign-in and how to verify it runs correctly.

You can run draften on your own server. Mail, drafts and keys then stay with you; only what you send to the language model provider leaves (or nothing, with a local model).

This page is an overview. The detailed and always current procedure is in the README.md of the draften repository — follow it; here is only what is good to know up front.

What an installation is made of

Everything runs in Docker through docker compose:

ServiceWhat it does
dbthe MariaDB database — holds everything: settings, instructions, messages, drafts, encrypted secrets
workerreads the mailboxes, calls the models, writes drafts, learns, runs the wizard's steps. Several may run
webthe web interface and API (Symfony on FrankenPHP)
cloudflaredoptionally: publishing the interface through a Cloudflare Tunnel

The interface and the worker do not talk to each other directly — both work with the same database; what needs mail or a model, the interface queues as a job for the worker.

What you will need

On Windows with Docker Desktop, keep it in autostart and turn Resource Saver off.

Settings in .env

The .env file (the template is .env.example) holds only infrastructure and secrets. Everything about assistants is in the database and set in the interface.

VariableWhat for
DB_ROOT_PASSWORD, DB_PASSWORDdatabase passwords
MASTER_KEYthe key encrypting the secrets in the database (API keys, mailbox access, clients). Generate with openssl rand -hex 32 and keep a copy off the server — without it a database backup is unreadable
WEB_APP_SECRETa random string signing sessions
WEB_PUBLIC_URLthe address users open the interface at; the redirect URIs are built from it
CLOUDFLARE_TUNNEL_TOKENonly with a Cloudflare Tunnel
INTERVAL_SECONDS, WORKER_CONCURRENCYthe default check interval and concurrent checks (changeable in the interface too)
WORKER_REPLICAShow many worker processes run on this machine (default 1), see Operations

The first start

  1. docker compose up -d --build — at start the worker runs the database migrations and sets up the initial data by itself.
  2. The operator's first sign-in: until they have a password or a Microsoft or Google binding, a one-time link is in the worker's log (docker compose logs worker | grep set-password). It is valid for 7 days and renewed at every start.
  3. On the Installation page, set the default API keys and the default outgoing mail (for invitations).
  4. On the Organisations page, set up an organisation or send an invitation to found one — see Installation administration.

Publishing

Nothing on the server needs to listen on the internet: a Cloudflare Tunnel (docker compose --profile tunnel up -d) routes the public address to the service http://web:80. Cloudflare Access in front of the address is a sensible second gate. Set WEB_PUBLIC_URL to the public address and add it as a redirect URI at the Microsoft and Google clients.

Next

Plain text version