From 838ba9b0eaff73177fed1fddab861f4baa3460ad Mon Sep 17 00:00:00 2001 From: Tero Date: Fri, 18 Sep 2026 09:45:22 +0300 Subject: [PATCH] Add ability to use different hostnames for stalwart and roundcube --- .env.example | 6 ++++++ README.md | 2 ++ docker-compose.yml | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 3eb45cf..ea6270e 100644 --- a/.env.example +++ b/.env.example @@ -24,6 +24,12 @@ STALWART_RECOVERY_ADMIN= ROUNDCUBE_BIND=127.0.0.1 ROUNDCUBE_PORT=8091 +# Optional IMAP endpoint for Roundcube. Set an IP address here when DNS for +# MAIL_HOSTNAME is unavailable from the Roundcube container. +# ROUNDCUBE_IMAP_HOST=192.0.2.10 +# Optional SMTP submission endpoint for Roundcube. Defaults to MAIL_HOSTNAME. +# ROUNDCUBE_SMTP_HOST=192.0.2.10 + # Roundcube database RC_DB_NAME=roundcube RC_DB_USER=roundcube diff --git a/README.md b/README.md index b76c758..cc54a1d 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ Edit `.env` and set production values, especially: 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=` and `ROUNDCUBE_SMTP_HOST=` 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: diff --git a/docker-compose.yml b/docker-compose.yml index e93597f..c56e7dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,10 +91,10 @@ services: ROUNDCUBEMAIL_DES_KEY: ${RC_DES_KEY} - ROUNDCUBEMAIL_DEFAULT_HOST: ssl://${MAIL_HOSTNAME} + ROUNDCUBEMAIL_DEFAULT_HOST: ssl://${ROUNDCUBE_IMAP_HOST:-${MAIL_HOSTNAME}} ROUNDCUBEMAIL_DEFAULT_PORT: 993 - ROUNDCUBEMAIL_SMTP_SERVER: tls://${MAIL_HOSTNAME} + ROUNDCUBEMAIL_SMTP_SERVER: tls://${ROUNDCUBE_SMTP_HOST:-${MAIL_HOSTNAME}} ROUNDCUBEMAIL_SMTP_PORT: 587 ROUNDCUBEMAIL_USERNAME_DOMAIN: ${MAIL_DOMAIN}