Add observability stack configuration for Grafana, Prometheus, Loki, and cAdvisor
This commit is contained in:
153
observability/compose.yaml
Normal file
153
observability/compose.yaml
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
networks:
|
||||||
|
observability-network:
|
||||||
|
driver: overlay
|
||||||
|
attachable: false
|
||||||
|
internal: true
|
||||||
|
driver_opts:
|
||||||
|
encrypted: "true"
|
||||||
|
|
||||||
|
grafana-frontend-network:
|
||||||
|
driver: overlay
|
||||||
|
attachable: false
|
||||||
|
internal: true
|
||||||
|
driver_opts:
|
||||||
|
encrypted: "true"
|
||||||
|
|
||||||
|
proxy-docker-network:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
grafana-admin-user:
|
||||||
|
file: ./secrets/grafana-admin-user.txt
|
||||||
|
grafana-admin-password:
|
||||||
|
file: ./secrets/grafana-admin-password.txt
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
grafana-storage: {}
|
||||||
|
prometheus-storage: {}
|
||||||
|
loki-storage: {}
|
||||||
|
|
||||||
|
configs:
|
||||||
|
prometheus-config-v1:
|
||||||
|
file: ./prometheus/prometheus-compose.yaml
|
||||||
|
|
||||||
|
services:
|
||||||
|
grafana:
|
||||||
|
image: ghcr.io/obnitram/observability/grafana:v1.0
|
||||||
|
environment:
|
||||||
|
GF_SECURITY_ADMIN_USER__FILE: /run/secrets/grafana-admin-user
|
||||||
|
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana-admin-password
|
||||||
|
secrets:
|
||||||
|
- grafana-admin-user
|
||||||
|
- grafana-admin-password
|
||||||
|
volumes:
|
||||||
|
- grafana-storage:/var/lib/grafana
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.grafana.entrypoints=admin"
|
||||||
|
- "traefik.http.routers.grafana.rule=Host(`grafana.localhost`)"
|
||||||
|
|
||||||
|
- "traefik.http.routers.grafana.middlewares=compress-grafana"
|
||||||
|
- "traefik.http.middlewares.compress-grafana.compress=true"
|
||||||
|
- "traefik.http.middlewares.compress-grafana.compress.encodings=zstd, br, gzip"
|
||||||
|
|
||||||
|
- "traefik.http.routers.grafana.service=grafana"
|
||||||
|
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
|
||||||
|
networks:
|
||||||
|
- proxy-docker-network
|
||||||
|
- grafana-frontend-network
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
image: ghcr.io/obnitram/observability/prometheus:v0.2
|
||||||
|
volumes:
|
||||||
|
- prometheus-storage:/prometheus
|
||||||
|
configs:
|
||||||
|
- source: prometheus-config-v1
|
||||||
|
target: /etc/prometheus/prometheus.yaml
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == manager
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.prometheus.entrypoints=admin"
|
||||||
|
- "traefik.http.routers.prometheus.rule=Host(`prometheus.localhost`)"
|
||||||
|
|
||||||
|
- "traefik.http.routers.prometheus.middlewares=compress-prometheus"
|
||||||
|
- "traefik.http.middlewares.compress-prometheus.compress=true"
|
||||||
|
- "traefik.http.middlewares.compress-prometheus.compress.encodings=zstd, br, gzip"
|
||||||
|
|
||||||
|
- "traefik.http.routers.prometheus.service=prometheus"
|
||||||
|
- "traefik.http.services.prometheus.loadbalancer.server.port=9090"
|
||||||
|
networks:
|
||||||
|
- observability-network
|
||||||
|
- grafana-frontend-network
|
||||||
|
- proxy-docker-network
|
||||||
|
|
||||||
|
loki:
|
||||||
|
image: ghcr.io/obnitram/observability/loki:v0.1
|
||||||
|
volumes:
|
||||||
|
- loki-storage:/loki
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == manager
|
||||||
|
networks:
|
||||||
|
- observability-network
|
||||||
|
- grafana-frontend-network
|
||||||
|
|
||||||
|
cadvisor:
|
||||||
|
image: gcr.io/cadvisor/cadvisor:latest
|
||||||
|
volumes:
|
||||||
|
- /:/rootfs:ro
|
||||||
|
- /run:/run:ro
|
||||||
|
- /sys:/sys:ro
|
||||||
|
- /var/lib/docker/:/var/lib/docker:ro
|
||||||
|
- /dev/disk/:/dev/disk:ro
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
|
endpoint_mode: dnsrr
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
networks:
|
||||||
|
- observability-network
|
||||||
|
|
||||||
|
node_exporter:
|
||||||
|
image: quay.io/prometheus/node-exporter:latest
|
||||||
|
hostname: "{{.Node.Hostname}}"
|
||||||
|
command:
|
||||||
|
- "--path.rootfs=/host"
|
||||||
|
volumes:
|
||||||
|
- "/:/host:ro,rslave"
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
|
endpoint_mode: dnsrr
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
networks:
|
||||||
|
- observability-network
|
||||||
|
|
||||||
|
alloy:
|
||||||
|
image: ghcr.io/obnitram/observability/alloy:v0.1
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
|
endpoint_mode: dnsrr
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
networks:
|
||||||
|
- observability-network
|
||||||
26
observability/prometheus/prometheus-compose.yaml
Normal file
26
observability/prometheus/prometheus-compose.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Prometheus main configuration
|
||||||
|
|
||||||
|
global:
|
||||||
|
scrape_interval: 30s
|
||||||
|
evaluation_interval: 30s
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
# Scrape Prometheus itself
|
||||||
|
- job_name: "prometheus"
|
||||||
|
static_configs:
|
||||||
|
- targets: ["prometheus:9090"]
|
||||||
|
metrics_path: /metrics
|
||||||
|
|
||||||
|
# Scrape cAdvisor
|
||||||
|
- job_name: "cadvisor"
|
||||||
|
static_configs:
|
||||||
|
- targets: ["cadvisor:8080"]
|
||||||
|
|
||||||
|
# Scrape Node Exporter
|
||||||
|
- job_name: "node_exporter"
|
||||||
|
static_configs:
|
||||||
|
- targets: ["node_exporter:9100"]
|
||||||
|
|
||||||
|
- job_name: "traefik"
|
||||||
|
static_configs:
|
||||||
|
- targets: ["traefik:9090"]
|
||||||
@@ -29,7 +29,7 @@ volumes:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
grafana:
|
grafana:
|
||||||
image: ghcr.io/hyntaria/observability/grafana:v1.0
|
image: ghcr.io/obnitram/observability/grafana:v1.0
|
||||||
environment:
|
environment:
|
||||||
GF_SECURITY_ADMIN_USER__FILE: /run/secrets/grafana-admin-user
|
GF_SECURITY_ADMIN_USER__FILE: /run/secrets/grafana-admin-user
|
||||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana-admin-password
|
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana-admin-password
|
||||||
@@ -59,7 +59,7 @@ services:
|
|||||||
- grafana-frontend-network
|
- grafana-frontend-network
|
||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
image: ghcr.io/hyntaria/observability/prometheus:v0.2
|
image: ghcr.io/obnitram/observability/prometheus:v0.2
|
||||||
command:
|
command:
|
||||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||||
- "--storage.tsdb.path=/prometheus"
|
- "--storage.tsdb.path=/prometheus"
|
||||||
@@ -90,7 +90,7 @@ services:
|
|||||||
- proxy-swarm-network
|
- proxy-swarm-network
|
||||||
|
|
||||||
loki:
|
loki:
|
||||||
image: ghcr.io/hyntaria/observability/loki:v0.1
|
image: ghcr.io/obnitram/observability/loki:v0.1
|
||||||
volumes:
|
volumes:
|
||||||
- loki-storage:/loki
|
- loki-storage:/loki
|
||||||
deploy:
|
deploy:
|
||||||
@@ -137,7 +137,7 @@ services:
|
|||||||
- observability-network
|
- observability-network
|
||||||
|
|
||||||
alloy:
|
alloy:
|
||||||
image: ghcr.io/hyntaria/observability/alloy:v0.1
|
image: ghcr.io/obnitram/observability/alloy:v0.1
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
deploy:
|
deploy:
|
||||||
|
|||||||
Reference in New Issue
Block a user