Skip to content

Commit 0628964

Browse files
committed
docker compose added for handling replicaSets
1 parent 8b362d7 commit 0628964

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
coverage
3-
logs
4-
.env
3+
logs

docker-compose.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: '3'
2+
services:
3+
backend:
4+
build: ./
5+
container_name: backend
6+
ports:
7+
- "4000:4000"
8+
env_file:
9+
- .env
10+
depends_on:
11+
- primary
12+
- secondary1
13+
- secondary2
14+
- arbiter
15+
16+
primary:
17+
image: mongo
18+
container_name: mongodb-primary
19+
ports:
20+
- "27017:27017"
21+
environment:
22+
MONGO_INITDB_REPLICA_SET: ReplicaSet
23+
24+
secondary1:
25+
image: mongo
26+
container_name: mongodb-secondary1
27+
ports:
28+
- "27018:27017"
29+
environment:
30+
MONGO_INITDB_REPLICA_SET: ReplicaSet
31+
32+
secondary2:
33+
image: mongo
34+
container_name: mongodb-secondary2
35+
ports:
36+
- "27019:27017"
37+
environment:
38+
MONGO_INITDB_REPLICA_SET: ReplicaSet
39+
40+
arbiter:
41+
image: mongo
42+
container_name: mongodb-arbiter
43+
ports:
44+
- "27020:27017"
45+
environment:
46+
MONGO_INITDB_REPLICA_SET: ReplicaSet
47+
MONGO_INITDB_ARBITER: "yes"

0 commit comments

Comments
 (0)