mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(monitoring): docker compose configuration for Grafana & Prometheus (#1391)
This commit is contained in:
@ -7,4 +7,18 @@ The files in this directory may undergo a lot of changes while reth is unstable,
|
|||||||
### Overview
|
### Overview
|
||||||
|
|
||||||
- [**Prometheus**](./prometheus/prometheus.yml): An example Prometheus configuration.
|
- [**Prometheus**](./prometheus/prometheus.yml): An example Prometheus configuration.
|
||||||
- [**Grafana**](./grafana/): Example Grafana dashboards.
|
- [**Grafana**](./grafana/): Example Grafana dashboards & data sources.
|
||||||
|
|
||||||
|
### Docker Compose
|
||||||
|
|
||||||
|
To run Grafana dashboard with example dashboard and pre-configured Prometheus data source pointing at
|
||||||
|
the locally running Reth instance with metrics exposed on `localhost:9000`:
|
||||||
|
```sh
|
||||||
|
docker compose -p reth -f ./etc/docker-monitoring.yml up
|
||||||
|
```
|
||||||
|
|
||||||
|
After that, Grafana will be exposed on `localhost:3000` and accessible via default credentials:
|
||||||
|
```
|
||||||
|
username: admin
|
||||||
|
password: admin
|
||||||
|
```
|
||||||
39
etc/docker-monitoring.yml
Normal file
39
etc/docker-monitoring.yml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
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:
|
||||||
7
etc/grafana/dashboards/dashboard.yml
Normal file
7
etc/grafana/dashboards/dashboard.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
providers:
|
||||||
|
- name: 'Folder'
|
||||||
|
allowUiUpdates: true
|
||||||
|
options:
|
||||||
|
path: /etc/grafana/provisioning/dashboards
|
||||||
8
etc/grafana/datasources/prometheus.yml
Normal file
8
etc/grafana/datasources/prometheus.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
datasources:
|
||||||
|
- name: Prometheus
|
||||||
|
type: prometheus
|
||||||
|
access: proxy
|
||||||
|
url: $PROMETHEUS_URL
|
||||||
|
editable: true
|
||||||
@ -3,5 +3,4 @@ scrape_configs:
|
|||||||
metrics_path: "/"
|
metrics_path: "/"
|
||||||
scrape_interval: 5s
|
scrape_interval: 5s
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['localhost:9000']
|
- targets: ['localhost:9000', 'host.docker.internal:9000']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user