-
Notifications
You must be signed in to change notification settings - Fork 426
/
docker-compose.yml
296 lines (274 loc) · 9.07 KB
/
docker-compose.yml
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
services:
mongo-1-1:
container_name: "mongo-1-1"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_S1_PRIMARY_PORT:-17001}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16 --bind_ip 0.0.0.0
networks:
- rs1
depends_on:
- "mongo-1-2"
- "mongo-1-3"
- "mongo-1-arbiter"
mongo-1-2:
container_name: "mongo-1-2"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_S1_SECONDARY1_PORT:-17002}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16 --bind_ip 0.0.0.0
networks:
- rs1
mongo-1-3:
container_name: "mongo-1-3"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_S1_SECONDARY2_PORT:-17003}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16 --bind_ip 0.0.0.0
networks:
- rs1
mongo-1-arbiter:
container_name: "mongo-1-arbiter"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_S1_ARBITER:-17011}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16
networks:
- rs1
mongo-rs1-setup:
container_name: "mongo-rs1-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
depends_on:
- "mongo-1-1"
- "mongo-1-2"
- "mongo-1-3"
- "mongo-1-arbiter"
volumes:
- ./docker/scripts:/scripts
environment:
- MONGO1=mongo-1-1
- MONGO2=mongo-1-2
- MONGO3=mongo-1-3
- ARBITER=mongo-1-arbiter
- RS=rs1
- VERSION=${TEST_MONGODB_IMAGE}
entrypoint: [ "/scripts/setup.sh" ]
networks:
- rs1
mongo-2-2:
container_name: "mongo-2-2"
build:
dockerfile: ./docker/mongodb-auth.dockerfile
environment:
- MONGO_INITDB_ROOT_USERNAME=${TEST_MONGODB_USERNAME:-admin}
- MONGO_INITDB_ROOT_PASSWORD=${TEST_MONGODB_PASSWORD:-admin}
ports:
- "${TEST_MONGODB_S2_PRIMARY_PORT:-17004}:27017"
command: mongod --replSet rs2 --port 27017 --oplogSize 16 --auth --keyFile=/opt/keyfile
networks:
- rs2
mongo-2-3:
container_name: "mongo-2-3"
build:
dockerfile: ./docker/mongodb-auth.dockerfile
ports:
- "${TEST_MONGODB_S2_SECONDARY1_PORT:-17005}:27017"
command: mongod --replSet rs2 --port 27017 --oplogSize 16 --auth --keyFile=/opt/keyfile
networks:
- rs2
mongo-2-1:
container_name: "mongo-2-1"
build:
dockerfile: ./docker/mongodb-auth.dockerfile
ports:
- "${TEST_MONGODB_S2_SECONDARY2_PORT:-17006}:27017"
command: mongod --replSet rs2 --port 27017 --oplogSize 16 --auth --keyFile=/opt/keyfile
networks:
- rs2
mongo-2-arbiter:
container_name: "mongo-2-arbiter"
build:
dockerfile: ./docker/mongodb-auth.dockerfile
ports:
- "${TEST_MONGODB_S2_ARBITER:-17012}:27017"
command: mongod --replSet rs2 --port 27017 --oplogSize 16 --auth --keyFile=/opt/keyfile
networks:
- rs2
pbm-mongo-2-1:
image: percona/percona-backup-mongodb:2.5.0-multi
container_name: "pbm-mongo-2-1"
restart: on-failure:5
depends_on:
- mongo-2-1
environment:
- PBM_MONGODB_URI=mongodb://admin:admin@mongo-2-1:27017
volumes:
- ./docker/pbm/config:/etc/config
- ./docker/scripts:/scripts
- pbm-backups:/opt/backups
networks:
- rs2
pbm-mongo-2-2:
image: percona/percona-backup-mongodb:2.5.0-multi
container_name: "pbm-mongo-2-2"
restart: on-failure:5
depends_on:
- mongo-2-2
environment:
- PBM_MONGODB_URI=mongodb://admin:admin@mongo-2-2:27017
volumes:
- ./docker/pbm/config:/etc/config
- ./docker/scripts:/scripts
- pbm-backups:/opt/backups
networks:
- rs2
pbm-mongo-2-3:
image: percona/percona-backup-mongodb:2.5.0-multi
container_name: "pbm-mongo-2-3"
restart: on-failure:5
depends_on:
- mongo-2-3
environment:
- PBM_MONGODB_URI=mongodb://admin:admin@mongo-2-3:27017
volumes:
- ./docker/pbm/config:/etc/config
- ./docker/scripts:/scripts
- pbm-backups:/opt/backups
networks:
- rs2
mongo-rs2-setup:
container_name: "mongo-rs2-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
depends_on:
- "mongo-2-1"
- "mongo-2-2"
- "mongo-2-3"
- "mongo-2-arbiter"
volumes:
- ./docker/scripts:/scripts
environment:
- MONGO1=mongo-2-2
- MONGO2=mongo-2-1
- MONGO3=mongo-2-3
- ARBITER=mongo-2-arbiter
- RS=rs2
- VERSION=${TEST_MONGODB_IMAGE}
- MONGO_INITDB_ROOT_USERNAME=${TEST_MONGODB_USERNAME:-admin}
- MONGO_INITDB_ROOT_PASSWORD=${TEST_MONGODB_PASSWORD:-admin}
entrypoint: [ "/scripts/setup.sh" ]
networks:
- rs2
# Config servers
mongo-cnf-2:
container_name: "mongo-cnf-2"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_CONFIGSVR2_PORT:-17008}:27017"
command: mongod --dbpath /data/db --replSet cnf-serv --configsvr --port 27017 --oplogSize 16
networks:
- cnf-serv
mongo-cnf-3:
container_name: "mongo-cnf-3"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_CONFIGSVR3_PORT:-17009}:27017"
command: mongod --dbpath /data/db --replSet cnf-serv --configsvr --port 27017 --oplogSize 16
networks:
- cnf-serv
mongo-cnf-1:
container_name: "mongo-cnf-1"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_CONFIGSVR1_PORT:-17007}:27017"
command: mongod --dbpath /data/db --replSet cnf-serv --configsvr --port 27017 --oplogSize 16
networks:
- cnf-serv
depends_on:
- mongo-cnf-2
- mongo-cnf-3
mongo-cnf-setup:
container_name: "mongo-cnf-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
depends_on:
- "mongo-cnf-1"
- "mongo-cnf-2"
- "mongo-cnf-3"
volumes:
- ./docker/scripts:/scripts
environment:
- MONGO1=mongo-cnf-1
- MONGO2=mongo-cnf-2
- MONGO3=mongo-cnf-3
- RS=cnf-serv
- PORT=27017
- VERSION=${TEST_MONGODB_IMAGE}
entrypoint: [ "/scripts/setup.sh","cnf_servers" ]
networks:
- cnf-serv
mongos:
container_name: "mongos"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_MONGOS_PORT:-17000}:27017"
networks:
- mongo-shard
- rs1
- rs2
- cnf-serv
depends_on:
- "mongo-rs1-setup"
- "mongo-rs2-setup"
- "mongo-cnf-setup"
command: mongos --configdb cnf-serv/mongo-cnf-1:27017,mongo-cnf-2:27017,mongo-cnf-3:27017 --port 27017 --bind_ip 0.0.0.0
mongo-shard-setup:
container_name: "mongo-shard-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
depends_on:
- "mongos"
networks:
- mongo-shard
- rs1
- rs2
- cnf-serv
volumes:
- ./docker/scripts:/scripts
environment:
- MONGOS=mongos
- MONGO11=mongo-1-1
- MONGO12=mongo-1-2
- MONGO13=mongo-1-3
- MONGO21=mongo-2-1
- MONGO22=mongo-2-2
- MONGO23=mongo-2-3
- RS1=rs1
- RS2=rs2
- PORT=27017
- PORT1=27017
- PORT2=27017
- PORT3=27017
- VERSION=${TEST_MONGODB_IMAGE}
entrypoint: [ "/scripts/init-shard.sh" ]
restart: on-failure:20
standalone:
container_name: "standalone"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_STANDALONE_PORT:-27017}:27017"
command: mongod --port 27017 --oplogSize 16
standalone-encrypted:
user: root
container_name: "standalone-encrypted"
image: ${TEST_MONGODB_IMAGE:-mongo:4.4}
ports:
- "${TEST_MONGODB_STANDALONE_ENCRYPTED_PORT:-27027}:27017"
volumes:
- ./docker/secret/mongodb_secrets.txt:/secret/mongodb_secrets.txt
- ./docker/scripts:/scripts
command: /scripts/run-mongodb-encrypted.sh
volumes:
pbm-backups:
networks:
rs1:
rs2:
cnf-serv:
mongo-shard: