-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
37 lines (34 loc) · 1.6 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
# This file is responsible for maintaining services in docker for load balancing of different number of containers
version: "3" #Using version 3 of docker compose for services
services:
nodejs: # This is our service name
#replace username/repo:tag with your name and image details
image: sharmavivek62/backend:latest # our image path
deploy: # Deploy Image
placement: # Service will run on swarm manager
constraints: [node.role == manager]
replicas: 2 # Use 2 instances of image for load balancing
resources: # What resources does these instances uses
limits: # Limit resources to instances
cpus: "0.2" #20% of the cpu is used for one instance total 100% cpu usage for 5 instance
memory: 50M #50M of memory is used for one instance
restart_policy: #Restart instance on failure
condition: on-failure
ports: # node js Listen on port
- "3000:8080"
depends_on:
- mongo
mongo: # This is our other serivce name used for mongodb
image: mongo #service image path
deploy: # Deploy Image
replicas: 2 # Use 2 instances of image for load balancing
resources: # What resources does these instances uses
limits: # Limit resources to instances
cpus: "0.2" #20% of the cpu is used for one instance total 100% cpu usage for 5 instance
memory: 50M #50M of memory is used for one instance
restart_policy: #Restart instance on failure
condition: on-failure
ports: # mongodb port
- "27017:27017"
volumes: # mongodb data volume storage
- "./data:/data/db"