-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
130 lines (124 loc) · 3.19 KB
/
docker-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
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
version: '3.7'
services:
mongodb-primary:
build:
context: .
dockerfile: Dockerfile
container_name: mongodb-primary
hostname: mongodb-primary
ports:
- 27017:27017
environment:
TZ: Asia/Tokyo
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: toor
volumes:
- ./data/primary/db:/data/db
networks:
- mongo-test
command: --keyFile /etc/keyfile --replSet replset
healthcheck:
test: ['CMD', 'mongo', '-u', 'root', '-p', 'toor']
interval: 20s
timeout: 10s
start_period: 5s
retries: 5
mongodb-secondary1:
build:
context: .
dockerfile: Dockerfile
container_name: mongodb-secondary1
hostname: mongodb-secondary1
ports:
- 27018:27018
environment:
TZ: Asia/Tokyo
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: toor
volumes:
- ./data/secondary1/db:/data/db
command: --port 27018 --replSet replset --keyFile /etc/keyfile
networks:
- mongo-test
healthcheck:
test: ['CMD', 'mongo', '-u', 'root', '-p', 'toor', '--port', '27018']
interval: 20s
timeout: 10s
start_period: 5s
retries: 5
mongodb-secondary2:
build:
context: .
dockerfile: Dockerfile
container_name: mongodb-secondary2
hostname: mongodb-secondary2
ports:
- 27019:27019
environment:
TZ: Asia/Tokyo
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: toor
volumes:
- ./data/secondary2/db:/data/db
command: --port 27019 --keyFile /etc/keyfile --replSet replset
networks:
- mongo-test
healthcheck:
test: ['CMD', 'mongo', '-u', 'root', '-p', 'toor', '--port', '27019']
interval: 20s
timeout: 10s
start_period: 5s
retries: 5
mongodb-arbiter:
build:
context: .
dockerfile: Dockerfile
container_name: mongodb-arbiter
hostname: mongodb-arbiter
ports:
- 27020:27020
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: toor
command: --port 27020 --replSet replset --keyFile /etc/keyfile
networks:
- mongo-test
healthcheck:
test: ['CMD', 'mongo', '-u', 'root', '-p', 'toor', '--port', '27020']
interval: 20s
timeout: 10s
start_period: 5s
retries: 5
mongo-connector:
build: ./mongo-connector
container_name: mongo-connector
depends_on:
mongodb-primary:
condition: service_healthy
mongodb-secondary1:
condition: service_healthy
mongodb-secondary2:
condition: service_healthy
mongodb-arbiter:
condition: service_healthy
networks:
- mongo-test
mongo-express:
image: mongo-express:latest
container_name: mongo-express
ports:
- '8081:8081'
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: toor
ME_CONFIG_MONGODB_SERVER: mongodb-primary
ME_CONFIG_BASICAUTH_USERNAME: root
ME_CONFIG_BASICAUTH_PASSWORD: toor
ME_CONFIG_MONGODB_ENABLE_ADMIN: true
depends_on:
- mongo-connector
restart: always
networks:
- mongo-test
networks:
mongo-test: