Skip to content

Commit 5118489

Browse files
Merge pull request #417 from Gauravpadam/20232610_docker_compose_for_replicaSets
Docker compose for handling Mongo replicaSets
2 parents 8b362d7 + 4c412ed commit 5118489

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

.dockerignore

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

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN npm ci
88

99
COPY . .
1010

11-
EXPOSE 3500
12-
CMD ["npm", "run", "start"]
11+
EXPOSE 4000
12+
CMD ["npm", "run", "serverstart"]
1313

1414

docker-compose.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3'
2+
services:
3+
primary:
4+
image: mongo
5+
container_name: mongodb-primary
6+
ports:
7+
- "27017:27017"
8+
environment:
9+
MONGO_INITDB_REPLICA_SET: ReplicaSet
10+
11+
secondary1:
12+
image: mongo
13+
container_name: mongodb-secondary1
14+
ports:
15+
- "27018:27017"
16+
environment:
17+
MONGO_INITDB_REPLICA_SET: ReplicaSet
18+
19+
secondary2:
20+
image: mongo
21+
container_name: mongodb-secondary2
22+
ports:
23+
- "27019:27017"
24+
environment:
25+
MONGO_INITDB_REPLICA_SET: ReplicaSet
26+
27+
arbiter:
28+
image: mongo
29+
container_name: mongodb-arbiter
30+
ports:
31+
- "27020:27017"
32+
environment:
33+
MONGO_INITDB_REPLICA_SET: ReplicaSet
34+
MONGO_INITDB_ARBITER: "yes"

0 commit comments

Comments
 (0)