-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
85 lines (79 loc) · 1.98 KB
/
docker-compose.yml
File metadata and controls
85 lines (79 loc) · 1.98 KB
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
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: ubuntu
MYSQL_PASSWORD: password
MYSQL_DATABASE: mydb
# volumes:
# - ./my.cnf:/etc/mysql/my.cnf
# - mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "db", "-u", "root", "-password"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.3" # Limit to 30% of 1 vCPU
memory: 500M # Reduced from 500M
reservations:
memory: 100M # Reserve minimum memory
networks:
- gate-tier
nginx:
restart: always
build:
context: "./nginx"
ports:
- "443:443"
- "8080:8080"
# the pre-condition is backend is running, otherwise, nginx will throw error because of none backend server
depends_on:
backend:
condition: service_healthy
deploy:
resources:
limits:
cpus: "0.2" # Limit to 20% of 1 vCPU
memory: 50M # Already appropriate
reservations:
memory: 20M
networks:
- gate-tier
backend:
restart: always
command: >
bash -c "pnpm run prisma
&& pnpm run serve"
environment:
DATABASE_URL: mysql://root:password@db:3306/mydb
PORT: "8080"
build:
context: "./packages/backend"
deploy:
resources:
limits:
cpus: "0.3" # Limit to 30% of 1 vCPU
memory: 150M # Reduced from 200M
reservations:
memory: 50M
depends_on:
# the pre-condition is db is running, otherwise, nodejs server will throw error because of none db server
db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://backend:8080/api/schedule-event"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- gate-tier
# volumes:
# mysql-data:
networks:
gate-tier: