From b4f159da86a8857bc541f560f1a7572d15a5f3c4 Mon Sep 17 00:00:00 2001 From: andryyy Date: Mon, 2 Sep 2019 18:37:05 +0200 Subject: [PATCH] [Postfix] Allow to create an extra.cf file besides main.cf to merge overrides [Postfix] Better logging while bootstrapping [Postfix] Stop container, when a service fails (easier to monitor) --- data/Dockerfiles/postfix/Dockerfile | 1 + data/Dockerfiles/postfix/postfix.sh | 8 +++++++- data/Dockerfiles/postfix/supervisord.conf | 5 +++++ docker-compose.yml | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/data/Dockerfiles/postfix/Dockerfile b/data/Dockerfiles/postfix/Dockerfile index b3567cfa..77173028 100644 --- a/data/Dockerfiles/postfix/Dockerfile +++ b/data/Dockerfiles/postfix/Dockerfile @@ -39,6 +39,7 @@ RUN groupadd -g 102 postfix \ COPY supervisord.conf /etc/supervisor/supervisord.conf COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf +COPY stop-supervisor.sh /usr/local/sbin/stop-supervisor.sh COPY postfix.sh /opt/postfix.sh COPY rspamd-pipe-ham /usr/local/bin/rspamd-pipe-ham COPY rspamd-pipe-spam /usr/local/bin/rspamd-pipe-spam diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index 67b9c247..ff7f233e 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -292,6 +292,12 @@ query = SELECT goto FROM spamalias AND validity >= UNIX_TIMESTAMP() EOF +sed -i '/User overrides/q' /opt/postfix/conf/main.cf +echo >> /opt/postfix/conf/main.cf +if [ -f /opt/postfix/conf/extra.cf ]; then + cat /opt/postfix/conf/extra.cf >> /opt/postfix/conf/main.cf +fi + # Fix Postfix permissions chown -R root:postfix /opt/postfix/conf/sql/ chmod 640 /opt/postfix/conf/sql/*.cf @@ -300,7 +306,7 @@ chgrp -R postdrop /var/spool/postfix/maildrop postfix set-permissions # Check Postfix configuration -postconf -c /opt/postfix/conf +postconf -c /opt/postfix/conf > /dev/null if [[ $? != 0 ]]; then echo "Postfix configuration error, refusing to start." diff --git a/data/Dockerfiles/postfix/supervisord.conf b/data/Dockerfiles/postfix/supervisord.conf index 27494bd6..134a6c6d 100644 --- a/data/Dockerfiles/postfix/supervisord.conf +++ b/data/Dockerfiles/postfix/supervisord.conf @@ -1,4 +1,5 @@ [supervisord] +pidfile=/var/run/supervisord.pid nodaemon=true user=root @@ -12,6 +13,10 @@ autostart=true [program:postfix] command=/opt/postfix.sh +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 autorestart=true [eventlistener:processes] diff --git a/docker-compose.yml b/docker-compose.yml index 103a5e18..16ded701 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -98,7 +98,7 @@ services: - rspamd php-fpm-mailcow: - image: mailcow/phpfpm:1.43 + image: mailcow/phpfpm:1.44 build: ./data/Dockerfiles/phpfpm command: "php-fpm -d date.timezone=${TZ} -d expose_php=0" depends_on: @@ -145,7 +145,7 @@ services: - phpfpm sogo-mailcow: - image: mailcow/sogo:1.59 + image: mailcow/sogo:1.60 build: ./data/Dockerfiles/sogo environment: - DBNAME=${DBNAME}