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 of how an installation is built. The procedure itself is in Installing, step by step.
The bundle and the licence
Every draften release is one bundle, a file draften-<version>.tar. It contains the images of all the services, the files that start them, a signed list of everything inside and the ./draften command that manages the installation. The server needs nothing but Docker.
To run it you need a licence — a file you get from us and upload in the interface. It limits the number of mailboxes and assistants, and its key is also used to download new releases. More in The licence.
What an installation is made of
Everything runs in Docker through docker compose:
| Service | What it does |
|---|---|
db | the MariaDB database — holds everything: settings, instructions, messages, drafts, encrypted secrets. Nothing from another machine touches it |
worker | reads the mailboxes, calls the models, writes drafts, learns, runs the wizard's steps. Several may run |
web-blue, web-green | the web interface and API in two colours: one serves, the other waits for the next version — that is why the web is updated without an outage |
proxy | the way in from outside: switches between the web colours and optionally ends HTTPS |
updater | optionally: carries out what the operator asks for under Installation (update, going back, the number of processes, replacing the key, a backup) and backs up the database every day |
cloudflared | optionally: 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
- an x86-64 server with Linux and Docker 24 or newer (with the compose plugin), 4 GB of memory and 20 GB of disk,
- the address the interface will be reachable at, with HTTPS — a certificate right in draften, or your reverse proxy or tunnel,
- access to the mailboxes: an app in Microsoft Entra or in Google Cloud, or IMAP details,
- a model API key (Anthropic, OpenAI) or your own OpenAI-compatible server,
- a licence from us.
In detail, including the network and what draften has been tried on: Supported environment.
HTTPS
- In draften: give the installer the certificate and its key (PEM). draften then listens on port 443 and redirects from port 80. You deploy a renewed certificate with
./draften certificate new.pem new.keywithout losing a single request. You obtain the certificate yourself (from a certificate authority or with an ACME client). - In front of draften: without a certificate, draften listens on
127.0.0.1:8085and your proxy or tunnel ends HTTPS.
The updater
The updater is an optional service that carries out what the operator asks for under Installation → Installation: an update to a new version, going back to the previous one, changing the number of worker processes, replacing the encryption key and a database backup. On top of that it backs up the database every day by itself. For that it runs the same ./draften you would run yourself.
The updater has access to Docker, which means root rights on the server. The interface itself never touches Docker — it only writes a request into the database for the updater. It is switched on at installation (COMPOSE_PROFILES=updater in .env); without it, everything works from the command line.
Settings in .env
The .env file in the installation directory is written by the installer and readable only by its owner. It holds the infrastructure and the secrets; everything about assistants is in the database and set in the interface.
| Variable | What for |
|---|---|
DRAFTEN_VERSION, DRAFTEN_EDITION | the version running and the edition (onprem) |
DB_ROOT_PASSWORD, DB_PASSWORD | database passwords |
MASTER_KEY | the key encrypting the secrets in the database (API keys, mailbox access, sign-in clients). Keep a copy off the server |
MASTER_KEY_PREVIOUS | the previous key after it was replaced, as long as backups/ holds dumps from before that |
WEB_APP_SECRET | a random string signing sessions |
WEB_PUBLIC_URL | the address people open the interface at; the sign-in redirect addresses are built from it |
WEB_BIND, DRAFTEN_TLS, WEB_TLS_BIND | where HTTP and HTTPS listen |
COMPOSE_PROFILES | optional services: updater, tunnel |
DRAFTEN_BACKUPS | how many database dumps from before an update to keep in backups/ (default 3) |
DRAFTEN_DAILY_BACKUPS | how many daily backups and backups on request to keep (default 7; 0 turns the daily one off) |
DRAFTEN_BACKUP_AT, DRAFTEN_TIMEZONE | the time of the daily backup and its zone (default 01:00, Europe/Prague); a time set in the interface wins |
CLOUDFLARE_TUNNEL_TOKEN | only with a Cloudflare Tunnel |
INTERVAL_SECONDS, WORKER_CONCURRENCY | the default check interval and concurrent checks (better set in the interface) |
WORKER_REPLICAS | how many worker processes run on this machine (default 1), see Operations and capacity |
A value with a $ sign must be written as $$ in .env — otherwise the part after the dollar is silently lost. Keys generated with openssl rand -hex 32 never contain a dollar.
What lies where
.env | the installation's settings and secrets |
compose.yaml, proxy/ | how the containers run; every update replaces them |
backups/ | database dumps: daily, on request and from before updates — copy them off the server |
data/ | the worker's log and reports |
updates/ | bundles waiting to be installed; the updater downloads here too |
NOTES.md | what the installed release changed |
Next
- Installing, step by step,
- Installation administration — version, licence, default keys and sender, organisations,
- Updating with the updater and from the command line,
- Operations and capacity,
- Backup and restore,
- Troubleshooting.