From 663eb57323266bf142d83d45a2f154064630f06a Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Tue, 21 Jul 2020 06:16:53 -0400 Subject: [PATCH] Add Prometheus and Grafana to Docker Compose (#221) * Add Prometheus and Grafana to Docker Compose * Expose relay's Prometheus metrics port * Use Docker network references intead of localhost When you have containers on the same network they don't communicate over localhost, they instead refer to their container names * Move dashboard components into deployment folder * Update folder structure for Grafana and Prometheus config files The new folder structure more closely matches the expected defaults by Grafana and Prometheus, which allows us to clean up the paths in our docker-compose file a bit. * Add documentation about Prometheus and Grafana * Refer to Prometheus server instead of node --- bridges/README.md | 14 +- .../ethereum/dashboard/grafana-dashboard.json | 410 ------------------ .../ethereum/dashboard/grafana-dashboard.yaml | 6 - .../dashboard/grafana-datasource.yaml | 9 - .../relays/ethereum/dashboard/prometheus.yml | 9 - 5 files changed, 7 insertions(+), 441 deletions(-) delete mode 100644 bridges/relays/ethereum/dashboard/grafana-dashboard.json delete mode 100644 bridges/relays/ethereum/dashboard/grafana-dashboard.yaml delete mode 100644 bridges/relays/ethereum/dashboard/grafana-datasource.yaml delete mode 100644 bridges/relays/ethereum/dashboard/prometheus.yml diff --git a/bridges/README.md b/bridges/README.md index 8d1d313b15..381ea37a7d 100644 --- a/bridges/README.md +++ b/bridges/README.md @@ -161,10 +161,10 @@ The folder structure of the bridge relay is as follows: To run the Bridge you need to be able to connect to the RPC interface of nodes on each side of the bridge (home & foreign chain). -You can build the relayer using [./Dockerfile](Dockerfile), which will use all the local source -files, +You can build the relayer using [./Dockerfile](Dockerfile), which will use all the local source files, or you can use an image that is designed to build from Github repo sources (`master` branch by default, configurable via `build-arg`): + ```bash docker build \ https://raw.githubusercontent.com/paritytech/parity-bridges-common/master/deployments/rialto/Bridge.Dockerfile \ @@ -173,7 +173,8 @@ docker run -it poa-relay ``` By default the relayer is configured to connect to OpenEthereum `--dev` chain node and Substrate -`bridge-node` running in a `--dev` mode. +`bridge-node` running in `--dev` mode. + To build the `bridge-node`: ```bash docker build \ @@ -184,13 +185,12 @@ docker run -it bridge-node ``` And to build `OpenEthereum` with bridge support: -``` +```bash docker build \ https://raw.githubusercontent.com/paritytech/parity-bridges-common/master/deployments/rialto/OpenEthereum.Dockerfile -t openethereum -docker run it openethereum +docker run -it openethereum ``` -See [./deployments/README.md](Deployments README) to learn more about how to run +See [Deployments README](./deployments/README.md) to learn more about how to run a more sophisticated test network using `docker-compose` setup. - diff --git a/bridges/relays/ethereum/dashboard/grafana-dashboard.json b/bridges/relays/ethereum/dashboard/grafana-dashboard.json deleted file mode 100644 index f15fa60ba2..0000000000 --- a/bridges/relays/ethereum/dashboard/grafana-dashboard.json +++ /dev/null @@ -1,410 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "gnetId": null, - "graphTooltip": 0, - "links": [], - "panels": [ - { - "datasource": "Prometheus", - "fieldConfig": { - "defaults": { - "custom": { - "align": null - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "interval": "5s", - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "mean" - ], - "fields": "", - "values": false - } - }, - "pluginVersion": "7.0.6", - "targets": [ - { - "expr": "best_block_numbers", - "format": "time_series", - "instant": true, - "interval": "", - "intervalFactor": 1, - "legendFormat": "Best known block on {{node}} node", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Best blocks relay knows of", - "type": "stat" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "Prometheus", - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 6, - "x": 12, - "y": 0 - }, - "hiddenSeries": false, - "id": 6, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "dataLinks": [] - }, - "percentage": false, - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "system_average_load", - "interval": "", - "legendFormat": "Average system load in last {{over}}", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "System load average", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "datasource": "Prometheus", - "fieldConfig": { - "defaults": { - "custom": {}, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 9, - "w": 6, - "x": 18, - "y": 0 - }, - "id": 12, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "mean" - ], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true - }, - "pluginVersion": "7.0.6", - "targets": [ - { - "expr": "process_cpu_usage_percentage", - "interval": "", - "legendFormat": "", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Relay process CPU usage (1 CPU = 100)", - "type": "gauge" - }, - { - "datasource": "Prometheus", - "fieldConfig": { - "defaults": { - "custom": {}, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 11, - "w": 12, - "x": 0, - "y": 6 - }, - "id": 4, - "options": { - "displayMode": "gradient", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "mean" - ], - "fields": "", - "values": false - }, - "showUnfilled": true - }, - "pluginVersion": "7.0.6", - "targets": [ - { - "expr": "blocks_in_state", - "instant": true, - "interval": "", - "legendFormat": "{{state}}", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Blocks in state on relay", - "type": "bargauge" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "Prometheus", - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 9 - }, - "hiddenSeries": false, - "id": 10, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "dataLinks": [] - }, - "percentage": false, - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "process_memory_usage_bytes / 1024 / 1024", - "interval": "", - "legendFormat": "Process memory, MB", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Memory used by relay process", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - } - ], - "refresh": "5s", - "schemaVersion": 25, - "style": "dark", - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-5m", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ] - }, - "timezone": "", - "title": "RelayDashboard", - "uid": "oj3y7vnGz", - "version": 1 -} \ No newline at end of file diff --git a/bridges/relays/ethereum/dashboard/grafana-dashboard.yaml b/bridges/relays/ethereum/dashboard/grafana-dashboard.yaml deleted file mode 100644 index f66dff4413..0000000000 --- a/bridges/relays/ethereum/dashboard/grafana-dashboard.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- name: 'default' - orgId: 1 - folder: '' - type: file - options: - path: '/etc/grafana/provisioning/dashboards/grafana-dashboard.json' \ No newline at end of file diff --git a/bridges/relays/ethereum/dashboard/grafana-datasource.yaml b/bridges/relays/ethereum/dashboard/grafana-datasource.yaml deleted file mode 100644 index ed77109fdb..0000000000 --- a/bridges/relays/ethereum/dashboard/grafana-datasource.yaml +++ /dev/null @@ -1,9 +0,0 @@ -datasources: - - name: Prometheus - type: prometheus - access: proxy - orgId: 1 - url: http://localhost:9090 - editable: false - is_default: true - version: 1 \ No newline at end of file diff --git a/bridges/relays/ethereum/dashboard/prometheus.yml b/bridges/relays/ethereum/dashboard/prometheus.yml deleted file mode 100644 index 572b62d1ac..0000000000 --- a/bridges/relays/ethereum/dashboard/prometheus.yml +++ /dev/null @@ -1,9 +0,0 @@ -scrape_configs: - # The job name is added as a label `job=` to any timeseries scraped from this config. - - job_name: 'relay_node' - - # Override the global default and scrape targets from this job every 5 seconds. - scrape_interval: 5s - - static_configs: - - targets: ['127.0.0.1:9616']