-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.monitoring.yml
More file actions
90 lines (81 loc) · 3.29 KB
/
docker-compose.monitoring.yml
File metadata and controls
90 lines (81 loc) · 3.29 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
version: "3.9"
# ════════════════════════════════════════════════════════════════════════════
# Monitoring Stack — Prometheus + Grafana + Exporters
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.monitoring.yml up -d
#
# Access:
# Prometheus : http://localhost:9090
# Grafana : http://localhost:3000 (admin / admin123)
# ════════════════════════════════════════════════════════════════════════════
networks:
app-network:
external: true # reuses network from docker-compose.yml
volumes:
prometheus-data:
grafana-data:
services:
# ── Prometheus ──────────────────────────────────────────────────────────────
prometheus:
image: prom/prometheus:latest
container_name: taskmanager-prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=15d'
- '--web.enable-lifecycle'
ports:
- "9090:9090"
networks:
- app-network
# ── Grafana ──────────────────────────────────────────────────────────────────
grafana:
image: grafana/grafana:latest
container_name: taskmanager-grafana
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin123
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- grafana-data:/var/lib/grafana
ports:
- "3000:3000"
depends_on:
- prometheus
networks:
- app-network
# ── Node Exporter (host CPU / RAM / Disk metrics) ────────────────────────────
node-exporter:
image: prom/node-exporter:latest
container_name: taskmanager-node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
ports:
- "9100:9100"
networks:
- app-network
# ── PostgreSQL Exporter ───────────────────────────────────────────────────────
postgres-exporter:
image: prometheuscommunity/postgres-exporter:latest
container_name: taskmanager-postgres-exporter
restart: unless-stopped
environment:
DATA_SOURCE_NAME: "postgresql://postgres:${DB_PASSWORD:-taskmanager123}@postgres:5432/taskmanager?sslmode=disable"
ports:
- "9187:9187"
depends_on:
- prometheus
networks:
- app-network