-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.monitoring.yml
More file actions
333 lines (321 loc) · 8.95 KB
/
docker-compose.monitoring.yml
File metadata and controls
333 lines (321 loc) · 8.95 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
version: '3.8'
services:
# PgBouncer - Connection pooling cho PostgreSQL
pgbouncer:
image: edoburu/pgbouncer:1.18.0
container_name: shopsifu_pgbouncer
restart: unless-stopped
ports:
- '6432:6432'
environment:
DB_HOST: postgres
DB_PORT: 5432
DB_USER: shopsifu
DB_PASSWORD: Shopsifu2025
DB_NAME: shopsifu
POOL_MODE: transaction
MAX_CLIENT_CONN: 1000
DEFAULT_POOL_SIZE: 20
RESERVE_POOL_SIZE: 5
RESERVE_POOL_TIMEOUT: 5
MAX_DB_CONNECTIONS: 100
MAX_USER_CONNECTIONS: 100
volumes:
- ./monitoring/config/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
- ./monitoring/config/userlist.txt:/etc/pgbouncer/userlist.txt:ro
networks:
- shopsifu-network
depends_on:
postgres:
condition: service_healthy
deploy:
resources:
limits:
cpus: '1.0'
memory: 2G
reservations:
cpus: '0.5'
memory: 1G
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -p 6432 -U shopsifu']
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
# Kibana - kết nối tới Elasticsearch
kibana:
image: docker.elastic.co/kibana/kibana:8.13.4
container_name: shopsifu_kibana
restart: unless-stopped
ports:
- '5601:5601'
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- XPACK_SECURITY_ENABLED=false
- SERVER_NAME=shopsifu-kibana
- SERVER_HOST=0.0.0.0
networks:
- shopsifu-network
depends_on:
elasticsearch:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
reservations:
cpus: '0.2'
memory: 512M
healthcheck:
test: ['CMD-SHELL', 'curl -fsS http://localhost:5601/api/status | grep -q kibana']
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# Prometheus
prometheus:
image: prom/prometheus:v2.48.0
container_name: shopsifu_prometheus
restart: unless-stopped
ports:
- '9090:9090'
volumes:
- ./monitoring/prometheus:/etc/prometheus:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-lifecycle'
- '--web.enable-admin-api'
- '--storage.tsdb.retention.time=30d'
networks:
- shopsifu-network
deploy:
resources:
limits:
cpus: '1.0'
memory: 2G
reservations:
cpus: '0.5'
memory: 1G
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:9090/-/healthy || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Grafana
grafana:
image: grafana/grafana:11.4.0
container_name: shopsifu_grafana
restart: unless-stopped
ports:
- '3001:3000'
env_file: .env.docker
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_SECURITY_COOKIE_HTTPONLY=${GRAFANA_SECURITY_COOKIE_HTTPONLY}
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_USERS_ALLOW_ORG_CREATE=false
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
- GF_FEATURE_TOGGLES_ENABLE=publicDashboards
- GF_ANALYTICS_REPORTING_ENABLED=false
- GF_ANALYTICS_CHECK_FOR_UPDATES=false
- GF_SECURITY_DISABLE_GRAVATAR=true
- GF_LOG_LEVEL=info
- GF_SERVER_ROOT_URL=http://localhost:3001
- GF_SERVER_SERVE_FROM_SUB_PATH=false
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
networks:
- shopsifu-network
depends_on:
- prometheus
deploy:
resources:
limits:
cpus: '2.0'
memory: 4G
reservations:
cpus: '1.0'
memory: 2G
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# PostgreSQL Exporter - kết nối tới PostgreSQL container
postgres_exporter:
image: prometheuscommunity/postgres-exporter:v0.16.0
container_name: shopsifu_postgres_exporter
restart: unless-stopped
ports:
- '9187:9187'
environment:
DATA_SOURCE_NAME: 'postgresql://shopsifu:Shopsifu2025@postgres:5432/shopsifu?sslmode=disable'
PG_EXPORTER_LOG_LEVEL: 'info'
PG_EXPORTER_WEB_LISTEN_ADDRESS: ':9187'
networks:
- shopsifu-network
depends_on:
postgres:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.2'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:9187/metrics || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Redis Exporter - kết nối tới Redis container
redis_exporter:
image: oliver006/redis_exporter:v1.60.0
container_name: shopsifu_redis_exporter
restart: unless-stopped
ports:
- '9121:9121'
environment:
REDIS_ADDR: 'redis:6379'
REDIS_PASSWORD: 'Shopsifu2025'
REDIS_NAMESPACE: 'redis'
REDIS_EXPORTER_LOG_FORMAT: 'txt'
networks:
- shopsifu-network
# Note: redis service is defined in docker-compose.core.yml
# Start core services first: docker-compose -f docker-compose.core.yml up -d
deploy:
resources:
limits:
cpus: '0.2'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:9121/metrics || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Elasticsearch Exporter - kết nối tới Elasticsearch container
elasticsearch_exporter:
image: prometheuscommunity/elasticsearch-exporter:v1.6.0
container_name: shopsifu_elasticsearch_exporter
restart: unless-stopped
ports:
- '9114:9114'
environment:
ES_URI: 'http://elasticsearch:9200'
ES_TIMEOUT: '30s'
ES_ALL: 'true'
ES_INDICES: 'true'
ES_INDICES_SETTINGS: 'true'
ES_SHARDS: 'true'
networks:
- shopsifu-network
depends_on:
elasticsearch:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.2'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:9114/metrics || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Node Exporter
node_exporter:
image: prom/node-exporter:v1.8.0
container_name: shopsifu_node_exporter
restart: unless-stopped
ports:
- '9100:9100'
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
- '--collector.filesystem.fs-types-exclude=^(sys|proc|auto)fs$$'
networks:
- shopsifu-network
deploy:
resources:
limits:
cpus: '0.2'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:9100/metrics || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Alertmanager
alertmanager:
image: prom/alertmanager:v0.26.0
container_name: shopsifu_alertmanager
restart: unless-stopped
ports:
- '9093:9093'
volumes:
- ./monitoring/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
- alertmanager_data:/alertmanager
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
- '--web.listen-address=:9093'
networks:
- shopsifu-network
deploy:
resources:
limits:
cpus: '0.2'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
healthcheck:
test: ['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://localhost:9093/-/healthy || exit 1']
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
prometheus_data:
driver: local
name: shopsifu_prometheus_data
grafana_data:
driver: local
name: shopsifu_grafana_data
alertmanager_data:
driver: local
name: shopsifu_alertmanager_data
networks:
shopsifu-network:
external: true
name: shopsifu-network