[Dovecot] Add new imapsync + dependencies
[Dovecot] Syslog-ng: Do not trim after each push to Redis [Dovecot] Add new cronjob to trim all Redis logs every minute (will be moved in the future)master
parent
241c6f0411
commit
04b43d0a3b
|
@ -54,6 +54,10 @@ RUN apt-get update && apt-get -y --no-install-recommends install \
|
||||||
libtry-tiny-perl \
|
libtry-tiny-perl \
|
||||||
libunicode-string-perl \
|
libunicode-string-perl \
|
||||||
libproc-processtable-perl \
|
libproc-processtable-perl \
|
||||||
|
libtest-nowarnings-perl \
|
||||||
|
libtest-deep-perl \
|
||||||
|
libtest-warn-perl \
|
||||||
|
libregexp-common-perl \
|
||||||
liburi-perl \
|
liburi-perl \
|
||||||
lzma-dev \
|
lzma-dev \
|
||||||
make \
|
make \
|
||||||
|
@ -61,6 +65,7 @@ RUN apt-get update && apt-get -y --no-install-recommends install \
|
||||||
procps \
|
procps \
|
||||||
supervisor \
|
supervisor \
|
||||||
cron \
|
cron \
|
||||||
|
redis-server \
|
||||||
syslog-ng \
|
syslog-ng \
|
||||||
syslog-ng-core \
|
syslog-ng-core \
|
||||||
syslog-ng-mod-redis \
|
syslog-ng-mod-redis \
|
||||||
|
@ -85,7 +90,9 @@ RUN curl https://www.dovecot.org/releases/2.3/dovecot-$DOVECOT_VERSION.tar.gz |
|
||||||
RUN cpanm Data::Uniqid Mail::IMAPClient String::Util
|
RUN cpanm Data::Uniqid Mail::IMAPClient String::Util
|
||||||
RUN echo '* * * * * root /usr/local/bin/imapsync_cron.pl' > /etc/cron.d/imapsync
|
RUN echo '* * * * * root /usr/local/bin/imapsync_cron.pl' > /etc/cron.d/imapsync
|
||||||
RUN echo '30 3 * * * vmail /usr/local/bin/doveadm quota recalc -A' > /etc/cron.d/dovecot-sync
|
RUN echo '30 3 * * * vmail /usr/local/bin/doveadm quota recalc -A' > /etc/cron.d/dovecot-sync
|
||||||
|
RUN echo '* * * * * root /usr/local/bin/trim_logs.sh >> /dev/stdout 2>&1' > /etc/cron.d/trim_logs
|
||||||
|
|
||||||
|
COPY trim_logs.sh /usr/local/bin/trim_logs.sh
|
||||||
COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
||||||
COPY imapsync /usr/local/bin/imapsync
|
COPY imapsync /usr/local/bin/imapsync
|
||||||
COPY postlogin.sh /usr/local/bin/postlogin.sh
|
COPY postlogin.sh /usr/local/bin/postlogin.sh
|
||||||
|
@ -101,7 +108,8 @@ RUN chmod +x /usr/local/lib/dovecot/sieve/rspamd-pipe-ham \
|
||||||
/usr/local/lib/dovecot/sieve/rspamd-pipe-spam \
|
/usr/local/lib/dovecot/sieve/rspamd-pipe-spam \
|
||||||
/usr/local/bin/imapsync_cron.pl \
|
/usr/local/bin/imapsync_cron.pl \
|
||||||
/usr/local/bin/postlogin.sh \
|
/usr/local/bin/postlogin.sh \
|
||||||
/usr/local/bin/imapsync
|
/usr/local/bin/imapsync \
|
||||||
|
/usr/local/bin/trim_logs.sh
|
||||||
|
|
||||||
RUN groupadd -g 5000 vmail \
|
RUN groupadd -g 5000 vmail \
|
||||||
&& groupadd -g 401 dovecot \
|
&& groupadd -g 401 dovecot \
|
||||||
|
|
|
@ -7,10 +7,11 @@ while ! mysqladmin ping --host mysql -u${DBUSER} -p${DBPASS} --silent; do
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
# Hard-code env vars to imapsync due to cron not passing them to the perl script
|
# Hard-code env vars to scripts due to cron not passing them to the perl script
|
||||||
sed -i "/^\$DBUSER/c\\\$DBUSER='${DBUSER}';" /usr/local/bin/imapsync_cron.pl
|
sed -i "/^\$DBUSER/c\\\$DBUSER='${DBUSER}';" /usr/local/bin/imapsync_cron.pl
|
||||||
sed -i "/^\$DBPASS/c\\\$DBPASS='${DBPASS}';" /usr/local/bin/imapsync_cron.pl
|
sed -i "/^\$DBPASS/c\\\$DBPASS='${DBPASS}';" /usr/local/bin/imapsync_cron.pl
|
||||||
sed -i "/^\$DBNAME/c\\\$DBNAME='${DBNAME}';" /usr/local/bin/imapsync_cron.pl
|
sed -i "/^\$DBNAME/c\\\$DBNAME='${DBNAME}';" /usr/local/bin/imapsync_cron.pl
|
||||||
|
sed -i "s/LOG_LINES/${LOG_LINES}/g" /usr/local/bin/trim_logs.sh
|
||||||
|
|
||||||
# Create missing directories
|
# Create missing directories
|
||||||
[[ ! -d /usr/local/etc/dovecot/sql/ ]] && mkdir -p /usr/local/etc/dovecot/sql/
|
[[ ! -d /usr/local/etc/dovecot/sql/ ]] && mkdir -p /usr/local/etc/dovecot/sql/
|
||||||
|
|
|
@ -30,14 +30,6 @@ destination d_redis_f2b_channel {
|
||||||
command("PUBLISH" "F2B_CHANNEL" "$MESSAGE")
|
command("PUBLISH" "F2B_CHANNEL" "$MESSAGE")
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
destination d_redis_cleanup {
|
|
||||||
redis(
|
|
||||||
host("redis-mailcow")
|
|
||||||
persist-name("redis3")
|
|
||||||
port(6379)
|
|
||||||
command("LTRIM" "DOVECOT_MAILLOG" "0" "`LOG_LINES`")
|
|
||||||
);
|
|
||||||
};
|
|
||||||
filter f_mail { facility(mail); };
|
filter f_mail { facility(mail); };
|
||||||
filter f_not_watchdog { not message("172\.22\.1\.248"); };
|
filter f_not_watchdog { not message("172\.22\.1\.248"); };
|
||||||
log {
|
log {
|
||||||
|
@ -47,5 +39,4 @@ log {
|
||||||
filter(f_mail);
|
filter(f_mail);
|
||||||
destination(d_redis_ui_log);
|
destination(d_redis_ui_log);
|
||||||
destination(d_redis_f2b_channel);
|
destination(d_redis_f2b_channel);
|
||||||
destination(d_redis_cleanup);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
redis-cli -h redis LTRIM ACME_LOG 0 LOG_LINES
|
||||||
|
redis-cli -h redis LTRIM POSTFIX_MAILLOG 0 LOG_LINES
|
||||||
|
redis-cli -h redis LTRIM DOVECOT_MAILLOG 0 LOG_LINES
|
||||||
|
redis-cli -h redis LTRIM SOGO_LOG 0 LOG_LINES
|
||||||
|
redis-cli -h redis LTRIM NETFILTER_LOG 0 LOG_LINES
|
Loading…
Reference in New Issue