-
Notifications
You must be signed in to change notification settings - Fork 17
/
docker-compose.yml
41 lines (41 loc) · 1.21 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
version: "3.8"
services:
mongodb-primary:
image: bitnami/mongodb:5.0.4
restart: unless-stopped
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=example
- MONGODB_ADVERTISED_HOSTNAME=localhost
- MONGODB_REPLICA_SET_MODE=primary
- MONGODB_ROOT_PASSWORD=example
- MONGODB_REPLICA_SET_KEY=replicasetkey123
volumes:
- ./db-data:/data/db
expose:
- "27017"
ports:
- 27017:27017
mongodb-secondary:
image: bitnami/mongodb:5.0.4
restart: unless-stopped
depends_on:
- mongodb-primary
environment:
- MONGODB_ADVERTISED_HOSTNAME=mongodb-secondary
- MONGODB_REPLICA_SET_MODE=secondary
- MONGODB_INITIAL_PRIMARY_HOST=mongodb-primary
- MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017
- MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=example
- MONGODB_REPLICA_SET_KEY=replicasetkey123
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
depends_on:
- mongodb-secondary
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongodb-primary:27017/