@@ -178,3 +178,60 @@ As second argument, the timeout for long-running tasks can be given, if no timeo
178
178
On first use, you have to call this function, or set the indexes manually on the queue collection.
179
179
There will be created two indexes, one on ` topic ` and ` state ` , the other one is a TTL-index, which removes completed
180
180
tasks after one hour.
181
+
182
+ ## mongodb docker-compose
183
+
184
+ This is a config sample for bringing up a MongoDB-replicaset for testing, you have to use fixed ip-addresses for your containers,
185
+ otherwise you will get connection problems, because they are sent back to the client, when connecting.
186
+
187
+ ``` yaml
188
+ services :
189
+ mongo1 :
190
+ hostname : mongo1
191
+ image : mongo:8
192
+ ports :
193
+ - 27027:27017
194
+ restart : always
195
+ volumes :
196
+ - /data/mongodb-rs1:/data/db
197
+ command : mongod --replSet rs0
198
+ networks :
199
+ customnetwork :
200
+ ipv4_address : 172.20.0.3
201
+ mongo2 :
202
+ hostname : mongo2
203
+ image : mongo:8
204
+ ports :
205
+ - 27028:27017
206
+ restart : always
207
+ volumes :
208
+ - /data/mongodb-rs2:/data/db
209
+ command : mongod --replSet rs0
210
+ networks :
211
+ customnetwork :
212
+ ipv4_address : 172.20.0.4
213
+ mongo3 :
214
+ hostname : mongo3
215
+ image : mongo:8
216
+ ports :
217
+ - 27029:27017
218
+ restart : always
219
+ volumes :
220
+ - /data/mongodb-rs3:/data/db
221
+ command : mongod --replSet rs0
222
+ networks :
223
+ customnetwork :
224
+ ipv4_address : 172.20.0.5
225
+
226
+ networks :
227
+ customnetwork :
228
+ ipam :
229
+ config :
230
+ - subnet : 172.20.0.0/16
231
+ ` ` `
232
+
233
+ After bringing up the containers the first time, you have to initialize the replicaset:
234
+ ` ` ` shell
235
+ docker compose exec mongo1 mongosh
236
+ > rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "172.20.0.3:27017" }, { _id: 1, host: "172.20.0.4:27017" }, { _id: 2, host: "172.20.0.5:27017" }] })
237
+ ```
0 commit comments