2023-11-12 21:34:20 -05:00
|
|
|
version: "3.8"
|
|
|
|
|
2023-10-28 17:50:44 -04:00
|
|
|
services:
|
2023-11-12 21:34:20 -05:00
|
|
|
mongo1:
|
|
|
|
image: mongo:latest
|
|
|
|
container_name: mongo1
|
|
|
|
command: ["--replSet", "my-replica-set", "--bind_ip_all", "--port", "30001"]
|
|
|
|
volumes:
|
|
|
|
- /etc/capstone/db1:/data/db
|
2023-10-28 17:50:44 -04:00
|
|
|
ports:
|
2023-11-12 21:34:20 -05:00
|
|
|
- 30001:30001
|
|
|
|
healthcheck:
|
|
|
|
test: test $$(echo "rs.initiate({_id:'my-replica-set',members:[{_id:0,host:\"mongo1:30001\"},{_id:1,host:\"mongo2:30002\"},{_id:2,host:\"mongo3:30003\"}]}).ok || rs.status().ok" | mongosh --port 30001 --quiet) -eq 1
|
|
|
|
interval: 10s
|
|
|
|
start_period: 30s
|
|
|
|
|
|
|
|
mongo2:
|
|
|
|
image: mongo:latest
|
|
|
|
container_name: mongo2
|
|
|
|
command: ["--replSet", "my-replica-set", "--bind_ip_all", "--port", "30002"]
|
2023-10-28 17:50:44 -04:00
|
|
|
volumes:
|
2023-11-12 21:34:20 -05:00
|
|
|
- /etc/capstone/db2:/data/db
|
|
|
|
ports:
|
|
|
|
- 30002:30002
|
2023-11-07 22:34:57 -05:00
|
|
|
|
2023-11-12 21:34:20 -05:00
|
|
|
mongo3:
|
|
|
|
image: mongo:latest
|
|
|
|
container_name: mongo3
|
|
|
|
command: ["--replSet", "my-replica-set", "--bind_ip_all", "--port", "30003"]
|
|
|
|
volumes:
|
|
|
|
- /etc/capstone/db3:/data/db
|
|
|
|
ports:
|
|
|
|
- 30003:30003
|