3.5 KiB
EternityMail
Docker Compose deployment for Stalwart Mail and Roundcube.
Requirements
- Docker Engine with the Compose plugin
- A Linux host for the production deployment
- DNS records pointing the mail hostname to the server
- The
ep-roundcube-skinrepository available as a sibling directory if the custom skin is enabled
Configuration
Create the real environment file from the template:
cp .env.example .env
Edit .env and set production values, especially:
MAIL_HOSTNAMEandMAIL_DOMAINRC_DB_PASSWORDRC_DB_ROOT_PASSWORDRC_DES_KEYSTALWART_RECOVERY_ADMIN
The real .env file is ignored by Git. Do not commit credentials or recovery settings.
Roundcube uses MAIL_HOSTNAME for IMAP and SMTP submission by default. To connect Roundcube to Stalwart by IP instead, add ROUNDCUBE_IMAP_HOST=<ip-address> and ROUNDCUBE_SMTP_HOST=<ip-address> to .env. These change only Roundcube's IMAP and SMTP endpoints; MAIL_HOSTNAME remains the Stalwart hostname and Docker network alias.
Generate a DES key
On Linux or macOS:
chmod +x scripts/generate-des-key.sh
scripts/generate-des-key.sh
On Windows PowerShell:
.\scripts\generate-des-key.ps1
Put the generated 24-character value in RC_DES_KEY in .env.
Prepare Linux data directories
The Stalwart container runs as uid/gid 2000. Create the bind-mounted directories and set the required ownership before starting the stack:
chmod +x scripts/setup-data-dirs.sh
sudo ./scripts/setup-data-dirs.sh
The script uses DATA_ROOT from .env when it is exported in the shell; otherwise it defaults to /opt/eternitymail. To use the value from .env directly, run the setup command with it loaded or pass the path explicitly:
sudo DATA_ROOT=/opt/eternitymail ./scripts/setup-data-dirs.sh
Custom Roundcube skin
The default configuration expects the skin at:
../ep-roundcube-skin/eternity
relative to this repository. Override the location in .env with ROUNDCUBE_SKIN_PATH if needed. The skin directory is mounted read-only and selected with ROUNDCUBE_SKIN_NAME.
The bundled roundcube-config/eternity-logo.php override sets the login logo to the Eternity skin's images/logo.svg through Roundcube's static.php asset endpoint. This is required because Eternity inherits Elastic's login template, which would otherwise display Elastic's default logo. Keep this file and its mount in docker-compose.yml when using the Eternity skin.
Start and stop
Validate the rendered configuration:
docker compose config --quiet
Start the services:
docker compose up -d
View service status and logs:
docker compose ps
docker compose logs -f stalwart
Stop the services without deleting persistent data:
docker compose down
Persistent data is stored under DATA_ROOT in the stalwart, roundcube-db, and roundcube-config directories.
Network ports
The host bindings are configurable in .env:
- SMTP:
STALWART_SMTP_PORT(default25) - Submission:
STALWART_SUBMISSION_PORT(default587) - IMAPS:
STALWART_IMAPS_PORT(default993) - Stalwart administration:
STALWART_ADMIN_BINDandSTALWART_ADMIN_PORT(defaults127.0.0.1:8081); setSTALWART_ADMIN_BIND=to listen on all host interfaces - Roundcube:
ROUNDCUBE_BINDandROUNDCUBE_PORT(defaults127.0.0.1:8091); setROUNDCUBE_BIND=to listen on all host interfaces
The Stalwart and Roundcube containers communicate over the private eternitymail Docker network.