-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcompose.yaml
84 lines (78 loc) · 1.79 KB
/
compose.yaml
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
version: "3.1"
services:
###########
## MONGO ##
###########
mongo-1:
image: mongo:latest
container_name: "mongo-1"
restart: always
expose:
- 27017
healthcheck:
test: mongo --eval "db.adminCommand('ping')"
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
- mongo-db-storage-1:/data/db
entrypoint: [ "/usr/bin/mongod", "--replSet", "rsmongo", "--bind_ip_all"]
networks:
- mongo-cluster
mongo-2:
image: mongo:latest
container_name: "mongo-2"
restart: always
expose:
- 27017
healthcheck:
test: mongo --eval "db.adminCommand('ping')"
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
- mongo-db-storage-2:/data/db
entrypoint: [ "/usr/bin/mongod", "--replSet", "rsmongo", "--bind_ip_all"]
networks:
- mongo-cluster
mongo-3:
image: mongo:latest
container_name: "mongo-3"
restart: always
expose:
- 27017
healthcheck:
test: mongo --eval "db.adminCommand('ping')"
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
- mongo-db-storage-3:/data/db
entrypoint: [ "/usr/bin/mongod", "--replSet", "rsmongo", "--bind_ip_all"]
networks:
- mongo-cluster
#################
## SETUP MONGO ##
#################
# Init mongo replica set using init script
mongo-setup:
image: mongo:latest
restart: "no"
depends_on:
- mongo-1
- mongo-2
- mongo-3
volumes:
- ./setup/setup-replica.js:/setup-replica.js
networks:
- mongo-cluster
entrypoint: mongo --host mongo-1:27017 /setup-replica.js
volumes:
mongo-db-storage-1:
mongo-db-storage-2:
mongo-db-storage-3:
networks:
mongo-cluster: