-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
99 lines (93 loc) · 2.27 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
version: "3.6"
services:
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
networks:
- replset
depends_on:
- mongodb-primary
- mongodb-secondary
- mongodb-arbiter
environment:
ME_CONFIG_MONGODB_SERVER: mongodb-primary
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: password
mongo-client:
image: mongoclient/mongoclient
restart: always
ports:
- 8080:3000
networks:
- replset
depends_on:
- mongodb-primary
- mongodb-secondary
- mongodb-arbiter
mongodb-primary:
image: mongo:4.2.1-bionic
container_name: mongodb-primary
hostname: mongodb-primary
command: >
mongod
--replSet rs0
--config /etc/mongod.conf
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
volumes:
- mongodb_data:/data/db # Enable persistence of db
- ./bootstrap:/bootstrap:ro # Initialization scripts
- ./etc/mongod.conf:/etc/mongod.conf:ro # Permission: 600
- ./etc/mongod-keyfile:/etc/mongod-keyfile:ro # Permission: 600
ports:
- 27017:27017
networks:
- replset
depends_on:
- mongodb-secondary
- mongodb-arbiter
restart: on-failure
mongodb-secondary:
image: mongo:4.2.1-bionic
container_name: mongodb-secondary
hostname: mongodb-secondary
command: >
mongod
--replSet rs0
--config /etc/mongod.conf
volumes:
- ./etc/mongod.conf:/etc/mongod.conf:ro # Permission: 600
- ./etc/mongod-keyfile:/etc/mongod-keyfile:ro # Permission: 600
ports:
- 27018:27017
networks:
- replset
depends_on:
- mongodb-arbiter
restart: on-failure
mongodb-arbiter:
image: mongo:4.2.1-bionic
container_name: mongodb-arbiter
hostname: mongodb-arbiter
command: >
mongod
--replSet rs0
--config /etc/mongod.conf
volumes:
- ./etc/mongod.conf:/etc/mongod.conf:ro # Permission: 600
- ./etc/mongod-keyfile:/etc/mongod-keyfile:ro # Permission: 600
ports:
- 27019:27017
networks:
- replset
restart: on-failure
networks:
replset:
driver: bridge
name: mongodb
volumes:
mongodb_data:
driver: local