RustPost

Getting started

Installation with Docker Compose

Run RustPost and its PostgreSQL database from the published image, create the first administrator, and learn how to upgrade, back up and uninstall.

On this page

The published image contains the server, the webmail and the admin console. A compose file runs it next to PostgreSQL 17. This guide takes you from an empty Linux host to a first sign-in.

RustPost is in early development and the edge image follows the main branch. Do not move real mail to it yet.

Requirements

  • A Linux host with Docker Engine and the Compose plugin. A small virtual server is enough to try RustPost; sizing has not been measured yet.
  • A public IPv4 address (IPv6 too if you have it) with a reverse DNS (PTR) record that names your mail host, for example mail.example.org.
  • Outbound port 25 open. Many cloud providers block it; if yours does, configure a smarthost.
  • A domain whose DNS you control.
  • A TLS certificate for the mail host (see TLS certificates). Logins are refused without TLS.

Ports

The container listens on high ports so it can run as an unprivileged user, and compose maps them to the standard ones. Open these in your firewall:

PortServiceContainer port
25SMTP from other servers2525
465Submission, implicit TLS1465
587Submission, STARTTLS1587
143IMAP, STARTTLS1143
993IMAP, implicit TLS1993
4190ManageSieve, STARTTLS14190
443HTTPS: webmail, console, CalDAV, CardDAV, WKD, autoconfiguration1443

PostgreSQL is not published: only the server reaches it, on the compose network. RustPost does not listen on port 80; certbot can use it to get certificates (see below).

1. Get the files

The deployment files are in the deploy/ directory of the rustpost-server repository: compose.image.yaml, .env.example and rustpost.docker.toml. Put them in a directory of their own; this guide uses ~/rustpost, which also makes rustpost the compose project name.

git clone https://github.com/Rust-Post/rustpost-server.git
mkdir -p ~/rustpost/config
cp rustpost-server/deploy/compose.image.yaml ~/rustpost/compose.yaml
cp rustpost-server/deploy/.env.example ~/rustpost/.env
cp rustpost-server/deploy/rustpost.docker.toml ~/rustpost/config/rustpost.toml
cd ~/rustpost

2. Set the database password

Edit .env and set a long random password. PostgreSQL uses it to create the rustpost role the first time it starts, and compose passes it to the server as PGPASSWORD.

sed -i "s|^POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=$(openssl rand -hex 32)|" .env
POSTGRES_PASSWORD=…
# RUSTPOST_IMAGE=public.ecr.aws/u7v0p2s3/rustpost-server:edge

PostgreSQL only reads the password when it creates its volume. To change it later you also need ALTER ROLE rustpost PASSWORD '…' inside the database.

3. Write the configuration

config/rustpost.toml is ready for this compose file. Change hostname to your mail host; everything else can stay as it is for a first start.

hostname = "mail.example.org"

The configuration reference explains every section.

4. Add the certificate

Put the certificate chain and its key in config/ as fullchain.pem and privkey.pem. The container runs as uid 999, which must be able to read them:

sudo cp /etc/letsencrypt/live/mail.example.org/fullchain.pem config/
sudo cp /etc/letsencrypt/live/mail.example.org/privkey.pem config/
sudo chown 999:999 config/*.pem
sudo chmod 600 config/privkey.pem

TLS certificates shows how to get one with certbot, which names to include, and how to renew it.

5. Start

docker compose up -d
docker compose logs -f rustpost

The server waits until PostgreSQL is healthy, creates its tables, and starts listening. Stop following the log with Ctrl+C.

6. Add a domain and the first administrator

The rustpost command in the container manages domains and users. The new user's password is read from RUSTPOST_PASSWORD; read -s keeps it out of your shell history.

docker compose exec rustpost rustpost domain add example.org

read -rs RUSTPOST_PASSWORD && export RUSTPOST_PASSWORD
docker compose exec -e RUSTPOST_PASSWORD rustpost \
  rustpost user add admin@example.org --name "Admin" --admin
unset RUSTPOST_PASSWORD

--admin makes the user a server_admin. You can grant roles later from the console, or with rustpost admin grant <address> (add --domain example.org for a domain administrator) and rustpost admin revoke.

Now sign in:

  • Webmail: https://mail.example.org/
  • Admin console: https://mail.example.org/admin/

7. Publish the DNS records

Open the domain in the console's Domains page. It lists every record to publish, with its exact value, and checks them live. DNS records explains each one. Mail from your domain will not be delivered reliably until MX, SPF, DKIM, DMARC and the PTR record are right.

Upgrading

Back up first (see below), then:

docker compose pull
docker compose up -d

The server applies new database migrations when it starts. Migrations are written expand-then-contract, so old and new versions can run side by side during an upgrade. To stay on a known build, set RUSTPOST_IMAGE in .env to an image digest (…/rustpost-server@sha256:…) instead of the edge tag; version tags will be published with the first releases.

Backups

Back up both volumes: rustpost_postgres (the database) and rustpost_data (message bodies). Dump the database first and copy the blobs second: a blob is always written before the metadata that refers to it, so every blob named in the dump is then on disk.

# 1. The database, in PostgreSQL's custom format.
docker compose exec -T postgres pg_dump -U rustpost -Fc rustpost > rustpost-$(date +%F).dump

# 2. The message bodies.
docker run --rm -v rustpost_data:/data:ro -v "$PWD":/backup debian:trixie-slim \
  tar czf /backup/rustpost-blobs-$(date +%F).tar.gz -C /data .

To restore on a new host: start only PostgreSQL (docker compose up -d postgres), restore with pg_restore, unpack the blobs into the rustpost_data volume, then start everything.

docker compose exec -T postgres pg_restore -U rustpost -d rustpost --clean --if-exists < rustpost-2026-11-29.dump
docker run --rm -v rustpost_data:/data -v "$PWD":/backup debian:trixie-slim \
  tar xzf /backup/rustpost-blobs-2026-11-29.tar.gz -C /data

Keep a copy of config/ and .env too. Built-in rustpost backup and rustpost restore commands are planned.

Uninstalling

docker compose down        # stops and removes the containers; the volumes and all mail stay
docker compose down -v     # also deletes the volumes: every message, account and setting

docker compose down -v deletes all mail and the database for good. Take a backup first if there is anything you might want to keep.

Building from source instead

Without Docker you need Rust (the repository's rust-toolchain.toml selects the version) and a PostgreSQL database. See Contributing.