-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
135 lines (129 loc) · 2.89 KB
/
Copy pathdocker-compose.yml
File metadata and controls
135 lines (129 loc) · 2.89 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
services:
api:
build: .
container_name: demo_api
ports:
- "8000:8000"
environment:
- TZ=Europe/Istanbul
- DATABASE_URL=postgresql://app:app@db:5432/appdb
- REDIS_URL=redis://redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz').read()\""]
interval: 5s
timeout: 2s
retries: 10
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
command: >
uvicorn app.main:app
--host 0.0.0.0
--port 8000
--workers 4
--backlog 512
db:
image: postgres:16
container_name: demo_db
environment:
- POSTGRES_USER=app
- POSTGRES_PASSWORD=app
- POSTGRES_DB=appdb
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app -d appdb -h 127.0.0.1"]
interval: 5s
timeout: 3s
retries: 20
command:
- "postgres"
- "-c"
- "max_connections=500"
- "-c"
- "shared_buffers=512MB"
deploy:
resources:
limits:
cpus: "2.0"
memory: 2G
redis:
image: redis:7-alpine
container_name: demo_redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 2s
retries: 20
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
nginx:
image: nginx:1.27-alpine
container_name: demo_nginx
depends_on:
api:
condition: service_healthy
ports:
- "8080:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
prometheus:
image: prom/prometheus:v2.54.1
container_name: demo_prometheus
ports:
- "9090:9090"
volumes:
- ./observability/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
command:
- "--config.file=/etc/prometheus/prometheus.yml"
depends_on:
api:
condition: service_healthy
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
grafana:
image: grafana/grafana:11.2.2
container_name: demo_grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
depends_on:
prometheus:
condition: service_started
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
k6:
image: grafana/k6:0.54.0
container_name: demo_k6
depends_on:
nginx:
condition: service_started
volumes:
- ./loadtests/k6:/scripts:ro
entrypoint: ["sleep", "infinity"]