diff --git a/Dockerfile b/Dockerfile index 02abd1c..0355041 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM alpine:edge +FROM rawmind/alpine-monit:5.25-3 -# We have to upgrade musl, or rspamd will not work. -RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ - && apk add --no-cache rspamd rspamd-controller rsyslog ca-certificates +RUN apk add --no-cache rspamd rspamd-controller rspamd-proxy rspamd-fuzzy ca-certificates curl RUN mkdir /run/rspamd -COPY conf/ /etc/rspamd -COPY start.sh /start.sh +COPY monit-service.conf /opt/monit/etc/conf.d +COPY start.sh / -CMD ["/start.sh"] +EXPOSE 11332/tcp 11334/tcp 11335/tcp + +VOLUME ["/var/lib/rspamd"] diff --git a/conf/worker-controller.conf b/conf/worker-controller.conf deleted file mode 100644 index a63ceea..0000000 --- a/conf/worker-controller.conf +++ /dev/null @@ -1,11 +0,0 @@ -worker { - bind_socket = "0.0.0.0:11334"; - type = "controller"; - count = 1; - secure_ip = "127.0.0.1"; - secure_ip = "::1"; - static_dir = "/usr/share/rspamd/www"; - stats_path = "/var/lib/rspamd"; - .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/worker-controller.inc" - .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc" -} diff --git a/conf/worker-normal.conf b/conf/worker-normal.conf deleted file mode 100644 index 3d7344d..0000000 --- a/conf/worker-normal.conf +++ /dev/null @@ -1,6 +0,0 @@ -worker { - bind_socket = "0.0.0.0:11333"; - .include "$CONFDIR/worker-normal.inc" - .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-normal.inc" - .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc" -} diff --git a/monit-service.conf b/monit-service.conf new file mode 100644 index 0000000..03cd449 --- /dev/null +++ b/monit-service.conf @@ -0,0 +1,4 @@ +check process rspamd with pidfile /run/rspamd/rspamd.pid + start program = "/start.sh" + stop program = "/bin/bash -c '/bin/kill `/bin/cat /run/rspamd/rspamd.pid`'" + if failed port 11334 type tcp for 10 cycles then exec "/opt/monit/bin/monit quit" diff --git a/start.sh b/start.sh index aeccd01..9fed1b8 100755 --- a/start.sh +++ b/start.sh @@ -12,4 +12,4 @@ EOF rspamd -i -tail -f /var/log/rspamd/rspamd.log +ln -sf /proc/1/fd/1 /var/log/rspamd/rspamd.log