Added cron to SOGo, init config on start, added syslog to rmilter

master
andryyy 2016-12-23 12:13:21 +01:00
parent b514ffb368
commit 29f343c193
6 changed files with 42 additions and 30 deletions

View File

@ -12,12 +12,14 @@ RUN dpkg-divert --local --rename --add /sbin/initctl \
RUN apt-key adv --fetch-keys http://rspamd.com/apt-stable/gpg.key \ RUN apt-key adv --fetch-keys http://rspamd.com/apt-stable/gpg.key \
&& echo "deb http://rspamd.com/apt-stable/ xenial main" > /etc/apt/sources.list.d/rspamd.list \ && echo "deb http://rspamd.com/apt-stable/ xenial main" > /etc/apt/sources.list.d/rspamd.list \
&& apt-get update \ && apt-get update \
&& apt-get --no-install-recommends -y --force-yes install rmilter && apt-get --no-install-recommends -y --force-yes install rmilter cron syslog-ng syslog-ng-core supervisor
CMD ["/usr/sbin/rmilter","-n", "-c", "/etc/rmilter.conf.d/rmilter.conf"] COPY supervisord.conf /etc/supervisor/supervisord.conf
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
USER _rmilter
EXPOSE 9000 EXPOSE 9000
RUN sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng/syslog-ng.conf
CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@ -0,0 +1,18 @@
[supervisord]
nodaemon=true
[program:syslog-ng]
command=/usr/sbin/syslog-ng --foreground --no-caps
redirect_stderr=true
autostart=true
stdout_syslog=true
[program:rmilter]
command=/usr/sbin/rmilter -n -c /etc/rmilter.conf.d/rmilter.conf
user=_rmilter
autorestart=true
[program:rmilter-syslog]
command=/usr/bin/tail -f /var/log/syslog
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

View File

@ -3,15 +3,15 @@ MAINTAINER Andre Peters <andre.peters@servercow.de>
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C ENV LC_ALL C
ENV GOSU_VERSION 1.9
RUN dpkg-divert --local --rename --add /sbin/initctl \ RUN dpkg-divert --local --rename --add /sbin/initctl \
&& ln -sf /bin/true /sbin/initctl \ && ln -sf /bin/true /sbin/initctl \
&& dpkg-divert --local --rename --add /usr/bin/ischroot \ && dpkg-divert --local --rename --add /usr/bin/ischroot \
&& ln -sf /bin/true /usr/bin/ischroot && ln -sf /bin/true /usr/bin/ischroot
ENV GOSU_VERSION 1.9 RUN apt-get update \
RUN set -x \ && apt-get install -y --no-install-recommends apt-transport-https ca-certificates wget syslog-ng syslog-ng-core supervisor mysql-client cron \
&& apt-get update && apt-get install -y --no-install-recommends apt-transport-https ca-certificates wget rsyslog supervisor mysql-client && rm -rf /var/lib/apt/lists/* \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
@ -27,8 +27,12 @@ RUN apt-key adv --keyserver keys.gnupg.net --recv-key 0x810273C4 \
&& apt-get update \ && apt-get update \
&& apt-get -y --force-yes install sogo sogo-activesync && apt-get -y --force-yes install sogo sogo-activesync
RUN sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng/syslog-ng.conf
RUN echo '* * * * * sogo /usr/sbin/sogo-ealarms-notify' > /etc/cron.d/sogo
RUN echo '* * * * * sogo /usr/sbin/sogo-tool expire-sessions 60' >> /etc/cron.d/sogo
RUN echo '0 0 * * * sogo /usr/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.creds' >> /etc/cron.d/sogo
COPY ./docker-entrypoint.sh / COPY ./docker-entrypoint.sh /
COPY ./sogo-cron.sh /
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf
EXPOSE 20000 EXPOSE 20000

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e
until mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e ""; do # Wait for MySQL to warm-up
while ! mysqladmin ping --host mysql --silent; do
sleep 1 sleep 1
done done
@ -89,7 +89,6 @@ echo ' </dict>
</dict> </dict>
</plist>' >> /var/lib/sogo/GNUstep/Defaults/sogod.plist </plist>' >> /var/lib/sogo/GNUstep/Defaults/sogod.plist
# Fix permissions # Fix permissions
chown sogo:sogo -R /var/lib/sogo/ chown sogo:sogo -R /var/lib/sogo/
chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist

View File

@ -1,10 +0,0 @@
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
while true; do
/usr/sbin/sogo-tool expire-sessions 60
/usr/sbin/sogo-ealarms-notify
/usr/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.creds
sleep 60
done

View File

@ -1,11 +1,11 @@
[supervisord] [supervisord]
nodaemon=true nodaemon=true
[program:rsyslog] [program:syslog-ng]
command=/usr/sbin/rsyslogd -n command=/usr/sbin/syslog-ng --foreground --no-caps
autostart=true
autorestart=true
redirect_stderr=true redirect_stderr=true
autostart=true
stdout_syslog=true
[program:sogo] [program:sogo]
command=/usr/sbin/sogod command=/usr/sbin/sogod
@ -17,9 +17,8 @@ command=/usr/bin/tail -f /var/log/syslog -f /var/log/sogo/sogo.log
stdout_logfile=/dev/fd/1 stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
[program:sogo-cron] [program:cron]
command=/sogo-cron.sh command=/usr/sbin/cron -f
user=sogo
autorestart=true autorestart=true
#[unix_http_server] #[unix_http_server]