From 27de9dbf92c090b3504bc14404e3cca511883b71 Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 30 Oct 2019 20:07:58 +0100 Subject: [PATCH] [Rspamd] Slight changes to improve memory usage [Web] Dirty hack to touch Rspamd maps a second time --- data/Dockerfiles/rspamd/Dockerfile | 1 - data/Dockerfiles/rspamd/docker-entrypoint.sh | 8 +++----- data/conf/rspamd/local.d/options.inc | 1 + data/conf/rspamd/local.d/phishing.conf | 1 + data/conf/rspamd/override.d/logging.inc | 2 +- data/conf/rspamd/override.d/worker-fuzzy.inc | 2 +- data/conf/rspamd/override.d/worker-normal.inc | 1 + data/web/inc/functions.rspamd.inc.php | 2 ++ docker-compose.yml | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 data/conf/rspamd/local.d/phishing.conf diff --git a/data/Dockerfiles/rspamd/Dockerfile b/data/Dockerfiles/rspamd/Dockerfile index af614389..57f67e30 100644 --- a/data/Dockerfiles/rspamd/Dockerfile +++ b/data/Dockerfiles/rspamd/Dockerfile @@ -14,7 +14,6 @@ RUN apt-get update && apt-get install -y \ netcat \ && apt-key adv --fetch-keys https://rspamd.com/apt-stable/gpg.key \ && echo "deb [arch=amd64] https://rspamd.com/apt-stable/ $CODENAME main" > /etc/apt/sources.list.d/rspamd.list \ - && echo "deb-src [arch=amd64] https://rspamd.com/apt-stable/ $CODENAME main" >> /etc/apt/sources.list.d/rspamd.list \ && apt-get update \ && apt-get --no-install-recommends -y install rspamd \ && rm -rf /var/lib/apt/lists/* \ diff --git a/data/Dockerfiles/rspamd/docker-entrypoint.sh b/data/Dockerfiles/rspamd/docker-entrypoint.sh index 059fe78f..5cfc0c5a 100755 --- a/data/Dockerfiles/rspamd/docker-entrypoint.sh +++ b/data/Dockerfiles/rspamd/docker-entrypoint.sh @@ -18,7 +18,6 @@ touch /etc/rspamd/rspamd.conf.local \ chmod 755 /var/lib/rspamd -addgroup --system --gid 82 www-access [[ ! -f /etc/rspamd/override.d/worker-controller-password.inc ]] && echo '# Autogenerated by mailcow' > /etc/rspamd/override.d/worker-controller-password.inc @@ -39,7 +38,6 @@ fi chown -R _rspamd:_rspamd /var/lib/rspamd \ /etc/rspamd/local.d \ /etc/rspamd/override.d \ - /etc/rspamd/custom \ /etc/rspamd/rspamd.conf.local \ /etc/rspamd/rspamd.conf.override \ /etc/rspamd/plugins.d @@ -62,9 +60,9 @@ touch /etc/rspamd/custom/global_mime_from_blacklist.map \ # www-data (82) group needs to write to these files chown _rspamd:_rspamd /etc/rspamd/custom/ -chmod 0755 /etc/rspamd/custom/ -chown -R _rspamd:www-access /etc/rspamd/custom/* -chmod -R 664 /etc/rspamd/custom/* +chmod 0755 /etc/rspamd/custom/. +chown -R 82:82 /etc/rspamd/custom/* +chmod 644 -R /etc/rspamd/custom/* # Run hooks for file in /hooks/*; do diff --git a/data/conf/rspamd/local.d/options.inc b/data/conf/rspamd/local.d/options.inc index 4fbdfba7..6cdf5f0e 100644 --- a/data/conf/rspamd/local.d/options.inc +++ b/data/conf/rspamd/local.d/options.inc @@ -7,3 +7,4 @@ dns { retransmits = 2; } disable_monitoring = true; +full_gc_iters = 1; diff --git a/data/conf/rspamd/local.d/phishing.conf b/data/conf/rspamd/local.d/phishing.conf new file mode 100644 index 00000000..69be164c --- /dev/null +++ b/data/conf/rspamd/local.d/phishing.conf @@ -0,0 +1 @@ +phishtank_enabled = false; diff --git a/data/conf/rspamd/override.d/logging.inc b/data/conf/rspamd/override.d/logging.inc index 64d4064d..750b25cd 100644 --- a/data/conf/rspamd/override.d/logging.inc +++ b/data/conf/rspamd/override.d/logging.inc @@ -1,4 +1,4 @@ -level = "silent"; +level = "info"; type = "console"; systemd = false; .include "$CONFDIR/logging.inc" diff --git a/data/conf/rspamd/override.d/worker-fuzzy.inc b/data/conf/rspamd/override.d/worker-fuzzy.inc index 09b39c93..291e6150 100644 --- a/data/conf/rspamd/override.d/worker-fuzzy.inc +++ b/data/conf/rspamd/override.d/worker-fuzzy.inc @@ -2,7 +2,7 @@ bind_socket = "*:11445"; allow_update = ["127.0.0.1", "::1"]; # Number of processes to serve this storage (useful for read scaling) -count = 2; +count = 1; # Backend ("sqlite" or "redis" - default "sqlite") backend = "redis"; # Hashes storage time (3 months) diff --git a/data/conf/rspamd/override.d/worker-normal.inc b/data/conf/rspamd/override.d/worker-normal.inc index a7ab4baf..ad6c2b80 100644 --- a/data/conf/rspamd/override.d/worker-normal.inc +++ b/data/conf/rspamd/override.d/worker-normal.inc @@ -1,3 +1,4 @@ bind_socket = "*:11333"; task_timeout = 12s; +count = 1; .include(try=true; priority=20) "$CONFDIR/override.d/worker-normal.custom.inc" diff --git a/data/web/inc/functions.rspamd.inc.php b/data/web/inc/functions.rspamd.inc.php index 22d405a3..a0312f49 100644 --- a/data/web/inc/functions.rspamd.inc.php +++ b/data/web/inc/functions.rspamd.inc.php @@ -235,6 +235,8 @@ function rspamd($_action, $_data = null) { } fwrite($map_handle, $map_content . PHP_EOL); fclose($map_handle); + sleep(1.5); + touch('/rspamd_custom_maps/' . $map); } } catch (Exception $e) { diff --git a/docker-compose.yml b/docker-compose.yml index 422a5d1c..eafaa1ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,7 +68,7 @@ services: - clamd rspamd-mailcow: - image: mailcow/rspamd:1.53 + image: mailcow/rspamd:1.54 build: ./data/Dockerfiles/rspamd stop_grace_period: 30s depends_on: