124 lines
3.5 KiB
YAML
124 lines
3.5 KiB
YAML
services:
|
|
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:
|
|
- prometheus
|
|
restart: unless-stopped
|
|
networks:
|
|
- monitoring
|
|
|
|
loki:
|
|
image: grafana/loki:latest
|
|
container_name: loki
|
|
ports:
|
|
- "9020:3100"
|
|
command: -config.file=/etc/loki/local-config.yaml
|
|
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'
|
|
- "--web.enable-remote-write-receiver"
|
|
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
|
|
|
|
alloy:
|
|
image: grafana/alloy:latest
|
|
container_name: alloy
|
|
hostname: localhost # Set a proper hostname
|
|
volumes:
|
|
- ./config/config.alloy:/etc/alloy/config.alloy
|
|
- /proc:/host/proc:ro # CRITICAL - must be mounted at /host/proc
|
|
- /sys:/host/sys:ro # CRITICAL - must be mounted at /host/sys
|
|
- /:/rootfs:ro # CRITICAL - must be mounted at /rootfs
|
|
command:
|
|
- run
|
|
- --server.http.listen-addr=0.0.0.0:12345
|
|
- --storage.path=/var/lib/alloy/data
|
|
- /etc/alloy/config.alloy
|
|
ports:
|
|
- "12345:12345"
|
|
privileged: true # CRITICAL for accessing system metrics
|
|
pid: "host" # CRITICAL for accessing process metrics
|
|
environment:
|
|
- HOSTNAME=localhost # Explicitly set the hostname for metrics
|
|
networks:
|
|
- monitoring
|
|
|
|
|
|
volumes:
|
|
grafana-data:
|
|
prometheus-data:
|
|
alloy-data:
|
|
driver: local
|
|
loki-data:
|
|
driver: local
|
|
alertmanager-data:
|
|
driver: local
|
|
|
|
networks:
|
|
monitoring:
|
|
driver: bridge
|