Skip to content

Commit

Permalink
Merge pull request #417 from Gauravpadam/20232610_docker_compose_for_…
Browse files Browse the repository at this point in the history
…replicaSets

Docker compose for handling Mongo replicaSets
  • Loading branch information
TejasNair9977 authored Oct 28, 2023
2 parents 8b362d7 + 4c412ed commit 5118489
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
coverage
logs
.env
.env
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN npm ci

COPY . .

EXPOSE 3500
CMD ["npm", "run", "start"]
EXPOSE 4000
CMD ["npm", "run", "serverstart"]


34 changes: 34 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3'
services:
primary:
image: mongo
container_name: mongodb-primary
ports:
- "27017:27017"
environment:
MONGO_INITDB_REPLICA_SET: ReplicaSet

secondary1:
image: mongo
container_name: mongodb-secondary1
ports:
- "27018:27017"
environment:
MONGO_INITDB_REPLICA_SET: ReplicaSet

secondary2:
image: mongo
container_name: mongodb-secondary2
ports:
- "27019:27017"
environment:
MONGO_INITDB_REPLICA_SET: ReplicaSet

arbiter:
image: mongo
container_name: mongodb-arbiter
ports:
- "27020:27017"
environment:
MONGO_INITDB_REPLICA_SET: ReplicaSet
MONGO_INITDB_ARBITER: "yes"

0 comments on commit 5118489

Please sign in to comment.