-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
148 lines (142 loc) · 4.67 KB
/
Copy pathdocker-compose.yml
File metadata and controls
148 lines (142 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Test infrastructure for redis-rb. Topology selection via Docker profiles:
# docker compose --profile standalone up -d --wait (just the master)
# docker compose --profile replica up -d --wait (master + replica, no sentinels)
# docker compose --profile sentinel up -d --wait (master + replica + 3 sentinels)
# docker compose --profile cluster up -d --wait (6-node cluster)
# docker compose --profile modules up -d --wait (Redis Stack instance for module tests)
# docker compose --profile all up -d --wait (everything)
#
# Override the Redis version with REDIS_VERSION=8.X.Y. The image is amd64-only,
# so on Apple Silicon the platform is pinned via Rosetta emulation.
#
# Uses host networking so the test runner reaches services via 127.0.0.1 at the
# ports redis-rb has used historically: 6381 / 6382 / 6383 / 6400-6402 / 16380-16385.
# This is the simplest model that keeps sentinel and cluster reporting host-
# reachable addresses.
#
# macOS note: Docker Desktop requires the "host networking" beta feature
# (Settings > Resources > Network > Enable host networking). Without it, Linux
# containers can use host networking inside the VM but their ports won't be
# visible on the macOS host. CI runs on Linux and is unaffected.
x-redis-image: &redis-image
image: redislabs/client-libs-test:${REDIS_VERSION:-8.8.0}
platform: linux/amd64
network_mode: host
restart: "no"
services:
standalone:
<<: *redis-image
container_name: redis-rb-standalone
profiles: [standalone, replica, sentinel, all]
environment:
PORT: "6381"
REDIS_CLUSTER: "no"
PROTECTED_MODE: "no"
command:
- --include
- /redis/extra.conf
- --unixsocket
- /sockets/redis.sock
- --unixsocketperm
- "777"
volumes:
- ./test/support/redis.conf:/redis/extra.conf:ro
- ./tmp:/sockets
- ./dockers/standalone:/redis/work
healthcheck:
test: ["CMD", "redis-cli", "-p", "6381", "ping"]
interval: 1s
timeout: 3s
retries: 30
replica:
<<: *redis-image
container_name: redis-rb-replica
profiles: [replica, sentinel, all]
depends_on:
standalone:
condition: service_healthy
environment:
PORT: "6382"
REDIS_CLUSTER: "no"
PROTECTED_MODE: "no"
command:
- --include
- /redis/extra.conf
- --replicaof
- "127.0.0.1"
- "6381"
volumes:
- ./test/support/redis.conf:/redis/extra.conf:ro
- ./dockers/replica:/redis/work
healthcheck:
test: ["CMD", "redis-cli", "-p", "6382", "ping"]
interval: 1s
timeout: 3s
retries: 30
sentinel:
<<: *redis-image
container_name: redis-rb-sentinel
profiles: [sentinel, all]
depends_on:
standalone:
condition: service_healthy
replica:
condition: service_healthy
environment:
# The entrypoint sees preconfigured node dirs under /redis/config and starts
# each as a sentinel because their names begin with node-sentinel*.
REDIS_CLUSTER: "no"
PROTECTED_MODE: "no"
volumes:
- ./test/support/sentinel-config:/redis/config:ro
- ./dockers/sentinel:/redis/work
healthcheck:
test: ["CMD", "redis-cli", "-p", "6400", "ping"]
interval: 1s
timeout: 3s
retries: 30
# A standalone instance with Redis modules (e.g. RedisJSON) loaded, dedicated to the module
# test suite on Redis < 8 — where modules are NOT in core and need a Redis Stack image.
modules:
<<: *redis-image
image: redislabs/client-libs-test:${REDIS_STACK_VERSION:-rs-7.4.0-v8}
container_name: redis-rb-modules
profiles: [modules]
environment:
PORT: "6383"
REDIS_CLUSTER: "no"
PROTECTED_MODE: "no"
command:
- --include
- /redis/extra.conf
volumes:
- ./test/support/redis.conf:/redis/extra.conf:ro
- ./dockers/modules:/redis/work
healthcheck:
test: ["CMD", "redis-cli", "-p", "6383", "ping"]
interval: 1s
timeout: 3s
retries: 30
cluster:
<<: *redis-image
container_name: redis-rb-cluster
profiles: [cluster, all]
environment:
REDIS_CLUSTER: "yes"
NODES: "6"
REPLICAS: "1"
PORT: "16380"
PROTECTED_MODE: "no"
command:
- --include
- /redis/extra.conf
volumes:
- ./test/support/redis.conf:/redis/extra.conf:ro
- ./dockers/cluster:/redis/work
healthcheck:
# cluster_state:ok appears only after CLUSTER MEET + slot assignment finish.
# This addresses the historical InitialSetupError flake.
test: ["CMD-SHELL", "redis-cli -p 16380 cluster info | grep -q cluster_state:ok"]
interval: 1s
timeout: 3s
retries: 60