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 135f0b892eefab21432d8b3a27c9e16f025534ac Author: Quan Tran <hqt...@linagora.com> AuthorDate: Fri Mar 28 14:52:00 2025 +0700 JAMES-4124 Rspamd + Redis Sentinel docker compose sample --- .../docker-compose-rspamd-with-redis-sentinel.yml | 113 +++++++++++++++++++++ .../redis/master/docker-entrypoint-master.sh | 6 ++ .../redis/master/redis.conf.template | 4 + .../redis/replica/docker-entrypoint-replica.sh | 6 ++ .../redis/replica/redis.conf.template | 5 + .../redis/sentinel/docker-entrypoint-sentinel.sh | 6 ++ .../redis/sentinel/sentinel.conf.template | 9 ++ .../rspamd-redis-sentinel.conf | 6 ++ 8 files changed, 155 insertions(+) diff --git a/third-party/rspamd/docker-compose-rspamd-with-redis-sentinel.yml b/third-party/rspamd/docker-compose-rspamd-with-redis-sentinel.yml new file mode 100644 index 0000000000..51331b1527 --- /dev/null +++ b/third-party/rspamd/docker-compose-rspamd-with-redis-sentinel.yml @@ -0,0 +1,113 @@ +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" + + redis-master: + image: redis:7.2.5 + container_name: redis-master + command: sh /usr/local/etc/redis/docker-entrypoint.sh + volumes: + - ./sample-configuration/redis/master/redis.conf.template:/usr/local/etc/redis/redis.conf.template + - ./sample-configuration/redis/master/docker-entrypoint-master.sh:/usr/local/etc/redis/docker-entrypoint.sh + healthcheck: + test: ["CMD", "redis-cli", "ping", "|", "grep", "PONG"] + interval: 10s + timeout: 10s + retries: 5 + + redis-replica-1: + image: redis:7.2.5 + container_name: redis-replica-1 + depends_on: + redis-master: + condition: service_healthy + command: sh /usr/local/etc/redis/docker-entrypoint.sh + volumes: + - ./sample-configuration/redis/replica/redis.conf.template:/usr/local/etc/redis/redis.conf.template + - ./sample-configuration/redis/replica/docker-entrypoint-replica.sh:/usr/local/etc/redis/docker-entrypoint.sh + + redis-replica-2: + image: redis:7.2.5 + container_name: redis-replica-2 + depends_on: + redis-master: + condition: service_healthy + command: sh /usr/local/etc/redis/docker-entrypoint.sh + volumes: + - ./sample-configuration/redis/replica/redis.conf.template:/usr/local/etc/redis/redis.conf.template + - ./sample-configuration/redis/replica/docker-entrypoint-replica.sh:/usr/local/etc/redis/docker-entrypoint.sh + + sentinel-1: + image: redis:7.2.5 + container_name: sentinel-1 + depends_on: + redis-master: + condition: service_healthy + command: sh /usr/local/etc/redis/docker-entrypoint.sh + volumes: + - ./sample-configuration/redis/sentinel/sentinel.conf.template:/usr/local/etc/redis/sentinel.conf.template + - ./sample-configuration/redis/sentinel/docker-entrypoint-sentinel.sh:/usr/local/etc/redis/docker-entrypoint.sh + + sentinel-2: + image: redis:7.2.5 + container_name: sentinel-2 + depends_on: + redis-master: + condition: service_healthy + command: sh /usr/local/etc/redis/docker-entrypoint.sh + volumes: + - ./sample-configuration/redis/sentinel/sentinel.conf.template:/usr/local/etc/redis/sentinel.conf.template + - ./sample-configuration/redis/sentinel/docker-entrypoint-sentinel.sh:/usr/local/etc/redis/docker-entrypoint.sh + + sentinel-3: + image: redis:7.2.5 + container_name: sentinel-3 + depends_on: + redis-master: + condition: service_healthy + command: sh /usr/local/etc/redis/docker-entrypoint.sh + volumes: + - ./sample-configuration/redis/sentinel/sentinel.conf.template:/usr/local/etc/redis/sentinel.conf.template + - ./sample-configuration/redis/sentinel/docker-entrypoint-sentinel.sh:/usr/local/etc/redis/docker-entrypoint.sh + + rspamd: + depends_on: + redis-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-redis-sentinel.conf:/etc/rspamd/local.d/redis.conf + - ./sample-configuration/worker-controller.inc:/etc/rspamd/local.d/worker-controller.inc + ports: + - 11334:11334 diff --git a/third-party/rspamd/sample-configuration/redis/master/docker-entrypoint-master.sh b/third-party/rspamd/sample-configuration/redis/master/docker-entrypoint-master.sh new file mode 100644 index 0000000000..c14a6b739b --- /dev/null +++ b/third-party/rspamd/sample-configuration/redis/master/docker-entrypoint-master.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cp /usr/local/etc/redis/redis.conf.template /usr/local/etc/redis/redis.conf +chmod 777 /usr/local/etc/redis/redis.conf + +redis-server /usr/local/etc/redis/redis.conf diff --git a/third-party/rspamd/sample-configuration/redis/master/redis.conf.template b/third-party/rspamd/sample-configuration/redis/master/redis.conf.template new file mode 100644 index 0000000000..39b0d5bb06 --- /dev/null +++ b/third-party/rspamd/sample-configuration/redis/master/redis.conf.template @@ -0,0 +1,4 @@ +loglevel debug +appendonly yes +requirepass secret1 +masterauth secret1 \ No newline at end of file diff --git a/third-party/rspamd/sample-configuration/redis/replica/docker-entrypoint-replica.sh b/third-party/rspamd/sample-configuration/redis/replica/docker-entrypoint-replica.sh new file mode 100644 index 0000000000..c14a6b739b --- /dev/null +++ b/third-party/rspamd/sample-configuration/redis/replica/docker-entrypoint-replica.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cp /usr/local/etc/redis/redis.conf.template /usr/local/etc/redis/redis.conf +chmod 777 /usr/local/etc/redis/redis.conf + +redis-server /usr/local/etc/redis/redis.conf diff --git a/third-party/rspamd/sample-configuration/redis/replica/redis.conf.template b/third-party/rspamd/sample-configuration/redis/replica/redis.conf.template new file mode 100644 index 0000000000..f3892a8e34 --- /dev/null +++ b/third-party/rspamd/sample-configuration/redis/replica/redis.conf.template @@ -0,0 +1,5 @@ +loglevel debug +appendonly yes +replicaof redis-master 6379 +masterauth secret1 +requirepass secret1 \ No newline at end of file diff --git a/third-party/rspamd/sample-configuration/redis/sentinel/docker-entrypoint-sentinel.sh b/third-party/rspamd/sample-configuration/redis/sentinel/docker-entrypoint-sentinel.sh new file mode 100644 index 0000000000..c9f9724528 --- /dev/null +++ b/third-party/rspamd/sample-configuration/redis/sentinel/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/redis/sentinel/sentinel.conf.template b/third-party/rspamd/sample-configuration/redis/sentinel/sentinel.conf.template new file mode 100644 index 0000000000..0eb3c3f8b6 --- /dev/null +++ b/third-party/rspamd/sample-configuration/redis/sentinel/sentinel.conf.template @@ -0,0 +1,9 @@ +port 26379 +loglevel debug + +sentinel monitor mymaster redis-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-redis-sentinel.conf b/third-party/rspamd/sample-configuration/rspamd-redis-sentinel.conf new file mode 100644 index 0000000000..8f79540bea --- /dev/null +++ b/third-party/rspamd/sample-configuration/rspamd-redis-sentinel.conf @@ -0,0 +1,6 @@ +servers = "redis-master:6379,redis-replica-1:6379,redis-replica-2:6379"; +sentinels = "sentinel-1:26379,sentinel-2:26379,sentinel-3:26379"; +password = "secret1"; +sentinel_watch_time = 1min; # 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-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org