mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
version: '3'
|
|
|
|
services:
|
|
prometheus:
|
|
image: prom/prometheus
|
|
ports:
|
|
- 9090:9090
|
|
volumes:
|
|
- ./prometheus/:/etc/prometheus/
|
|
- prometheus_data:/prometheus
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
- --storage.tsdb.path=/prometheus
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway" # https://stackoverflow.com/a/43541732/5204678
|
|
|
|
grafana:
|
|
image: grafana/grafana
|
|
ports:
|
|
- 3000:3000
|
|
environment:
|
|
PROMETHEUS_URL: http://prometheus:9090
|
|
# 1. Copy dashboards from temp directory to prevent modifying original host files
|
|
# 2. Replace Prometheus datasource placeholder with the actual name
|
|
# 3. Run Grafana
|
|
entrypoint: >
|
|
sh -c "cp -r /etc/grafana/provisioning_temp/dashboards/. /etc/grafana/provisioning/dashboards &&
|
|
find /etc/grafana/provisioning/dashboards/ -name '*.json' -exec sed -i 's/$${DS_PROMETHEUS}/Prometheus/g' {} \+ &&
|
|
/run.sh"
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ./grafana/datasources:/etc/grafana/provisioning/datasources
|
|
- ./grafana/dashboards:/etc/grafana/provisioning_temp/dashboards
|
|
depends_on:
|
|
- prometheus
|
|
|
|
volumes:
|
|
prometheus_data:
|
|
grafana_data:
|