Merge branch 'master' into chore/simplify-example-healthcheck

This commit is contained in:
Brennan Kinney 2025-06-02 19:26:46 +12:00 committed by GitHub
commit 23abd92881
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 23 deletions

View file

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. The format
- **Environment Variables:** - **Environment Variables:**
- [ENV can be declared with a `__FILE` suffix](https://docker-mailserver.github.io/docker-mailserver/v15.1/config/environment/) to read a value from a file during initial DMS setup scripts ([#4359](https://github.com/docker-mailserver/docker-mailserver/pull/4359)) - [ENV can be declared with a `__FILE` suffix](https://docker-mailserver.github.io/docker-mailserver/v15.1/config/environment/) to read a value from a file during initial DMS setup scripts ([#4359](https://github.com/docker-mailserver/docker-mailserver/pull/4359))
- Improved docs for the ENV `OVERRIDE_HOSTNAME` ([#4492](https://github.com/docker-mailserver/docker-mailserver/pull/4492))
- **Internal:** - **Internal:**
- [`DMS_CONFIG_POLL`](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/environment/#dms_config_poll) supports adjusting the polling rate (seconds) for the change detection service `check-for-changes.sh` ([#4450](https://github.com/docker-mailserver/docker-mailserver/pull/4450)) - [`DMS_CONFIG_POLL`](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/environment/#dms_config_poll) supports adjusting the polling rate (seconds) for the change detection service `check-for-changes.sh` ([#4450](https://github.com/docker-mailserver/docker-mailserver/pull/4450))

View file

@ -14,11 +14,23 @@ title: Environment Variables
##### OVERRIDE_HOSTNAME ##### OVERRIDE_HOSTNAME
If you can't set your hostname (_eg: you're in a container platform that doesn't let you_) specify it via this environment variable. It will have priority over `docker run --hostname`, or the equivalent `hostname:` field in `compose.yaml`. If you cannot set your DMS FQDN as your hostname (_eg: you're in a container runtime lacks the equivalent of Docker's `--hostname`_), specify it via this environment variable.
- **empty** => Uses the `hostname -f` command to get canonical hostname for DMS to use. - **empty** => Internally uses the `hostname --fqdn` command to get the canonical hostname assigned to the DMS container.
- => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for DMS to function correctly. - => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for DMS to function correctly.
!!! info
`OVERRIDE_HOSTNAME` is checked early during DMS container setup. When set it will be preferred over querying the containers hostname via the `hostname --fqdn` command (_configured via `docker run --hostname` or the equivalent `hostname:` field in `compose.yaml`_).
!!! warning "Compatibility may differ"
`OVERRIDE_HOSTNAME` is not a complete replacement for adjusting the containers configured hostname. It is a best effort workaround for supporting deployment environments like Kubernetes or when using Docker with `--network=host`.
Typically this feature is only useful when software supports configuring a specific hostname to use, instead of a default fallback that infers the hostname (such as retrieving the hostname via libc / NSS). [Fetchmail is known to be incompatible][gh--issue::hostname-compatibility] with this ENV, requiring manual workarounds.
Compatibility differences are being [tracked here][gh-issue::dms-fqdn] as they become known.
##### LOG_LEVEL ##### LOG_LEVEL
Set the log level for DMS. This is mostly relevant for container startup scripts and change detection event feedback. Set the log level for DMS. This is mostly relevant for container startup scripts and change detection event feedback.
@ -1183,3 +1195,5 @@ Provide the credentials to use with `RELAY_HOST` or `DEFAULT_RELAY_HOST`.
[postfix-config::relayhost_maps]: https://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps [postfix-config::relayhost_maps]: https://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps
[postfix-config::sasl_passwd]: https://www.postfix.org/postconf.5.html#smtp_sasl_password_maps [postfix-config::sasl_passwd]: https://www.postfix.org/postconf.5.html#smtp_sasl_password_maps
[gh-issue::tls-legacy-workaround]: https://github.com/docker-mailserver/docker-mailserver/pull/2945#issuecomment-1949907964 [gh-issue::tls-legacy-workaround]: https://github.com/docker-mailserver/docker-mailserver/pull/2945#issuecomment-1949907964
[gh-issue::hostname-compatibility]: https://github.com/docker-mailserver/docker-mailserver-helm/issues/168#issuecomment-2911782106
[gh-issue::dms-fqdn]: https://github.com/docker-mailserver/docker-mailserver/issues/3520#issuecomment-1700191973

View file

@ -9,13 +9,13 @@
# --- General Section --------------------------- # --- General Section ---------------------------
# ----------------------------------------------- # -----------------------------------------------
# empty => uses the `hostname` command to get the mail server's canonical hostname # **empty** => Internally uses the `hostname --fqdn` command to get the canonical hostname assigned to the DMS container.
# => Specify a fully-qualified domainname to serve mail for. This is used for many of the config features so if you can't set your hostname (e.g. you're in a container platform that doesn't let you) specify it in this environment variable. # => Specify an FQDN (fully-qualified domain name) to serve mail for. The hostname is required for DMS to function correctly
#
# **WARNING**: Setting OVERRIDE_HOSTNAME can have difficult to predict side effects:
# https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/#override_hostname
OVERRIDE_HOSTNAME= OVERRIDE_HOSTNAME=
# REMOVED in version v11.0.0! Use LOG_LEVEL instead.
DMS_DEBUG=0
# Set the log level for DMS. # Set the log level for DMS.
# This is mostly relevant for container startup scripts and change detection event feedback. # This is mostly relevant for container startup scripts and change detection event feedback.
# #

View file

@ -4,7 +4,7 @@
declare -A VARS declare -A VARS
function _early_variables_setup() { function _early_variables_setup() {
__environment_variables_log_level __ensure_valid_log_level
__environment_variables_from_files __environment_variables_from_files
_obtain_hostname_and_domainname _obtain_hostname_and_domainname
__environment_variables_backwards_compatibility __environment_variables_backwards_compatibility
@ -181,21 +181,11 @@ function __environment_variables_general_setup() {
fi fi
} }
function __environment_variables_log_level() { # `LOG_LEVEL` must be set early to correctly filter calls to `scripts/helpers/log.sh:_log()`
if [[ ${LOG_LEVEL} == 'trace' ]] \ function __ensure_valid_log_level() {
|| [[ ${LOG_LEVEL} == 'debug' ]] \ if [[ ! ${LOG_LEVEL:-info} =~ ^(trace|debug|info|warn|error)$ ]]; then
|| [[ ${LOG_LEVEL} == 'info' ]] \ _log 'warn' "Log level '${LOG_LEVEL}' is invalid (falling back to default: 'info')"
|| [[ ${LOG_LEVEL} == 'warn' ]] \ LOG_LEVEL='info'
|| [[ ${LOG_LEVEL} == 'error' ]]
then
return 0
else
local DEFAULT_LOG_LEVEL='info'
_log 'warn' "Log level '${LOG_LEVEL}' is invalid (falling back to default '${DEFAULT_LOG_LEVEL}')"
# shellcheck disable=SC2034
VARS[LOG_LEVEL]="${DEFAULT_LOG_LEVEL}"
LOG_LEVEL="${DEFAULT_LOG_LEVEL}"
fi fi
} }