2
0
mirror of https://github.com/boostorg/redis.git synced 2026-01-19 04:42:09 +00:00
Files
redis/tools/docker-compose.yml
Anarthal (Rubén Pérez) bdd9c327c1 Adds Sentinel support (#345)
close #237
close #269
close #268
close #229
2025-11-19 22:31:19 +01:00

141 lines
4.1 KiB
YAML

services:
redis-master:
container_name: redis-master
image: ${SERVER_IMAGE}
network_mode: host
command: >
sh -c 'chmod 777 /tmp/redis-socks &&
redis-server \
--replica-announce-ip localhost \
--port 6379 \
--tls-port 16379 \
--tls-cert-file /docker/tls/server.crt \
--tls-key-file /docker/tls/server.key \
--tls-ca-cert-file /docker/tls/ca.crt \
--tls-auth-clients no \
--unixsocket /tmp/redis-socks/redis.sock \
--unixsocketperm 777'
volumes:
- ./docker:/docker
- /tmp/redis-socks:/tmp/redis-socks
redis-replica-1:
container_name: redis-replica-1
image: ${SERVER_IMAGE}
network_mode: host
command:
[
"redis-server",
"--replica-announce-ip", "localhost",
"--replicaof", "localhost", "6379",
"--port", "6380",
"--tls-port", "16380",
"--tls-cert-file", "/docker/tls/server.crt",
"--tls-key-file", "/docker/tls/server.key",
"--tls-ca-cert-file", "/docker/tls/ca.crt",
"--tls-auth-clients", "no",
]
volumes:
- ./docker:/docker
redis-replica-2:
container_name: redis-replica-2
image: ${SERVER_IMAGE}
network_mode: host
command:
[
"redis-server",
"--replica-announce-ip", "localhost",
"--replicaof", "localhost", "6379",
"--port", "6381",
"--tls-port", "16381",
"--tls-cert-file", "/docker/tls/server.crt",
"--tls-key-file", "/docker/tls/server.key",
"--tls-ca-cert-file", "/docker/tls/ca.crt",
"--tls-auth-clients", "no",
]
volumes:
- ./docker:/docker
sentinel-1:
container_name: sentinel-1
image: ${SERVER_IMAGE}
network_mode: host
command: >
sh -c 'cat << EOF > /etc/sentinel.conf && redis-sentinel /etc/sentinel.conf
port 26379
tls-port 36379
tls-cert-file /docker/tls/server.crt
tls-key-file /docker/tls/server.key
tls-ca-cert-file /docker/tls/ca.crt
tls-auth-clients no
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel announce-ip localhost
sentinel monitor mymaster localhost 6379 2
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 10000
sentinel parallel-syncs mymaster 1
EOF'
volumes:
- ./docker:/docker
sentinel-2:
container_name: sentinel-2
image: ${SERVER_IMAGE}
network_mode: host
command: >
sh -c 'cat << EOF > /etc/sentinel.conf && redis-sentinel /etc/sentinel.conf
port 26380
tls-port 36380
tls-cert-file /docker/tls/server.crt
tls-key-file /docker/tls/server.key
tls-ca-cert-file /docker/tls/ca.crt
tls-auth-clients no
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel announce-ip localhost
sentinel monitor mymaster localhost 6379 2
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 10000
sentinel parallel-syncs mymaster 1
EOF'
volumes:
- ./docker:/docker
sentinel-3:
container_name: sentinel-3
image: ${SERVER_IMAGE}
network_mode: host
command: >
sh -c 'cat << EOF > /etc/sentinel.conf && redis-sentinel /etc/sentinel.conf
port 26381
tls-port 36381
tls-cert-file /docker/tls/server.crt
tls-key-file /docker/tls/server.key
tls-ca-cert-file /docker/tls/ca.crt
tls-auth-clients no
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel announce-ip localhost
sentinel monitor mymaster localhost 6379 2
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 10000
sentinel parallel-syncs mymaster 1
EOF'
volumes:
- ./docker:/docker
builder:
container_name: builder
image: ${BUILDER_IMAGE}
network_mode: host
tty: true
volumes:
- ../:/boost-redis
- /tmp/redis-socks:/tmp/redis-socks