Integrate grafana/prometheus with fixturenet-eth. (#156)

* Integrate grafana/prometheus with fixturenet-eth.

* Integrate grafana/prometheus with fixturenet-eth.

* Revert port change

* EOL

* EOL

* Simplify ipld-eth-server config.

Former-commit-id: c279bd49a4
This commit is contained in:
Thomas E Lackey 2023-01-25 11:50:08 -06:00 committed by GitHub
parent d0d29717e1
commit b5c7ad114c
11 changed files with 1222 additions and 53 deletions

View File

@ -0,0 +1,21 @@
version: "3.2"
services:
prometheus:
restart: always
image: prom/prometheus
depends_on:
fixturenet-eth-geth-1:
condition: service_healthy
volumes:
- ../config/fixturenet-eth-metrics/prometheus/etc:/etc/prometheus
ports:
- "9090"
grafana:
restart: always
image: grafana/grafana
volumes:
- ../config/fixturenet-eth-metrics/grafana/etc/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ../config/fixturenet-eth-metrics/grafana/etc/provisioning/datasources:/etc/grafana/provisioning/datasources
- ../config/fixturenet-eth-metrics/grafana/etc/dashboards:/etc/grafana/dashboards
ports:
- "3000"

View File

@ -20,16 +20,24 @@ services:
DATABASE_USER: "vdbm" DATABASE_USER: "vdbm"
DATABASE_PASSWORD: "password" DATABASE_PASSWORD: "password"
ETH_CHAIN_ID: 99 ETH_CHAIN_ID: 99
ETH_FORWARD_ETH_CALLS: $eth_forward_eth_calls ETH_FORWARD_ETH_CALLS: "false"
ETH_PROXY_ON_ERROR: $eth_proxy_on_error ETH_FORWARD_GET_STORAGE_AT: "false"
ETH_HTTP_PATH: $eth_http_path ETH_PROXY_ON_ERROR: "false"
METRICS: "true"
PROM_HTTP: "true"
PROM_HTTP_ADDR: "0.0.0.0"
PROM_HTTP_PORT: "8090"
LOGRUS_LEVEL: "debug"
CERC_REMOTE_DEBUG: "true"
volumes: volumes:
- type: bind - type: bind
source: ../config/ipld-eth-server/chain.json source: ../config/ipld-eth-server/chain.json
target: /tmp/chain.json target: /tmp/chain.json
ports: ports:
- "127.0.0.1:8081:8081" - "8081"
- "127.0.0.1:8082:8082" - "8082"
- "8090"
- "40000"
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "localhost", "8081"] test: ["CMD", "nc", "-v", "localhost", "8081"]
interval: 20s interval: 20s

View File

@ -29,9 +29,17 @@ services:
condition: service_healthy condition: service_healthy
keycloak-nginx: keycloak-nginx:
image: nginx:1.23-alpine image: nginx:1.23-alpine
restart: always
volumes: volumes:
- ../config/keycloak/nginx:/etc/nginx/conf.d - ../config/keycloak/nginx:/etc/nginx/conf.d
ports: ports:
- 80 - 80
depends_on: depends_on:
- keycloak - keycloak
keycloak-nginx-prometheus-exporter:
image: nginx/nginx-prometheus-exporter
restart: always
environment:
- SCRAPE_URI=http://keycloak-nginx:80/stub_status
depends_on:
- keycloak-nginx

View File

@ -1,21 +0,0 @@
version: "3.2"
services:
# If you want prometheus to work, you must update the following file in the ops repo locally.
# localhost:6060 --> go-ethereum:6060
prometheus:
restart: always
user: "987"
image: prom/prometheus
volumes:
- ${cerc_ops}/metrics/etc:/etc/prometheus
- ./prometheus-data:/prometheus
ports:
- "127.0.0.1:9090:9090"
grafana:
restart: always
user: "472"
image: grafana/grafana
volumes:
- ./grafana-data:/var/lib/grafana
ports:
- "127.0.0.1:3000:3000"

View File

@ -0,0 +1,9 @@
apiVersion: 1
providers:
- name: dashboards
type: file
updateIntervalSeconds: 10
options:
path: /etc/grafana/dashboards
foldersFromFilesStructure: true

View File

@ -0,0 +1,19 @@
apiVersion: 1
datasources:
- id: 1
uid: jZUuGao4k
orgId: 1
name: Prometheus
type: prometheus
typeName: Prometheus
typeLogoUrl: public/app/plugins/datasource/prometheus/img/prometheus_logo.svg
access: proxy
url: http://prometheus:9090
user: ""
database: ""
basicAuth: false
isDefault: true
jsonData:
httpMethod: POST
readOnly: false

View File

@ -0,0 +1,34 @@
global:
scrape_interval: 5s
evaluation_interval: 15s
scrape_configs:
# ipld-eth-server
- job_name: 'ipld-eth-server'
metrics_path: /metrics
scrape_interval: 5s
static_configs:
- targets: ['ipld-eth-server:8090']
# geth
- job_name: 'geth'
metrics_path: /debug/metrics/prometheus
scheme: http
static_configs:
- targets: ['fixturenet-eth-geth-1:6060']
# nginx
- job_name: 'nginx'
scrape_interval: 5s
metrics_path: /metrics
scheme: http
static_configs:
- targets: ['keycloak-nginx-prometheus-exporter:9113']
# keycloak
- job_name: 'keycloak'
scrape_interval: 5s
metrics_path: /auth/realms/cerc/metrics
scheme: http
static_configs:
- targets: ['keycloak:8080']

View File

@ -21,19 +21,19 @@ server {
} }
## ipld-eth-server ## ipld-eth-server
location ~ ^/ipld/eth/([^/]*)$ { # location ~ ^/ipld/eth/([^/]*)$ {
set $apiKey $1; # set $apiKey $1;
if ($apiKey = '') { # if ($apiKey = '') {
set $apiKey $http_X_API_KEY; # set $apiKey $http_X_API_KEY;
} # }
auth_request /auth; # auth_request /auth;
auth_request_set $user_id $sent_http_x_user_id; # auth_request_set $user_id $sent_http_x_user_id;
proxy_buffering off; # proxy_buffering off;
rewrite /.*$ / break; # rewrite /.*$ / break;
proxy_pass http://ipld-eth-server:8081; # proxy_pass http://ipld-eth-server:8081;
proxy_set_header X-Original-Remote-Addr $remote_addr; # proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-User-Id $user_id; # proxy_set_header X-User-Id $user_id;
} # }
# #
# location ~ ^/ipld/gql/([^/]*)$ { # location ~ ^/ipld/gql/([^/]*)$ {
# set $apiKey $1; # set $apiKey $1;
@ -45,14 +45,14 @@ server {
# rewrite /.*$ / break; # rewrite /.*$ / break;
# proxy_pass http://ipld-eth-server:8082; # proxy_pass http://ipld-eth-server:8082;
# } # }
#
### lighthouse ## lighthouse
# location /beacon/ { location /beacon/ {
# set $apiKey $http_X_API_KEY; set $apiKey $http_X_API_KEY;
# auth_request /auth; auth_request /auth;
# proxy_buffering off; proxy_buffering off;
# proxy_pass http://fixturenet-eth-lighthouse-1:8001/; proxy_pass http://fixturenet-eth-lighthouse-1:8001/;
# } }
location = /auth { location = /auth {
internal; internal;
@ -66,7 +66,7 @@ server {
proxy_set_header X-Original-Host $host; proxy_set_header X-Original-Host $host;
} }
# location = /basic_status { location = /stub_status {
# stub_status; stub_status;
# } }
} }

View File

@ -8,12 +8,14 @@ LIGHTHOUSE_BASE_URL=${LIGHTHOUSE_BASE_URL}
GETH_BASE_URL=${GETH_BASE_URL} GETH_BASE_URL=${GETH_BASE_URL}
if [ -z "$LIGHTHOUSE_BASE_URL" ]; then if [ -z "$LIGHTHOUSE_BASE_URL" ]; then
LIGHTHOUSE_PORT=`docker ps -f "name=fixturenet-eth-lighthouse-1-1" --format "{{.Ports}}" | head -1 | cut -d':' -f2 | cut -d'-' -f1` LIGHTHOUSE_CONTAINER=`docker ps -q -f "name=fixturenet-eth-lighthouse-1-1"`
LIGHTHOUSE_PORT=`docker port $LIGHTHOUSE_CONTAINER 8001 | cut -d':' -f2`
LIGHTHOUSE_BASE_URL="http://localhost:${LIGHTHOUSE_PORT}" LIGHTHOUSE_BASE_URL="http://localhost:${LIGHTHOUSE_PORT}"
fi fi
if [ -z "$GETH_BASE_URL" ]; then if [ -z "$GETH_BASE_URL" ]; then
GETH_PORT=`docker ps -f "name=fixturenet-eth-geth-1-1" --format "{{.Ports}}" | head -1 | cut -d':' -f2 | cut -d'-' -f1` GETH_CONTAINER=`docker ps -q -f "name=fixturenet-eth-geth-1-1"`
GETH_PORT=`docker port $GETH_CONTAINER 8545 | cut -d':' -f2`
GETH_BASE_URL="http://localhost:${GETH_PORT}" GETH_BASE_URL="http://localhost:${GETH_PORT}"
fi fi

View File

@ -6,10 +6,10 @@ ipld-eth-beacon-db
ipld-eth-beacon-indexer ipld-eth-beacon-indexer
ipld-eth-server ipld-eth-server
lighthouse lighthouse
prometheus-grafana
laconicd laconicd
fixturenet-laconicd fixturenet-laconicd
fixturenet-eth fixturenet-eth
fixturenet-eth-metrics
watcher-mobymask watcher-mobymask
watcher-erc20 watcher-erc20
watcher-erc721 watcher-erc721