diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02abd1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:edge + +# 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 mkdir /run/rspamd + +COPY conf/ /etc/rspamd +COPY start.sh /start.sh + +CMD ["/start.sh"] diff --git a/conf/worker-controller.conf b/conf/worker-controller.conf new file mode 100644 index 0000000..a63ceea --- /dev/null +++ b/conf/worker-controller.conf @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..3d7344d --- /dev/null +++ b/conf/worker-normal.conf @@ -0,0 +1,6 @@ +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/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cb80749 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +antispam: + build: . + environment: + PASSWORD: 'apassword' + volume_driver: local + volumes: + - "filter:/var/lib/rspamd" + ports: + - 11334:11334 + - 11333:11333 + diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..aeccd01 --- /dev/null +++ b/start.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +SECURE_IP=${SECURE_IP:-"127.0.0.1"} +PASSWORD=${PASSWORD:-"mailu"} +ENABLE_PASSWORD=${ENABLE_PASSWORD:-$PASSWORD} + +cat << EOF > /etc/rspamd/local.d/worker-controller.inc +secure_ip = "${SECURE_IP}"; +password = "${PASSWORD}"; +enable_password = "${PASSWORD}"; +EOF + + +rspamd -i +tail -f /var/log/rspamd/rspamd.log