For administrators
← All topics

Installing on your own server

How an installation is built: the bundle and the licence, the services, HTTPS, the updater, the .env settings and what is where.

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:

ServiceWhat it does
dbthe MariaDB database — holds everything: settings, instructions, messages, drafts, encrypted secrets. Nothing from another machine touches it
workerreads the mailboxes, calls the models, writes drafts, learns, runs the wizard's steps. Several may run
web-blue, web-greenthe 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
proxythe way in from outside: switches between the web colours and optionally ends HTTPS
updateroptionally: 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
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

In detail, including the network and what draften has been tried on: Supported environment.

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.

VariableWhat for
DRAFTEN_VERSION, DRAFTEN_EDITIONthe version running and the edition (onprem)
DB_ROOT_PASSWORD, DB_PASSWORDdatabase passwords
MASTER_KEYthe key encrypting the secrets in the database (API keys, mailbox access, sign-in clients). Keep a copy off the server
MASTER_KEY_PREVIOUSthe previous key after it was replaced, as long as backups/ holds dumps from before that
WEB_APP_SECRETa random string signing sessions
WEB_PUBLIC_URLthe address people open the interface at; the sign-in redirect addresses are built from it
WEB_BIND, DRAFTEN_TLS, WEB_TLS_BINDwhere HTTP and HTTPS listen
COMPOSE_PROFILESoptional services: updater, tunnel
DRAFTEN_BACKUPShow many database dumps from before an update to keep in backups/ (default 3)
DRAFTEN_DAILY_BACKUPShow many daily backups and backups on request to keep (default 7; 0 turns the daily one off)
DRAFTEN_BACKUP_AT, DRAFTEN_TIMEZONEthe time of the daily backup and its zone (default 01:00, Europe/Prague); a time set in the interface wins
CLOUDFLARE_TUNNEL_TOKENonly with a Cloudflare Tunnel
INTERVAL_SECONDS, WORKER_CONCURRENCYthe default check interval and concurrent checks (better set in the interface)
WORKER_REPLICAShow 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

.envthe 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.mdwhat the installed release changed

Next

Plain text version