-
Notifications
You must be signed in to change notification settings - Fork 330
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
215 lines (196 loc) · 6.22 KB
/
docker-compose.yml
File metadata and controls
215 lines (196 loc) · 6.22 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
version: "3.9"
services:
zipkin:
image: openzipkin/zipkin:latest
security_opt:
- no-new-privileges:true
read_only: true
ports:
- 9411:9411
datadog:
image: ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:latest
security_opt:
- no-new-privileges:true
read_only: true
ports:
- 8126:8126
# Note: we run both standalone redis and clustered redis because different integration tests focus on different
# modes of redis. In the future, we should probably add redis sentinel.
# standalone redis
redis:
image: redis:latest
security_opt:
- no-new-privileges:true
read_only: true
ports:
- 6379:6379
# redis cluster
redis-cluster-7000:
image: cimg/redis:7.4.8
command:
[
"redis-server",
"--protected-mode",
"no",
"--port",
"7000",
"--cluster-enabled",
"yes",
]
ports:
- 7000:7000
- 17000:17000
networks:
- redis-net
redis-cluster-7001:
image: cimg/redis:7.4.8
command:
[
"redis-server",
"--protected-mode",
"no",
"--port",
"7001",
"--cluster-enabled",
"yes",
]
ports:
- 7001:7001
- 17001:17001
networks:
- redis-net
redis-cluster-7002:
image: cimg/redis:7.4.8
command:
[
"redis-server",
"--protected-mode",
"no",
"--port",
"7002",
"--cluster-enabled",
"yes",
]
ports:
- 7002:7002
- 17002:17002
networks:
- redis-net
redis-cluster-7003:
image: cimg/redis:7.4.8
command:
[
"redis-server",
"--protected-mode",
"no",
"--port",
"7003",
"--cluster-enabled",
"yes",
]
ports:
- 7003:7003
- 17003:17003
networks:
- redis-net
redis-cluster-7004:
image: cimg/redis:7.4.8
command:
[
"redis-server",
"--protected-mode",
"no",
"--port",
"7004",
"--cluster-enabled",
"yes",
]
ports:
- 7004:7004
- 17004:17004
networks:
- redis-net
redis-cluster-7005:
image: cimg/redis:7.4.8
command:
[
"redis-server",
"--protected-mode",
"no",
"--port",
"7005",
"--cluster-enabled",
"yes",
]
ports:
- 7005:7005
- 17005:17005
networks:
- redis-net
# just in case we've already run docker compose up before, we do a hard reset on the cluster to remove any configuration or saved
# topology data that might have changed between `docker compose up` runs; you can also do a `--force-recreate` with your `docker
# compose run` to just recreate everything and not worry about anything persisting; we also fire the hard resets off at the same
# time to try and avoid nodes gossiping stale state to each other
#
# we then create the cluster after giving the nodes time to stabilize (the first 30s sleep); after cluster creation, we
# sleep for another 30s to get through synchronization with enough time to spare for clearing past failures
#
# finally, we set the announced hostname to something useable outside of docker so the test binaries can reach it
#
# NOTE: you might see a bunch of connection errors across `docker compose run`s because containers might come up with different
# internal networking (in particular, different IPs for the services) but redis will hold on to cluster info (that's the
# working theory, it might be wrong)
redis-cluster-startup:
image: cimg/redis:7.4.8
depends_on:
- redis-cluster-7000
- redis-cluster-7001
- redis-cluster-7002
- redis-cluster-7003
- redis-cluster-7004
- redis-cluster-7005
command: |
sh -c "
echo 'waiting 5s for containers'
sleep 5
redis-cli -h redis-cluster-7000 -p 7000 FLUSHALL &
redis-cli -h redis-cluster-7001 -p 7001 FLUSHALL &
redis-cli -h redis-cluster-7002 -p 7002 FLUSHALL &
redis-cli -h redis-cluster-7003 -p 7003 FLUSHALL &
redis-cli -h redis-cluster-7004 -p 7004 FLUSHALL &
redis-cli -h redis-cluster-7005 -p 7005 FLUSHALL &
wait
redis-cli -h redis-cluster-7000 -p 7000 CLUSTER RESET HARD &
redis-cli -h redis-cluster-7001 -p 7001 CLUSTER RESET HARD &
redis-cli -h redis-cluster-7002 -p 7002 CLUSTER RESET HARD &
redis-cli -h redis-cluster-7003 -p 7003 CLUSTER RESET HARD &
redis-cli -h redis-cluster-7004 -p 7004 CLUSTER RESET HARD &
redis-cli -h redis-cluster-7005 -p 7005 CLUSTER RESET HARD &
wait
echo 'waiting 30s for cluster config changes'
sleep 30
echo yes | redis-cli --cluster create --cluster-replicas 1 redis-cluster-7000:7000 redis-cluster-7001:7001 redis-cluster-7002:7002 redis-cluster-7003:7003 redis-cluster-7004:7004 redis-cluster-7005:7005
echo 'waiting 30s for cluster sync'
sleep 30
redis-cli -h redis-cluster-7000 -p 7000 CONFIG SET cluster-announce-hostname localhost
redis-cli -h redis-cluster-7001 -p 7001 CONFIG SET cluster-announce-hostname localhost
redis-cli -h redis-cluster-7002 -p 7002 CONFIG SET cluster-announce-hostname localhost
redis-cli -h redis-cluster-7003 -p 7003 CONFIG SET cluster-announce-hostname localhost
redis-cli -h redis-cluster-7004 -p 7004 CONFIG SET cluster-announce-hostname localhost
redis-cli -h redis-cluster-7005 -p 7005 CONFIG SET cluster-announce-hostname localhost
echo 'waiting 30s for cluster config'
sleep 30
echo 'checking internal connectivity'
redis-cli -h redis-cluster-7000 -p 7000 INFO REPLICATION
redis-cli -h redis-cluster-7001 -p 7001 INFO REPLICATION
redis-cli -h redis-cluster-7002 -p 7002 INFO REPLICATION
redis-cli -h redis-cluster-7003 -p 7003 INFO REPLICATION
redis-cli -h redis-cluster-7004 -p 7004 INFO REPLICATION
redis-cli -h redis-cluster-7005 -p 7005 INFO REPLICATION
echo 'everything should be good to go! if you see connection errors, please raise a ticket'
"
networks:
- redis-net
networks:
redis-net:
driver: bridge