Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions etc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ up to date.
To run Reth, Grafana or Prometheus with Docker Compose, refer to
the [docker docs](https://reth.rs/installation/docker#using-docker-compose).

#### For Reth (Ethereum L1)

```bash
docker compose -f etc/docker-compose.yml up -d
```

#### For OP-Reth (Optimism L2)

```bash
docker compose -f etc/op-docker-compose.yml up -d
```

Supported chains for op-reth: `op-mainnet`, `op-sepolia`, `base-mainnet`, `base-sepolia`.

### Grafana

#### Adding a new metric to Grafana
Expand Down
6 changes: 4 additions & 2 deletions etc/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ services:
- ./grafana/datasources:/etc/grafana/provisioning/datasources
- ./grafana/dashboards:/etc/grafana/provisioning_temp/dashboards
# 1. Copy dashboards from temp directory to prevent modifying original host files
# 2. Replace Prometheus datasource placeholders with the actual name
# 3. Run Grafana
# 2. Remove op-reth specific dashboards (use op-docker-compose.yml for op-reth)
# 3. Replace Prometheus datasource placeholders with the actual name
# 4. Run Grafana
entrypoint: >
sh -c "cp -r /etc/grafana/provisioning_temp/dashboards/. /etc/grafana/provisioning/dashboards &&
rm -f /etc/grafana/provisioning/dashboards/op-reth.json &&
find /etc/grafana/provisioning/dashboards/ -name '*.json' -exec sed -i 's/$${DS_PROMETHEUS}/Prometheus/g' {} \+ &&
find /etc/grafana/provisioning/dashboards/ -name '*.json' -exec sed -i 's/$${datasource}/Prometheus/g' {} \+ &&
find /etc/grafana/provisioning/dashboards/ -name '*.json' -exec sed -i 's/$${VAR_INSTANCE_LABEL}/instance/g' {} \+ &&
Expand Down
87 changes: 87 additions & 0 deletions etc/op-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: op-reth

services:
op-reth:
restart: unless-stopped
image: ghcr.io/op-rs/op-reth
ports:
- "9001:9001" # metrics
- "30303:30303" # eth/66 peering
- "8545:8545" # rpc
- "8551:8551" # engine
volumes:
- op_mainnet_data:/root/.local/share/reth/op-mainnet
- op_sepolia_data:/root/.local/share/reth/op-sepolia
- base_mainnet_data:/root/.local/share/reth/base-mainnet
- base_sepolia_data:/root/.local/share/reth/base-sepolia
- logs:/root/logs
- ./jwttoken:/root/jwt/:ro
# https://paradigmxyz.github.io/reth/run/troubleshooting.html#concurrent-database-access-error-using-containersdocker
pid: host
# For OP Sepolia, replace `--chain op-mainnet` with `--chain op-sepolia`
# For Base Mainnet, replace `--chain op-mainnet` with `--chain base-mainnet`
# For Base Sepolia, replace `--chain op-mainnet` with `--chain base-sepolia`
command: >
node
--chain op-mainnet
--metrics 0.0.0.0:9001
--log.file.directory /root/logs
--authrpc.addr 0.0.0.0
--authrpc.port 8551
--authrpc.jwtsecret /root/jwt/jwt.hex
--http --http.addr 0.0.0.0 --http.port 8545
--http.api "eth,net,web3,debug,trace"

prometheus:
restart: unless-stopped
image: prom/prometheus
depends_on:
- op-reth
ports:
- 9090:9090
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus

op-grafana:
restart: unless-stopped
image: grafana/grafana:latest
depends_on:
- op-reth
- prometheus
ports:
- 3000:3000
environment:
PROMETHEUS_URL: ${PROMETHEUS_URL:-http://prometheus:9090}
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/datasources:/etc/grafana/provisioning/datasources
- ./grafana/dashboards:/etc/grafana/provisioning_temp/dashboards
# 1. Copy dashboards from temp directory to prevent modifying original host files
# 2. Replace Prometheus datasource placeholders 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' {} \+ &&
find /etc/grafana/provisioning/dashboards/ -name '*.json' -exec sed -i 's/$${datasource}/Prometheus/g' {} \+ &&
find /etc/grafana/provisioning/dashboards/ -name '*.json' -exec sed -i 's/$${VAR_INSTANCE_LABEL}/instance/g' {} \+ &&
/run.sh"

volumes:
op_mainnet_data:
driver: local
op_sepolia_data:
driver: local
base_mainnet_data:
driver: local
base_sepolia_data:
driver: local
logs:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
2 changes: 1 addition & 1 deletion etc/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ scrape_configs:
metrics_path: "/"
scrape_interval: 5s
static_configs:
- targets: ['reth:9001', 'localhost:9001', 'host.docker.internal:9001']
- targets: ['reth:9001', 'op-reth:9001', 'localhost:9001', 'host.docker.internal:9001']
- job_name: ethereum-metrics-exporter
metrics_path: "/metrics"
scrape_interval: 5s
Expand Down
Loading