You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2025/04/02 04:16:05 UTC
(james-project) 02/05: JAMES-4124 Rspamd + KVrocks sentinel docker compose sample
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit d91495c7a5839b3e23d8562bbde462d624043868
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Thu Mar 27 16:10:13 2025 +0700
JAMES-4124 Rspamd + KVrocks sentinel docker compose sample
---
...docker-compose-rspamd-with-kvrocks-sentinel.yml | 119 +++++++++++++++++++++
.../sample-configuration/classifier-bayes.conf | 2 +
.../kvrocks/sentinel/master-node/kvrocks.conf | 4 +
.../kvrocks/sentinel/replica-node/kvrocks.conf | 5 +
.../sentinel-node/docker-entrypoint-sentinel.sh | 6 ++
.../sentinel/sentinel-node/sentinel.conf.template | 9 ++
.../rspamd-kvrocks-sentinel.conf | 6 ++
7 files changed, 151 insertions(+)
diff --git a/third-party/rspamd/docker-compose-rspamd-with-kvrocks-sentinel.yml b/third-party/rspamd/docker-compose-rspamd-with-kvrocks-sentinel.yml
new file mode 100644
index 0000000000..2150f27f67
--- /dev/null
+++ b/third-party/rspamd/docker-compose-rspamd-with-kvrocks-sentinel.yml
@@ -0,0 +1,119 @@
+version: '3'
+
+services:
+
+ james:
+ depends_on:
+ rspamd:
+ condition: service_healthy
+ image: apache/james:memory-latest
+ container_name: james
+ hostname: james.local
+ command:
+ - --generate-keystore
+ volumes:
+ - ./target/apache-james-rspamd-jar-with-dependencies.jar:/root/extensions-jars/james-server-rspamd.jar
+ - ./sample-configuration/extensions.properties:/root/conf/extensions.properties
+ - ./sample-configuration/mailetcontainer_memory.xml:/root/conf/mailetcontainer.xml
+ - ./sample-configuration/listeners.xml:/root/conf/listeners.xml
+ - ./sample-configuration/rspamd.properties:/root/conf/rspamd.properties
+ - ./sample-configuration/webadmin.properties:/root/conf/webadmin.properties
+ - ./sample-configuration/healthcheck.properties:/root/conf/healthcheck.properties
+ ports:
+ - "80:80"
+ - "25:25"
+ - "110:110"
+ - "143:143"
+ - "465:465"
+ - "587:587"
+ - "993:993"
+ - "8000:8000"
+
+ kvrocks-master:
+ image: apache/kvrocks:2.11.1
+ container_name: kvrocks-master
+ volumes:
+ - ./sample-configuration/kvrocks/sentinel/master-node/kvrocks.conf:/var/lib/kvrocks/kvrocks.conf
+ - kvrocks_master_data:/var/lib/kvrocks
+ healthcheck:
+ test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
+ interval: 10s
+ timeout: 10s
+ retries: 5
+
+ kvrocks-replica-1:
+ image: apache/kvrocks:2.11.1
+ container_name: kvrocks-replica-1
+ depends_on:
+ kvrocks-master:
+ condition: service_healthy
+ healthcheck:
+ test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
+ volumes:
+ - ./sample-configuration/kvrocks/sentinel/replica-node/kvrocks.conf:/var/lib/kvrocks/kvrocks.conf
+ - kvrocks_replica1_data:/var/lib/kvrocks
+
+ kvrocks-replica-2:
+ image: apache/kvrocks:2.11.1
+ container_name: kvrocks-replica-2
+ depends_on:
+ kvrocks-master:
+ condition: service_healthy
+ healthcheck:
+ test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
+ volumes:
+ - ./sample-configuration/kvrocks/sentinel/replica-node/kvrocks.conf:/var/lib/kvrocks/kvrocks.conf
+ - kvrocks_replica2_data:/var/lib/kvrocks
+
+ sentinel-1:
+ image: redis:7.2.5
+ container_name: sentinel-1
+ depends_on:
+ kvrocks-master:
+ condition: service_healthy
+ command: sh /usr/local/etc/redis/docker-entrypoint.sh
+ volumes:
+ - ./sample-configuration/kvrocks/sentinel/sentinel-node/sentinel.conf.template:/usr/local/etc/redis/sentinel.conf.template
+ - ./sample-configuration/kvrocks/sentinel/sentinel-node/docker-entrypoint-sentinel.sh:/usr/local/etc/redis/docker-entrypoint.sh
+
+ sentinel-2:
+ image: redis:7.2.5
+ container_name: sentinel-2
+ depends_on:
+ kvrocks-master:
+ condition: service_healthy
+ command: sh /usr/local/etc/redis/docker-entrypoint.sh
+ volumes:
+ - ./sample-configuration/kvrocks/sentinel/sentinel-node/sentinel.conf.template:/usr/local/etc/redis/sentinel.conf.template
+ - ./sample-configuration/kvrocks/sentinel/sentinel-node/docker-entrypoint-sentinel.sh:/usr/local/etc/redis/docker-entrypoint.sh
+
+ sentinel-3:
+ image: redis:7.2.5
+ container_name: sentinel-3
+ depends_on:
+ kvrocks-master:
+ condition: service_healthy
+ command: sh /usr/local/etc/redis/docker-entrypoint.sh
+ volumes:
+ - ./sample-configuration/kvrocks/sentinel/sentinel-node/sentinel.conf.template:/usr/local/etc/redis/sentinel.conf.template
+ - ./sample-configuration/kvrocks/sentinel/sentinel-node/docker-entrypoint-sentinel.sh:/usr/local/etc/redis/docker-entrypoint.sh
+
+ rspamd:
+ depends_on:
+ kvrocks-master:
+ condition: service_healthy
+ container_name: rspamd
+ image: rspamd/rspamd:3.9.1
+ environment:
+ - RSPAMD_PASSWORD=admin
+ volumes:
+ - ./sample-configuration/classifier-bayes.conf:/etc/rspamd/local.d/classifier-bayes.conf
+ - ./sample-configuration/rspamd-kvrocks-sentinel.conf:/etc/rspamd/local.d/redis.conf
+ - ./sample-configuration/worker-controller.inc:/etc/rspamd/local.d/worker-controller.inc
+ ports:
+ - 11334:11334
+
+volumes:
+ kvrocks_master_data:
+ kvrocks_replica1_data:
+ kvrocks_replica2_data:
\ No newline at end of file
diff --git a/third-party/rspamd/sample-configuration/classifier-bayes.conf b/third-party/rspamd/sample-configuration/classifier-bayes.conf
new file mode 100644
index 0000000000..6cd8b7c747
--- /dev/null
+++ b/third-party/rspamd/sample-configuration/classifier-bayes.conf
@@ -0,0 +1,2 @@
+per_user = true; # Enable per user classifier.
+min_learns = 20; # Minimum learn to count for both spam and ham classes to perform classification.
diff --git a/third-party/rspamd/sample-configuration/kvrocks/sentinel/master-node/kvrocks.conf b/third-party/rspamd/sample-configuration/kvrocks/sentinel/master-node/kvrocks.conf
new file mode 100644
index 0000000000..88d6b4ec05
--- /dev/null
+++ b/third-party/rspamd/sample-configuration/kvrocks/sentinel/master-node/kvrocks.conf
@@ -0,0 +1,4 @@
+log-level info
+requirepass secret1
+masterauth secret1
+port 6379
diff --git a/third-party/rspamd/sample-configuration/kvrocks/sentinel/replica-node/kvrocks.conf b/third-party/rspamd/sample-configuration/kvrocks/sentinel/replica-node/kvrocks.conf
new file mode 100644
index 0000000000..bea269d1dd
--- /dev/null
+++ b/third-party/rspamd/sample-configuration/kvrocks/sentinel/replica-node/kvrocks.conf
@@ -0,0 +1,5 @@
+log-level info
+slaveof kvrocks-master 6379
+masterauth secret1
+requirepass secret1
+port 6379
diff --git a/third-party/rspamd/sample-configuration/kvrocks/sentinel/sentinel-node/docker-entrypoint-sentinel.sh b/third-party/rspamd/sample-configuration/kvrocks/sentinel/sentinel-node/docker-entrypoint-sentinel.sh
new file mode 100644
index 0000000000..c9f9724528
--- /dev/null
+++ b/third-party/rspamd/sample-configuration/kvrocks/sentinel/sentinel-node/docker-entrypoint-sentinel.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+cp /usr/local/etc/redis/sentinel.conf.template /usr/local/etc/redis/sentinel.conf
+chmod 777 /usr/local/etc/redis/sentinel.conf
+
+redis-sentinel /usr/local/etc/redis/sentinel.conf
diff --git a/third-party/rspamd/sample-configuration/kvrocks/sentinel/sentinel-node/sentinel.conf.template b/third-party/rspamd/sample-configuration/kvrocks/sentinel/sentinel-node/sentinel.conf.template
new file mode 100644
index 0000000000..fab100bab5
--- /dev/null
+++ b/third-party/rspamd/sample-configuration/kvrocks/sentinel/sentinel-node/sentinel.conf.template
@@ -0,0 +1,9 @@
+port 26379
+loglevel debug
+
+sentinel monitor mymaster kvrocks-master 6379 2
+sentinel auth-pass mymaster secret1
+sentinel down-after-milliseconds mymaster 5000
+sentinel failover-timeout mymaster 10000
+sentinel parallel-syncs mymaster 1
+sentinel resolve-hostnames yes
\ No newline at end of file
diff --git a/third-party/rspamd/sample-configuration/rspamd-kvrocks-sentinel.conf b/third-party/rspamd/sample-configuration/rspamd-kvrocks-sentinel.conf
new file mode 100644
index 0000000000..5c15e14062
--- /dev/null
+++ b/third-party/rspamd/sample-configuration/rspamd-kvrocks-sentinel.conf
@@ -0,0 +1,6 @@
+servers = "kvrocks-master:6379,kvrocks-replica-1:6379,kvrocks-replica-2:6379";
+sentinels = "sentinel-1:26379,sentinel-2:26379,sentinel-3:26379";
+password = "secret1";
+sentinel_watch_time = 10s; # How often Rspam will query sentinels for masters and slaves
+sentinel_masters_pattern = "^mymaster.*$"; # Defines masters pattern to match in Lua syntax (no pattern means all masters)
+timeout = 5s;
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org