mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-07 23:04:06 -05:00
Add dockerized metrics local setup (#5173)
* Add dockerized metrics local setup * Review PR
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -51,6 +51,7 @@ docs/reference/cli.md
|
||||
*.ssz
|
||||
.pyrmont
|
||||
.tmpdb
|
||||
docker/grafana_dev/dashboards
|
||||
# EIP-4844 (only commit .ssz file)
|
||||
packages/beacon-node/trusted_setup.json
|
||||
packages/beacon-node/trusted_setup.txt
|
||||
|
||||
@@ -58,8 +58,10 @@ docker-compose -f docker-compose.yml -f docker-compose.validator.yml up -d
|
||||
|
||||
###### Dockerized metrics + local beacon node:
|
||||
|
||||
Run a local beacon with `--metrics` enabled. Then start Prometheus + Grafana with all dashboards in `./dashboards` automatically loaded running:
|
||||
|
||||
```
|
||||
docker-compose -f docker/docker-compose.local.yml up -d
|
||||
./docker/docker-compose.local_dev.sh
|
||||
```
|
||||
|
||||
## First Time Contributor?
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
version: "3.4"
|
||||
|
||||
# Configuration to work with a local non-dockerized Lodestar node
|
||||
# For local testing and quick debugging
|
||||
#
|
||||
# HOW TO USE: Start a Lodestar node, then run
|
||||
#
|
||||
# docker-compose -f docker/docker-compose.local.yml up -d
|
||||
# TODO: How to use?
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
@@ -22,7 +17,9 @@ services:
|
||||
- "prometheus:/prometheus"
|
||||
|
||||
grafana:
|
||||
build: grafana
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/grafana
|
||||
restart: always
|
||||
network_mode: host
|
||||
volumes:
|
||||
|
||||
5
docker/docker-compose.local_dev.sh
Executable file
5
docker/docker-compose.local_dev.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp -r ./dashboards docker/grafana_dev/dashboards
|
||||
|
||||
docker-compose -f docker/docker-compose.local_dev.yml up --build
|
||||
39
docker/docker-compose.local_dev.yml
Normal file
39
docker/docker-compose.local_dev.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
version: "3.4"
|
||||
|
||||
# Configuration to work with a local non-dockerized Lodestar node
|
||||
# For local testing and quick debugging
|
||||
#
|
||||
# HOW TO USE: Start a Lodestar node, then run
|
||||
#
|
||||
# ./docker/docker-compose.local_dev.sh
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
build:
|
||||
context: prometheus
|
||||
environment:
|
||||
# Linux: http://localhost:8008
|
||||
# MacOSX: http://host.docker.internal:8008
|
||||
BEACON_URL: localhost:8008
|
||||
VC_URL: localhost:5064
|
||||
restart: always
|
||||
network_mode: host
|
||||
volumes:
|
||||
- "prometheus:/prometheus"
|
||||
|
||||
grafana:
|
||||
build: grafana_dev
|
||||
restart: always
|
||||
network_mode: host
|
||||
volumes:
|
||||
- "grafana:/var/lib/grafana"
|
||||
- "grafana-dashboards:/dashboards"
|
||||
environment:
|
||||
# Linux: http://localhost:9090
|
||||
# MacOSX: http://host.docker.internal:9090
|
||||
PROMETHEUS_URL: http://localhost:9090
|
||||
|
||||
volumes:
|
||||
prometheus:
|
||||
grafana:
|
||||
grafana-dashboards:
|
||||
24
docker/grafana_dev/Dockerfile
Normal file
24
docker/grafana_dev/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
|
||||
# Same version as our ansible deployments, to minimize the diff in the dashboard on export
|
||||
FROM grafana/grafana:8.5.16
|
||||
|
||||
# Datasource URL is configured with ENV variables
|
||||
COPY datasource.yml /etc/grafana/provisioning/datasources/datasource.yml
|
||||
# Note: Dashboard as linked via a bind volume
|
||||
COPY dashboard.yml /etc/grafana/provisioning/dashboards/dashboard.yml
|
||||
# copy over some reasonable default dashboards, user can mount a volume over top of it
|
||||
COPY dashboards /dashboards/
|
||||
|
||||
ENV GF_SECURITY_ADMIN_USER=admin
|
||||
ENV GF_SECURITY_ADMIN_PASSWORD=admin
|
||||
|
||||
# Modified datasource to work with a network_mode: host
|
||||
ENV PROMETHEUS_URL=http://prometheus:9090
|
||||
ENV DASHBOARDS_DIR=/dashboards
|
||||
|
||||
CMD [ \
|
||||
"--homepath=/usr/share/grafana", \
|
||||
"--packaging=docker", \
|
||||
"cfg:default.paths.data=/var/lib/grafana" \
|
||||
]
|
||||
10
docker/grafana_dev/dashboard.yml
Normal file
10
docker/grafana_dev/dashboard.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: lodestar_github
|
||||
type: file
|
||||
updateIntervalSeconds: 60
|
||||
allowUiUpdates: true
|
||||
options:
|
||||
path: $DASHBOARDS_DIR
|
||||
foldersFromFilesStructure: true
|
||||
9
docker/grafana_dev/datasource.yml
Normal file
9
docker/grafana_dev/datasource.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: $PROMETHEUS_URL
|
||||
uid: prometheus
|
||||
isDefault: true
|
||||
@@ -1,6 +1,6 @@
|
||||
global:
|
||||
scrape_interval: 20s
|
||||
scrape_timeout: 20s
|
||||
scrape_interval: 5s
|
||||
scrape_timeout: 5s
|
||||
|
||||
# Tags (values starting with #) have to be replaced in the Dockerfile with sed
|
||||
# Modified datasource to work with a network_mode: host
|
||||
|
||||
Reference in New Issue
Block a user