From 16afea988b66d4d5018b547925f22279262c1443 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 24 Jan 2023 16:49:26 -0600 Subject: [PATCH] Integrate grafana/prometheus with fixturenet-eth. --- .../docker-compose-fixturenet-eth-metrics.yml | 21 ++++++++ .../compose/docker-compose-fixturenet-eth.yml | 6 +-- .../docker-compose-ipld-eth-server.yml | 18 +++++-- app/data/compose/docker-compose-keycloak.yml | 8 ++++ .../docker-compose-prometheus-grafana.yml | 21 -------- .../config/keycloak/nginx/keycloak_proxy.conf | 48 +++++++++---------- .../scripts/status.sh | 6 ++- app/data/pod-list.txt | 2 +- 8 files changed, 74 insertions(+), 56 deletions(-) create mode 100644 app/data/compose/docker-compose-fixturenet-eth-metrics.yml delete mode 100644 app/data/compose/docker-compose-prometheus-grafana.yml diff --git a/app/data/compose/docker-compose-fixturenet-eth-metrics.yml b/app/data/compose/docker-compose-fixturenet-eth-metrics.yml new file mode 100644 index 00000000..4d3ccdf5 --- /dev/null +++ b/app/data/compose/docker-compose-fixturenet-eth-metrics.yml @@ -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" diff --git a/app/data/compose/docker-compose-fixturenet-eth.yml b/app/data/compose/docker-compose-fixturenet-eth.yml index 517b4832..a80e68cc 100644 --- a/app/data/compose/docker-compose-fixturenet-eth.yml +++ b/app/data/compose/docker-compose-fixturenet-eth.yml @@ -32,9 +32,9 @@ services: depends_on: - fixturenet-eth-bootnode-geth ports: - - "8545" - - "40000" - - "6060" + - "8545:8545" + - "40000:40000" + - "6060:6060" fixturenet-eth-geth-2: hostname: fixturenet-eth-geth-2 diff --git a/app/data/compose/docker-compose-ipld-eth-server.yml b/app/data/compose/docker-compose-ipld-eth-server.yml index ee9c8885..9578fe97 100644 --- a/app/data/compose/docker-compose-ipld-eth-server.yml +++ b/app/data/compose/docker-compose-ipld-eth-server.yml @@ -20,16 +20,24 @@ services: DATABASE_USER: "vdbm" DATABASE_PASSWORD: "password" ETH_CHAIN_ID: 99 - ETH_FORWARD_ETH_CALLS: $eth_forward_eth_calls - ETH_PROXY_ON_ERROR: $eth_proxy_on_error - ETH_HTTP_PATH: $eth_http_path + ETH_FORWARD_ETH_CALLS: "false" + ETH_FORWARD_GET_STORAGE_AT: "false" + ETH_PROXY_ON_ERROR: "true" + ETH_HTTP_PATH: "fixturenet-eth-geth-1:8545" + METRICS: "true" + PROM_HTTP: "true" + PROM_HTTP_ADDR: "0.0.0.0" + PROM_HTTP_PORT: "8090" + LOGRUS_LEVEL: "debug" + CERC_REMOTE_DEBUG: "true" volumes: - type: bind source: ../config/ipld-eth-server/chain.json target: /tmp/chain.json ports: - - "127.0.0.1:8081:8081" - - "127.0.0.1:8082:8082" + - "8081" + - "8082" + - "8090" healthcheck: test: ["CMD", "nc", "-v", "localhost", "8081"] interval: 20s diff --git a/app/data/compose/docker-compose-keycloak.yml b/app/data/compose/docker-compose-keycloak.yml index 294387cd..1586cdb7 100644 --- a/app/data/compose/docker-compose-keycloak.yml +++ b/app/data/compose/docker-compose-keycloak.yml @@ -29,9 +29,17 @@ services: condition: service_healthy keycloak-nginx: image: nginx:1.23-alpine + restart: always volumes: - ../config/keycloak/nginx:/etc/nginx/conf.d ports: - 80 depends_on: - 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 diff --git a/app/data/compose/docker-compose-prometheus-grafana.yml b/app/data/compose/docker-compose-prometheus-grafana.yml deleted file mode 100644 index 494748bc..00000000 --- a/app/data/compose/docker-compose-prometheus-grafana.yml +++ /dev/null @@ -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" diff --git a/app/data/config/keycloak/nginx/keycloak_proxy.conf b/app/data/config/keycloak/nginx/keycloak_proxy.conf index f06c6700..dd69680b 100644 --- a/app/data/config/keycloak/nginx/keycloak_proxy.conf +++ b/app/data/config/keycloak/nginx/keycloak_proxy.conf @@ -21,19 +21,19 @@ server { } ## ipld-eth-server - location ~ ^/ipld/eth/([^/]*)$ { - set $apiKey $1; - if ($apiKey = '') { - set $apiKey $http_X_API_KEY; - } - auth_request /auth; - auth_request_set $user_id $sent_http_x_user_id; - proxy_buffering off; - rewrite /.*$ / break; - proxy_pass http://ipld-eth-server:8081; - proxy_set_header X-Original-Remote-Addr $remote_addr; - proxy_set_header X-User-Id $user_id; - } +# location ~ ^/ipld/eth/([^/]*)$ { +# set $apiKey $1; +# if ($apiKey = '') { +# set $apiKey $http_X_API_KEY; +# } +# auth_request /auth; +# auth_request_set $user_id $sent_http_x_user_id; +# proxy_buffering off; +# rewrite /.*$ / break; +# proxy_pass http://ipld-eth-server:8081; +# proxy_set_header X-Original-Remote-Addr $remote_addr; +# proxy_set_header X-User-Id $user_id; +# } # # location ~ ^/ipld/gql/([^/]*)$ { # set $apiKey $1; @@ -45,14 +45,14 @@ server { # rewrite /.*$ / break; # proxy_pass http://ipld-eth-server:8082; # } -# -### lighthouse -# location /beacon/ { -# set $apiKey $http_X_API_KEY; -# auth_request /auth; -# proxy_buffering off; -# proxy_pass http://fixturenet-eth-lighthouse-1:8001/; -# } + +## lighthouse + location /beacon/ { + set $apiKey $http_X_API_KEY; + auth_request /auth; + proxy_buffering off; + proxy_pass http://fixturenet-eth-lighthouse-1:8001/; + } location = /auth { internal; @@ -66,7 +66,7 @@ server { proxy_set_header X-Original-Host $host; } -# location = /basic_status { -# stub_status; -# } + location = /stub_status { + stub_status; + } } diff --git a/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh index e02fc14b..a6999e3f 100755 --- a/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh +++ b/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh @@ -8,12 +8,14 @@ LIGHTHOUSE_BASE_URL=${LIGHTHOUSE_BASE_URL} GETH_BASE_URL=${GETH_BASE_URL} 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}" fi 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}" fi diff --git a/app/data/pod-list.txt b/app/data/pod-list.txt index 661a04e4..64dd0412 100644 --- a/app/data/pod-list.txt +++ b/app/data/pod-list.txt @@ -6,10 +6,10 @@ ipld-eth-beacon-db ipld-eth-beacon-indexer ipld-eth-server lighthouse -prometheus-grafana laconicd fixturenet-laconicd fixturenet-eth +fixturenet-eth-metrics watcher-mobymask watcher-erc20 watcher-erc721