Skip to content

Instantly share code, notes, and snippets.

@luizkowalski
Created June 16, 2024 10:14
Show Gist options
  • Save luizkowalski/077428a85045e7335039d6d7f4eda3b6 to your computer and use it in GitHub Desktop.
Save luizkowalski/077428a85045e7335039d6d7f4eda3b6 to your computer and use it in GitHub Desktop.
Grafana and Prometheus on Kamal
grafana:
image: grafana/grafana-enterprise:10.4.4-ubuntu
host: web
port: "3030:3000"
env:
clear:
GF_SERVER_ROOT_URL: your_url
GF_INSTALL_PLUGINS: grafana-clock-panel,redis-datasource,yesoreyeram-infinity-datasource
labels:
traefik.http.routers.grafana.rule: Host(`grafana.sumiu.link`) || (Host(`grafana-api.sumiu.link`) && PathPrefix(`/api`))
traefik.http.routers.grafana.service: sumiu-grafana@docker
# traefik.http.routers.grafana.middlewares: rateLimit
# traefik.http.middlewares.rateLimit.ratelimit.average: 1000
# traefik.http.middlewares.rateLimit.ratelimit.period: 10s
# traefik.http.middlewares.rateLimit.ratelimit.burst: 100
traefik.http.routers.grafana.tls: true
directories:
- data/grafana:/var/lib/grafana
options:
user: 1000:1000
prometheus:
image: prom/prometheus:v2.52.0
host: accessories
port: 9090
directories:
- data/prometheus:/prometheus
files:
- infrastructure/prometheus/config.yml:/etc/prometheus/prometheus.yml
options:
user: 1000:1000
cmd: --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus --storage.tsdb.retention.time=30d
global:
scrape_interval: 5s
evaluation_interval: 5s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: [10.0.0.3:9090]
- job_name: app
static_configs:
- targets: ["sumiu.link"]
basic_auth:
username: "user"
password: "pass"
- job_name: grafana
static_configs:
- targets: ["10.0.0.2:3030"]
- job_name: clickhouse
static_configs:
- targets: ["10.0.0.3:8122"]
- job_name: traefik
static_configs:
- targets: ["traefik.sumiu.link"]
- job_name: node_exporter
static_configs:
- targets:
- "10.0.0.3:9100"
- "10.0.0.2:9100"
- job_name: "postgres_exporter"
static_configs:
- targets:
- 10.0.0.3:9187
- job_name: "cadvisor"
static_configs:
- targets:
- 10.0.0.2:8080
- 10.0.0.3:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment