admin:linux:docker:mailcow

Mailcow Dockerized Mail Server

Environment: jwilder/nginx-proxy

https://mailcow.github.io/mailcow-dockerized-docs/firststeps-rp/#nginx

webproxy/vhost.d/mx.example.com_location
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100m;

"webproxy" is the network from docker-compose-letsencrypt-nginx-proxy-companion.

mailcow-dockerized/docker-compose.override.yml
version: '2.1'
services:
 
    nginx-mailcow:
      environment:
        - LETSENCRYPT_HOST=${MAILCOW_HOSTNAME},${ADDITIONAL_SAN}
        - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
        - VIRTUAL_HOST=${MAILCOW_HOSTNAME},${ADDITIONAL_SAN}
        - VIRTUAL_PROTO=http 
        - VIRTUAL_PORT=80
      networks:
        webproxy:
 
 
networks:
  webproxy:
    external:
      name: webproxy

disable HTTPS and HTTP port, as you can't currently override this.

mailcow-dockerized/docker-compose.yml
    nginx-mailcow:
    …
#      ports:
#        - "${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
#        - "${HTTP_BIND:-0.0.0.0}:${HTTP_PORT:-80}:${HTTP_PORT:-80}"

"LETSENCRYPT_EMAIL" is a new variable

mailcow-dockerized/mailcow.conf
LETSENCRYPT_EMAIL=webmaster@example.com

http to https redirect must be disabled. Please also deactivate the Strict-Transport-Security header in the http section, otherwise there will be an duplicate HSTS header error on https://www.ssllabs.com/ssltest

mailcow-dockerized/data/conf/nginx/site.conf
# add_header Strict-Transport-Security "max-age=15768000; includeSubDomains";

Source: Github Issue "reverse proxy in different network"

source mailcow.conf; docker-compose exec mysql-mailcow mysql_upgrade -uroot -p${DBROOT}

If you encounter these or similar errors:

[ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRE
SQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USE
R','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE'
,'MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALU
[ERROR] mysqld: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.

Execute the following in the folder with mailcow's docker-compose.yml:

docker-compose stop mysql-mailcow watchdog-mailcow
docker-compose run --rm --entrypoint '/bin/sh -c "gosu mysql mysqld --skip-grant-tables & sleep 10 && bash && exit 0"' mysql-mailcow
# then issue:
mysql_upgrade --force
exit
docker-compose up -d
  • Last modified: 2019-12-20 14:21