فهرست منبع

[Compose] New images with LOG_LINES
[Update] Do not add empty line in each loop

andre.peters 7 سال پیش
والد
کامیت
1e9cae9084

+ 1 - 1
data/Dockerfiles/acme/docker-entrypoint.sh

@@ -12,7 +12,7 @@ log_f() {
   fi
   fi
   redis-cli -h redis LPUSH ACME_LOG "{\"time\":\"$(date +%s)\",\"message\":\"$(printf '%s' "${1}" | \
   redis-cli -h redis LPUSH ACME_LOG "{\"time\":\"$(date +%s)\",\"message\":\"$(printf '%s' "${1}" | \
     tr '%&;$"_[]{}-\r\n' ' ')\"}" > /dev/null
     tr '%&;$"_[]{}-\r\n' ' ')\"}" > /dev/null
-  redis-cli -h redis LTRIM ACME_LOG 0 9999 > /dev/null
+  redis-cli -h redis LTRIM ACME_LOG 0 ${LOG_LINES} > /dev/null
 }
 }
 
 
 if [[ "${SKIP_LETS_ENCRYPT}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
 if [[ "${SKIP_LETS_ENCRYPT}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then

+ 2 - 1
data/Dockerfiles/dovecot/Dockerfile

@@ -6,7 +6,7 @@ ENV LC_ALL C
 ENV DOVECOT_VERSION 2.2.33.2
 ENV DOVECOT_VERSION 2.2.33.2
 ENV PIGEONHOLE_VERSION 0.4.21
 ENV PIGEONHOLE_VERSION 0.4.21
 
 
-RUN apt-get update && apt-get -y install \
+RUN apt-get update && apt-get -y --no-install-recommends install \
 	automake \
 	automake \
 	autotools-dev \
 	autotools-dev \
 	build-essential \
 	build-essential \
@@ -56,6 +56,7 @@ RUN apt-get update && apt-get -y install \
 	make \
 	make \
   procps \
   procps \
 	supervisor \
 	supervisor \
+  cron \
 	syslog-ng \
 	syslog-ng \
 	syslog-ng-core \
 	syslog-ng-core \
 	syslog-ng-mod-redis \
 	syslog-ng-mod-redis \

+ 1 - 1
data/Dockerfiles/dovecot/syslog-ng.conf

@@ -35,7 +35,7 @@ destination d_redis_cleanup {
     host("redis-mailcow")
     host("redis-mailcow")
     persist-name("redis3")
     persist-name("redis3")
     port(6379)
     port(6379)
-    command("LTRIM" "DOVECOT_MAILLOG" "0" "9999")
+    command("LTRIM" "DOVECOT_MAILLOG" "0" "`LOG_LINES`")
   );
   );
 };
 };
 filter f_mail { facility(mail); };
 filter f_mail { facility(mail); };

+ 1 - 1
data/Dockerfiles/postfix/syslog-ng.conf

@@ -35,7 +35,7 @@ destination d_redis_cleanup {
     host("redis-mailcow")
     host("redis-mailcow")
     persist-name("redis3")
     persist-name("redis3")
     port(6379)
     port(6379)
-    command("LTRIM" "POSTFIX_MAILLOG" "0" "9999")
+    command("LTRIM" "POSTFIX_MAILLOG" "0" "`LOG_LINES`")
   );
   );
 };
 };
 filter f_mail { facility(mail); };
 filter f_mail { facility(mail); };

+ 1 - 1
data/Dockerfiles/sogo/syslog-ng.conf

@@ -38,7 +38,7 @@ destination d_redis_cleanup {
     host("redis-mailcow")
     host("redis-mailcow")
     persist-name("redis3")
     persist-name("redis3")
     port(6379)
     port(6379)
-    command("LTRIM" "SOGO_LOG" "0" "9999")
+    command("LTRIM" "SOGO_LOG" "0" "`LOG_LINES`")
   );
   );
 };
 };
 log {
 log {

+ 1 - 1
data/Dockerfiles/watchdog/watchdog.sh

@@ -37,7 +37,7 @@ log_msg() {
     redis-cli -h redis LPUSH WATCHDOG_LOG "{\"time\":\"$(date +%s)\",\"message\":\"$(printf '%s' "${1}" | \
     redis-cli -h redis LPUSH WATCHDOG_LOG "{\"time\":\"$(date +%s)\",\"message\":\"$(printf '%s' "${1}" | \
       tr '%&;$"_[]{}-\r\n' ' ')\"}" > /dev/null
       tr '%&;$"_[]{}-\r\n' ' ')\"}" > /dev/null
   fi
   fi
-  redis-cli -h redis LTRIM WATCHDOG_LOG 0 9999 > /dev/null
+  redis-cli -h redis LTRIM WATCHDOG_LOG 0 ${LOG_LINES} > /dev/null
   echo $(date) $(printf '%s\n' "${1}")
   echo $(date) $(printf '%s\n' "${1}")
 }
 }
 
 

+ 12 - 6
docker-compose.yml

@@ -91,7 +91,7 @@ services:
             - rspamd
             - rspamd
 
 
     php-fpm-mailcow:
     php-fpm-mailcow:
-      image: mailcow/phpfpm:1.6
+      image: mailcow/phpfpm:1.7
       build: ./data/Dockerfiles/phpfpm
       build: ./data/Dockerfiles/phpfpm
       command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
       command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
       depends_on:
       depends_on:
@@ -102,6 +102,7 @@ services:
         - dkim-vol-1:/data/dkim
         - dkim-vol-1:/data/dkim
         - ./data/conf/rspamd/meta_exporter:/meta_exporter:ro
         - ./data/conf/rspamd/meta_exporter:/meta_exporter:ro
       environment:
       environment:
+        - LOG_LINES=${LOG_LINES}
         - TZ=${TZ}
         - TZ=${TZ}
         - DBNAME=${DBNAME}
         - DBNAME=${DBNAME}
         - DBUSER=${DBUSER}
         - DBUSER=${DBUSER}
@@ -124,13 +125,14 @@ services:
             - phpfpm
             - phpfpm
 
 
     sogo-mailcow:
     sogo-mailcow:
-      image: mailcow/sogo:1.12
+      image: mailcow/sogo:1.13
       build: ./data/Dockerfiles/sogo
       build: ./data/Dockerfiles/sogo
       environment:
       environment:
         - DBNAME=${DBNAME}
         - DBNAME=${DBNAME}
         - DBUSER=${DBUSER}
         - DBUSER=${DBUSER}
         - DBPASS=${DBPASS}
         - DBPASS=${DBPASS}
         - TZ=${TZ}
         - TZ=${TZ}
+        - LOG_LINES=${LOG_LINES}
         - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
         - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
       volumes:
       volumes:
         - ./data/conf/sogo/:/etc/sogo/
         - ./data/conf/sogo/:/etc/sogo/
@@ -144,7 +146,7 @@ services:
             - sogo
             - sogo
 
 
     dovecot-mailcow:
     dovecot-mailcow:
-      image: mailcow/dovecot:1.13
+      image: mailcow/dovecot:1.14
       build: ./data/Dockerfiles/dovecot
       build: ./data/Dockerfiles/dovecot
       cap_add:
       cap_add:
         - NET_BIND_SERVICE
         - NET_BIND_SERVICE
@@ -155,6 +157,7 @@ services:
         - vmail-vol-1:/var/vmail
         - vmail-vol-1:/var/vmail
         - crypt-vol-1:/mail_crypt/
         - crypt-vol-1:/mail_crypt/
       environment:
       environment:
+        - LOG_LINES=${LOG_LINES}
         - DBNAME=${DBNAME}
         - DBNAME=${DBNAME}
         - DBUSER=${DBUSER}
         - DBUSER=${DBUSER}
         - DBPASS=${DBPASS}
         - DBPASS=${DBPASS}
@@ -181,7 +184,7 @@ services:
             - dovecot
             - dovecot
 
 
     postfix-mailcow:
     postfix-mailcow:
-      image: mailcow/postfix:1.10
+      image: mailcow/postfix:1.11
       build: ./data/Dockerfiles/postfix
       build: ./data/Dockerfiles/postfix
       volumes:
       volumes:
         - ./data/conf/postfix:/opt/postfix/conf
         - ./data/conf/postfix:/opt/postfix/conf
@@ -189,6 +192,7 @@ services:
         - postfix-vol-1:/var/spool/postfix
         - postfix-vol-1:/var/spool/postfix
         - crypt-vol-1:/var/lib/zeyple
         - crypt-vol-1:/var/lib/zeyple
       environment:
       environment:
+        - LOG_LINES=${LOG_LINES}
         - TZ=${TZ}
         - TZ=${TZ}
         - DBNAME=${DBNAME}
         - DBNAME=${DBNAME}
         - DBUSER=${DBUSER}
         - DBUSER=${DBUSER}
@@ -256,11 +260,12 @@ services:
       depends_on:
       depends_on:
         - nginx-mailcow
         - nginx-mailcow
         - mysql-mailcow
         - mysql-mailcow
-      image: mailcow/acme:1.26
+      image: mailcow/acme:1.27
       build: ./data/Dockerfiles/acme
       build: ./data/Dockerfiles/acme
       dns:
       dns:
         - 172.22.1.254
         - 172.22.1.254
       environment:
       environment:
+        - LOG_LINES=${LOG_LINES}
         - ADDITIONAL_SAN=${ADDITIONAL_SAN}
         - ADDITIONAL_SAN=${ADDITIONAL_SAN}
         - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
         - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
         - DBNAME=${DBNAME}
         - DBNAME=${DBNAME}
@@ -300,12 +305,13 @@ services:
         - /lib/modules:/lib/modules:ro
         - /lib/modules:/lib/modules:ro
 
 
     watchdog-mailcow:
     watchdog-mailcow:
-      image: mailcow/watchdog:1.11
+      image: mailcow/watchdog:1.12
       build: ./data/Dockerfiles/watchdog
       build: ./data/Dockerfiles/watchdog
       volumes:
       volumes:
         - vmail-vol-1:/vmail:ro
         - vmail-vol-1:/vmail:ro
       restart: always
       restart: always
       environment:
       environment:
+        - LOG_LINES=${LOG_LINES}
         - TZ=${TZ}
         - TZ=${TZ}
         - DBNAME=${DBNAME}
         - DBNAME=${DBNAME}
         - DBUSER=${DBUSER}
         - DBUSER=${DBUSER}

+ 2 - 0
generate_config.sh

@@ -101,6 +101,8 @@ USE_WATCHDOG=n
 # Send notifications by mail (no DKIM signature, sent from watchdog@MAILCOW_HOSTNAME)
 # Send notifications by mail (no DKIM signature, sent from watchdog@MAILCOW_HOSTNAME)
 #WATCHDOG_NOTIFY_EMAIL=
 #WATCHDOG_NOTIFY_EMAIL=
 
 
+LOG_LINES=9999
+
 EOF
 EOF
 
 
 mkdir -p data/assets/ssl
 mkdir -p data/assets/ssl

+ 8 - 1
update.sh

@@ -4,8 +4,10 @@ for bin in curl docker-compose docker git awk sha1sum; do
 	if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi
 	if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi
 done
 done
 
 
+[[ ! -f mailcow.conf ]] && { echo "mailcow.conf is missing"; exit 1;}
+
 CONFIG_ARRAY=("SKIP_LETS_ENCRYPT" "USE_WATCHDOG" "WATCHDOG_NOTIFY_EMAIL" "SKIP_CLAMD" "SKIP_IP_CHECK" "SKIP_FAIL2BAN" "ADDITIONAL_SAN" "DOVEADM_PORT")
 CONFIG_ARRAY=("SKIP_LETS_ENCRYPT" "USE_WATCHDOG" "WATCHDOG_NOTIFY_EMAIL" "SKIP_CLAMD" "SKIP_IP_CHECK" "SKIP_FAIL2BAN" "ADDITIONAL_SAN" "DOVEADM_PORT")
-echo >> mailcow.conf
+sed -i '$a\' mailcow.conf
 for option in ${CONFIG_ARRAY[@]}; do
 for option in ${CONFIG_ARRAY[@]}; do
 	if [[ ${option} == "ADDITIONAL_SAN" ]]; then
 	if [[ ${option} == "ADDITIONAL_SAN" ]]; then
 		if ! grep -q ${option} mailcow.conf; then
 		if ! grep -q ${option} mailcow.conf; then
@@ -27,6 +29,11 @@ for option in ${CONFIG_ARRAY[@]}; do
 			echo "Adding new option \"${option}\" to mailcow.conf"
 			echo "Adding new option \"${option}\" to mailcow.conf"
 			echo "WATCHDOG_NOTIFY_EMAIL=" >> mailcow.conf
 			echo "WATCHDOG_NOTIFY_EMAIL=" >> mailcow.conf
 		fi
 		fi
+  elif [[ ${option} == "LOG_LINES" ]]; then
+    if ! grep -q ${option} mailcow.conf; then
+      echo "Adding new option \"${option}\" to mailcow.conf"
+      echo "LOG_LINES=9999" >> mailcow.conf
+    fi
 	elif ! grep -q ${option} mailcow.conf; then
 	elif ! grep -q ${option} mailcow.conf; then
 		echo "Adding new option \"${option}\" to mailcow.conf"
 		echo "Adding new option \"${option}\" to mailcow.conf"
 		echo "${option}=n" >> mailcow.conf
 		echo "${option}=n" >> mailcow.conf