-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
99 lines (94 loc) · 2.17 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
services:
load-balancer:
image: nginx
container_name: nginx-load-balancer
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "80:80"
depends_on:
- edge-server-1
- edge-server-2
- edge-server-3
deploy:
resources:
limits:
cpus: "2" # Limit to 1 CPU core
memory: "1G" # Limit to 512 MB of memory
reservations:
cpus: "1" # Reserve 0.5 CPU core
memory: "1G" # Reserve 256 MB of memory
edge-server-1:
image: nginx
container_name: edge-server-1
volumes:
- ./edge-nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "3001:80"
networks:
- cdn-network
deploy:
resources:
limits:
cpus: "2"
memory: "2G"
reservations:
cpus: "1"
memory: "1G"
edge-server-2:
image: nginx
container_name: edge-server-2
volumes:
- ./edge-nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "3002:80"
networks:
- cdn-network
deploy:
resources:
limits:
cpus: "2"
memory: "2G"
reservations:
cpus: "1"
memory: "1G"
edge-server-3:
image: nginx
container_name: edge-server-3
volumes:
- ./edge-nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "3003:80"
networks:
- cdn-network
deploy:
resources:
limits:
cpus: "2"
memory: "2G"
reservations:
cpus: "1"
memory: "1G"
backend-server:
image: node:20 # Use Node.js image
container_name: backend-server
working_dir: /usr/src/app
volumes:
- .:/usr/src/app # Mount current directory to /usr/src/app inside the container
- ./public:/usr/src/app/public # Mount the 'public' directory for static files
command: ["npx", "nodemon", "index.js"] # Run with nodemon using npx
ports:
- "8080:8080"
networks:
- cdn-network
deploy:
resources:
limits:
cpus: "2"
memory: "2G"
reservations:
cpus: "1"
memory: "1G"
networks:
cdn-network:
driver: bridge