157 lines
4.0 KiB
YAML
157 lines
4.0 KiB
YAML
services:
|
|
# Grafana for visualization
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
container_name: grafana
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
ports:
|
|
- "3003:3000"
|
|
environment:
|
|
- GF_SECURITY_ADMIN_USER=admin
|
|
- GF_SECURITY_ADMIN_PASSWORD=password # Change this in production
|
|
- GF_USERS_ALLOW_SIGN_UP=false
|
|
- GF_UNIFIED_ALERTING_ENABLED=true
|
|
- GF_ALERTING_ENABLED=false
|
|
- GF_UNIFIED_ALERTING_PROMETHEUS_ALERTS_ENABLED=true
|
|
volumes:
|
|
- grafana-data:/var/lib/grafana
|
|
- ./config/provisioning/dashboards:/etc/grafana/provisioning/dashboards
|
|
- ./config/provisioning/datasources:/etc/grafana/provisioning/datasources
|
|
- ./config/provisioning/alerting:/etc/grafana/provisioning/alerting
|
|
- ./config/dashboards:/var/lib/grafana/dashboards
|
|
depends_on:
|
|
- loki
|
|
- prometheus
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
|
|
loki:
|
|
image: grafana/loki:latest
|
|
container_name: loki
|
|
ports:
|
|
- "9020:3100"
|
|
volumes:
|
|
- ./config/loki.yml:/etc/loki/local-config.yaml
|
|
- loki-data:/var/loki
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
|
|
alloy:
|
|
image: grafana/alloy:latest
|
|
container_name: grafana-alloy
|
|
ports:
|
|
- "9030:12345"
|
|
volumes:
|
|
- ./config/alloy.conf:/etc/alloy/config.alloy
|
|
- alloy-data:/var/lib/alloy/data
|
|
command:
|
|
- run
|
|
- --server.http.listen-addr=0.0.0.0:12345
|
|
- --storage.path=/var/lib/alloy/data
|
|
- /etc/alloy/config.alloy
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
|
|
# AlertManager for handling alerts
|
|
alertmanager:
|
|
image: quay.io/prometheus/alertmanager:latest
|
|
container_name: alertmanager
|
|
ports:
|
|
- "9093:9093"
|
|
volumes:
|
|
- ./config/alertmanager.yml:/etc/alertmanager/config.yml
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
|
|
# Prometheus for metrics collection
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: prometheus
|
|
ports:
|
|
- "3004:9090"
|
|
volumes:
|
|
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
|
|
- ./config/prometheus-alerts.yml:/etc/prometheus/alerts.yml
|
|
- prometheus-data:/prometheus
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
- '--storage.tsdb.retention.time=15d'
|
|
- '--storage.tsdb.retention.size=10GB'
|
|
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
- '--web.console.templates=/etc/prometheus/consoles'
|
|
- '--web.enable-lifecycle'
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 2G
|
|
reservations:
|
|
memory: 1G
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
window: 120s
|
|
|
|
# cAdvisor for container metrics
|
|
cadvisor:
|
|
image: gcr.io/cadvisor/cadvisor:v0.49.1
|
|
container_name: cadvisor
|
|
volumes:
|
|
- /:/rootfs:ro
|
|
- /var/run:/var/run:ro
|
|
- /sys:/sys:ro
|
|
- /var/lib/docker/:/var/lib/docker:ro
|
|
- /dev/disk/:/dev/disk:ro
|
|
ports:
|
|
- "9050:8080"
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
privileged: true
|
|
devices:
|
|
- /dev/kmsg:/dev/kmsg
|
|
|
|
# Node Exporter for host metrics
|
|
node-exporter:
|
|
image: prom/node-exporter:latest
|
|
container_name: node-exporter
|
|
volumes:
|
|
- /proc:/host/proc:ro
|
|
- /sys:/host/sys:ro
|
|
- /:/rootfs:ro
|
|
command:
|
|
- '--path.procfs=/host/proc'
|
|
- '--path.sysfs=/host/sys'
|
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
|
ports:
|
|
- "9060:9100"
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
|
|
volumes:
|
|
grafana-data:
|
|
prometheus-data:
|
|
alloy-data:
|
|
driver: local
|
|
loki-data:
|
|
driver: local
|
|
alertmanager-data:
|
|
driver: local
|
|
|
|
networks:
|
|
monitoring:
|
|
driver: bridge
|