forked from percona/mongodb_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
218 lines (201 loc) · 7.09 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
version: '3.8'
services:
mongo-1-1:
container_name: "mongo-1-1"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S1_PRIMARY_PORT:-17001}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16
links:
- mongo-1-2:mongo-1-2
- mongo-1-3:mongo-1-3
mongo-1-2:
container_name: "mongo-1-2"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S1_SECONDARY1_PORT:-17002}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16
mongo-1-3:
container_name: "mongo-1-3"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S1_SECONDARY2_PORT:-17003}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16
mongo-1-arbiter:
container_name: "mongo-1-arbiter"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S1_ARBITER:-17011}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16
mongo-rs1-setup:
container_name: "mongo-rs1-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
depends_on:
- "mongo-1-1"
- "mongo-1-2"
- "mongo-1-3"
- "mongo-1-arbiter"
links:
- mongo-1-1:mongo-1-1
- mongo-1-2:mongo-1-2
- mongo-1-3:mongo-1-3
- mongo-1-arbiter: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
entrypoint: [ "/scripts/setup.sh" ]
mongo-2-2:
container_name: "mongo-2-2"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S2_PRIMARY_PORT:-17004}:27017"
command: mongod --replSet rs2 --shardsvr --port 27017 --oplogSize 16
mongo-2-3:
container_name: "mongo-2-3"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S2_SECONDARY1_PORT:-17005}:27017"
command: mongod --replSet rs2 --shardsvr --port 27017 --oplogSize 16
mongo-2-1:
container_name: "mongo-2-1"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S2_SECONDARY2_PORT:-17006}:27017"
command: mongod --replSet rs2 --shardsvr --port 27017 --oplogSize 16
links:
- mongo-2-2:mongo-2-2
- mongo-2-3:mongo-2-3
mongo-2-arbiter:
container_name: "mongo-2-arbiter"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_S2_ARBITER:-17012}:27017"
command: mongod --replSet rs1 --shardsvr --port 27017 --oplogSize 16
mongo-rs2-setup:
container_name: "mongo-rs2-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
depends_on:
- "mongo-2-1"
- "mongo-2-2"
- "mongo-2-3"
- "mongo-2-arbiter"
links:
- mongo-2-1:mongo-2-1
- mongo-2-2:mongo-2-2
- mongo-2-3:mongo-2-3
volumes:
- ./docker/scripts:/scripts
environment:
- MONGO1=mongo-2-1
- MONGO2=mongo-2-2
- MONGO3=mongo-2-3
- ARBITER=mongo-2-arbiter
- RS=rs2
entrypoint: [ "/scripts/setup.sh" ]
# Config servers
mongo-cnf-2:
container_name: "mongo-cnf-2"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_CONFIGSVR1_PORT:-17007}:27017"
command: mongod --dbpath /data/db --replSet cnf-serv --configsvr --port 27017 --oplogSize 16
mongo-cnf-3:
container_name: "mongo-cnf-3"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_CONFIGSVR2_PORT:-17008}:27017"
command: mongod --dbpath /data/db --replSet cnf-serv --configsvr --port 27017 --oplogSize 16
mongo-cnf-1:
container_name: "mongo-cnf-1"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_CONFIGSVR3_PORT:-17009}:27017"
command: mongod --dbpath /data/db --replSet cnf-serv --configsvr --port 27017 --oplogSize 16
links:
- mongo-cnf-2:mongo-cnf-2
- mongo-cnf-3:mongo-cnf-3
mongo-cnf-setup:
container_name: "mongo-cnf-setup"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
depends_on:
- "mongo-cnf-1"
- "mongo-cnf-2"
- "mongo-cnf-3"
links:
- mongo-cnf-1:mongo-cnf-1
- mongo-cnf-2:mongo-cnf-2
- mongo-cnf-3: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
entrypoint: [ "/scripts/setup.sh","cnf_servers" ]
mongos:
container_name: "mongos"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_MONGOS_PORT:-17000}:27017"
depends_on:
- "mongo-rs1-setup"
- "mongo-rs2-setup"
- "mongo-cnf-setup"
external_links:
- mongo-cnf-1:mongo-cnf-1
- mongo-cnf-2:mongo-cnf-2
- mongo-cnf-3:mongo-cnf-3
- mongo-1-1:mongo-1-1
- mongo-1-2:mongo-1-2
- mongo-1-3:mongo-1-3
- mongo-2-1:mongo-2-1
- mongo-2-2:mongo-2-2
- mongo-2-3:mongo-2-3
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.2}
depends_on:
- "mongos"
links:
- mongos:mongos
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
entrypoint: [ "/scripts/init-shard.sh" ]
restart: on-failure:20
standalone:
container_name: "standalone"
image: ${TEST_MONGODB_IMAGE:-mongo:4.2}
ports:
- "${TEST_MONGODB_STANDALONE_PORT:-27017}:27017"
command: mongod --port 27017 --oplogSize 16
standalone-encrypted:
container_name: "standalone-encrypted"
image: percona/percona-server-mongodb:5.0.13-11
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