From 626cc17373f08992741ff4146e0dc9846d897b40 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Sun, 10 Sep 2023 13:28:26 -0600 Subject: [PATCH 1/9] Update copyright messages (#530) Co-authored-by: David Boreham --- app/base.py | 2 +- app/build_containers.py | 2 +- app/build_npms.py | 2 +- app/command_types.py | 2 +- app/data/stacks/mainnet-eth/deploy/commands.py | 2 +- app/data/stacks/mainnet-laconic/deploy/commands.py | 2 +- app/data/stacks/test/deploy/commands.py | 2 +- app/deploy.py | 2 +- app/deploy_types.py | 2 +- app/deploy_util.py | 2 +- app/deployment.py | 2 +- app/deployment_create.py | 2 +- app/setup_repositories.py | 2 +- app/stack_state.py | 2 +- app/util.py | 2 +- app/version.py | 2 +- cli.py | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/base.py b/app/base.py index 76e9841f..cc20da1b 100644 --- a/app/base.py +++ b/app/base.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/build_containers.py b/app/build_containers.py index 20201a7c..0187bb5e 100644 --- a/app/build_containers.py +++ b/app/build_containers.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/build_npms.py b/app/build_npms.py index 9120ec00..2ffbea1b 100644 --- a/app/build_npms.py +++ b/app/build_npms.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/command_types.py b/app/command_types.py index 67b74883..44df9e4b 100644 --- a/app/command_types.py +++ b/app/command_types.py @@ -1,4 +1,4 @@ -# Copyright © 2023 Cerc +# Copyright © 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/data/stacks/mainnet-eth/deploy/commands.py b/app/data/stacks/mainnet-eth/deploy/commands.py index 350d0469..9fcecbcf 100644 --- a/app/data/stacks/mainnet-eth/deploy/commands.py +++ b/app/data/stacks/mainnet-eth/deploy/commands.py @@ -1,4 +1,4 @@ -# Copyright © 2023 Cerc +# Copyright © 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/data/stacks/mainnet-laconic/deploy/commands.py b/app/data/stacks/mainnet-laconic/deploy/commands.py index 4d6c8881..16bf015a 100644 --- a/app/data/stacks/mainnet-laconic/deploy/commands.py +++ b/app/data/stacks/mainnet-laconic/deploy/commands.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/data/stacks/test/deploy/commands.py b/app/data/stacks/test/deploy/commands.py index 3e90e1ef..0a836037 100644 --- a/app/data/stacks/test/deploy/commands.py +++ b/app/data/stacks/test/deploy/commands.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/deploy.py b/app/deploy.py index e58c3d83..51749ff9 100644 --- a/app/deploy.py +++ b/app/deploy.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/deploy_types.py b/app/deploy_types.py index 4a328d82..63f32762 100644 --- a/app/deploy_types.py +++ b/app/deploy_types.py @@ -1,4 +1,4 @@ -# Copyright © 2023 Cerc +# Copyright © 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/deploy_util.py b/app/deploy_util.py index 9ead8b2a..2f5f0188 100644 --- a/app/deploy_util.py +++ b/app/deploy_util.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/deployment.py b/app/deployment.py index 1035d36b..8c860e46 100644 --- a/app/deployment.py +++ b/app/deployment.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/deployment_create.py b/app/deployment_create.py index f5db318b..cf47ec01 100644 --- a/app/deployment_create.py +++ b/app/deployment_create.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/setup_repositories.py b/app/setup_repositories.py index ddd920e2..c14dccb4 100644 --- a/app/setup_repositories.py +++ b/app/setup_repositories.py @@ -1,4 +1,4 @@ -# Copyright © 2022 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/stack_state.py b/app/stack_state.py index d4e3e7af..180a9084 100644 --- a/app/stack_state.py +++ b/app/stack_state.py @@ -1,4 +1,4 @@ -# Copyright © 2023 Cerc +# Copyright © 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/util.py b/app/util.py index 42a4673e..9d9eaa33 100644 --- a/app/util.py +++ b/app/util.py @@ -1,4 +1,4 @@ -# Copyright © 2022, 2023 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/app/version.py b/app/version.py index 4dd55086..5a5c33d4 100644 --- a/app/version.py +++ b/app/version.py @@ -1,4 +1,4 @@ -# Copyright © 2023 Cerc +# Copyright © 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/cli.py b/cli.py index 119eb88f..21f8a8b5 100644 --- a/cli.py +++ b/cli.py @@ -1,4 +1,4 @@ -# Copyright © 2022 Cerc +# Copyright © 2022, 2023 Vulcanize # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by -- 2.45.2 From e0ecbc3ab34f3e4b749266147633e78ca6314477 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 19 Sep 2023 10:36:05 -0600 Subject: [PATCH 2/9] Remove private repo from stack (#532) --- app/data/stacks/mainnet-eth/stack.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/data/stacks/mainnet-eth/stack.yml b/app/data/stacks/mainnet-eth/stack.yml index 6207756d..eca59ecc 100644 --- a/app/data/stacks/mainnet-eth/stack.yml +++ b/app/data/stacks/mainnet-eth/stack.yml @@ -1,4 +1,4 @@ -version: "1.1" +version: "1.2" name: mainnet-eth description: "Ethereum Mainnet" repos: @@ -7,7 +7,6 @@ repos: - github.com/dboreham/foundry - git.vdb.to/cerc-io/keycloak-reg-api - git.vdb.to/cerc-io/keycloak-reg-ui - - github.com/vulcanize/eth-api-proxy containers: - cerc/go-ethereum - cerc/lighthouse @@ -17,10 +16,8 @@ containers: - cerc/webapp-base - cerc/keycloak-reg-api - cerc/keycloak-reg-ui - - cerc/eth-api-proxy pods: - mainnet-eth - mainnet-eth-keycloak - mainnet-eth-metrics - - mainnet-eth-api-proxy - foundry -- 2.45.2 From 0b512db693eabd32599d41d35f4be779ebcd7e4f Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 19 Sep 2023 13:27:34 -0600 Subject: [PATCH 3/9] Handle udp ports mapped (#534) * Handle udp ports mapped * Fix lint error --- app/deployment_create.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/deployment_create.py b/app/deployment_create.py index cf47ec01..837aaa61 100644 --- a/app/deployment_create.py +++ b/app/deployment_create.py @@ -178,16 +178,18 @@ def _get_mapped_ports(stack: str, map_recipe: str): ports_array = ports[service] for x in range(0, len(ports_array)): orig_port = ports_array[x] + # Strip /udp suffix if present + bare_orig_port = orig_port.replace("/udp", "") random_port = random.randint(20000, 50000) # Beware: we're relying on luck to not collide if map_recipe == "any-variable-random": # This is the default so take no action pass elif map_recipe == "localhost-same": # Replace instances of "- XX" with "- 127.0.0.1:XX" - ports_array[x] = f"127.0.0.1:{orig_port}:{orig_port}" + ports_array[x] = f"127.0.0.1:{bare_orig_port}:{orig_port}" elif map_recipe == "any-same": # Replace instances of "- XX" with "- 0.0.0.0:XX" - ports_array[x] = f"0.0.0.0:{orig_port}:{orig_port}" + ports_array[x] = f"0.0.0.0:{bare_orig_port}:{orig_port}" elif map_recipe == "localhost-fixed-random": # Replace instances of "- XX" with "- 127.0.0.1::XX" ports_array[x] = f"127.0.0.1:{random_port}:{orig_port}" -- 2.45.2 From 5f9c3c14b2930ad2b49a1eda09dbf1928986cce6 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 19 Sep 2023 14:06:29 -0600 Subject: [PATCH 4/9] Add port mapping option --- app/data/stacks/mainnet-eth/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/data/stacks/mainnet-eth/README.md b/app/data/stacks/mainnet-eth/README.md index 79a3e788..8f0dc1c4 100644 --- a/app/data/stacks/mainnet-eth/README.md +++ b/app/data/stacks/mainnet-eth/README.md @@ -17,7 +17,7 @@ $ laconic-so --stack mainnet-eth build-containers ## Create a deployment ``` -$ laconic-so --stack mainnet-eth deploy init --output mainnet-eth-spec.yml +$ laconic-so --stack mainnet-eth deploy init --map-ports-to-host any-same --output mainnet-eth-spec.yml $ laconic-so deploy create --spec-file mainnet-eth-spec.yml --deployment-dir mainnet-eth-deployment ``` ## Start the stack @@ -138,4 +138,4 @@ $ sudo du -h mainnet-eth-deployment/data/ 860G mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth 860G mainnet-eth-deployment/data/mainnet_eth_geth_1_data 885G mainnet-eth-deployment/data/ -``` \ No newline at end of file +``` -- 2.45.2 From bdf4f069b4a3a8e5d526eda3b28bf400ef7d3183 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 19 Sep 2023 20:26:48 -0500 Subject: [PATCH 5/9] Include all of app/data regardless of depth. (#535) --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 562914eb..86050fbc 100644 --- a/setup.py +++ b/setup.py @@ -19,8 +19,7 @@ setup( install_requires=[requirements], python_requires='>=3.7', include_package_data=True, - # See: https://github.com/pypa/setuptools/issues/1806 - package_data={'': ['data/*', 'data/*/*', 'data/*/*/*', 'data/*/*/*/*', 'data/*/*/*/*/*']}, + package_data={'': ['data/**']}, classifiers=[ "Programming Language :: Python :: 3.8", "Operating System :: OS Independent", -- 2.45.2 From ed9c253f61ba78edb80b9646c77c7f51e513a1be Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 19 Sep 2023 20:29:08 -0500 Subject: [PATCH 6/9] Simplified, improved default dashboard for mainnet-eth-metrics. (#536) * Simplified, improved default dashboard for mainnet-eth-metrics. * Add missing lighthouse prometheus config. --- .../grafana/etc/dashboards/eth_dashboard.json | 1571 +++++++---------- .../prometheus/etc/prometheus.yml | 7 + 2 files changed, 639 insertions(+), 939 deletions(-) diff --git a/app/data/config/mainnet-eth-metrics/grafana/etc/dashboards/eth_dashboard.json b/app/data/config/mainnet-eth-metrics/grafana/etc/dashboards/eth_dashboard.json index 1946ed37..623c0a56 100644 --- a/app/data/config/mainnet-eth-metrics/grafana/etc/dashboards/eth_dashboard.json +++ b/app/data/config/mainnet-eth-metrics/grafana/etc/dashboards/eth_dashboard.json @@ -24,7 +24,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 1, + "id": 45, "links": [], "liveNow": false, "panels": [ @@ -38,7 +38,7 @@ }, "id": 16, "panels": [], - "title": "Row title", + "title": "Services", "type": "row" }, { @@ -51,47 +51,13 @@ "color": { "mode": "palette-classic" }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, "mappings": [], "thresholds": { - "mode": "absolute", + "mode": "percentage", "steps": [ { "color": "green", "value": null - }, - { - "color": "red", - "value": 80 } ] } @@ -100,23 +66,26 @@ }, "gridPos": { "h": 8, - "w": 12, + "w": 4, "x": 0, "y": 1 }, - "id": 6, + "id": 12, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "textMode": "auto" }, + "pluginVersion": "10.1.0", "targets": [ { "datasource": { @@ -124,235 +93,9 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "rate(nginx_http_requests_total{instance=\"keycloak-nginx-prometheus-exporter:9113\"}[$__rate_interval])", - "legendFormat": "__auto", - "range": true, - "refId": "A" - } - ], - "title": "nginx Requests/sec", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 1 - }, - "id": 8, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "builder", - "expr": "rate(ipld_eth_server_http_count{instance=\"ipld-eth-server:8090\"}[$__rate_interval])", - "legendFormat": "{{method}}", - "range": true, - "refId": "A" - } - ], - "title": "ipld-eth-server Requests/sec", - "transformations": [ - { - "id": "seriesToColumns", - "options": { - "byField": "Time" - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "{instance=\"ipld-eth-server:8090\", job=\"ipld-eth-server\"}": true - }, - "indexByName": {}, - "renameByName": {} - } - } - ], - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 9 - }, - "id": 20, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_blockNumber_success_count{instance=\"${node}:6060\"}[$__rate_interval])", + "expr": "chain_head_block", "hide": false, - "legendFormat": "eth_blockNumber", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_call_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_call", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_chainId_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_chainId", + "legendFormat": "geth ({{instance}})", "range": true, "refId": "C" }, @@ -362,375 +105,17 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "rate(rpc_duration_eth_estimateGas_success_count{instance=\"${node}:6060\"}[$__rate_interval])", + "expr": "beacon_head_slot", "hide": false, - "legendFormat": "eth_estimateGas", + "legendFormat": "lighthouse ({{instance}})", "range": true, - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_gasPrice_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_gasPrice", - "range": true, - "refId": "E" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getBalance_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getBalance", - "range": true, - "refId": "F" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getBlockByHash_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getBlockByHash", - "range": true, - "refId": "G" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getBlockByNumber_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getBlockByNumber", - "range": true, - "refId": "H" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getBlockReceipts_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getBlockReceipts", - "range": true, - "refId": "I" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getBlockTransactionCountByHash_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getBlockTransactionCountByHash", - "range": true, - "refId": "J" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getBlockTransactionCountByNumber_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getBlockTransactionCountByNumber", - "range": true, - "refId": "K" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getCode_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getCode", - "range": true, - "refId": "L" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getFilterChanges_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getFilterChanges", - "range": true, - "refId": "M" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getFilterLogs_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getFilterLogs", - "range": true, - "refId": "N" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getLogs_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getLogs", - "range": true, - "refId": "O" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getStorageAt_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getStorageAt", - "range": true, - "refId": "P" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getTransactionByBlockHashAndIndex_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getTransactionByBlockHashAndIndex", - "range": true, - "refId": "Q" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getTransactionByBlockNumberAndIndex_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getTransactionByBlockNumberAndIndex", - "range": true, - "refId": "R" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getTransactionByHash_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getTransactionByHash", - "range": true, - "refId": "S" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getTransactionCount_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getTransactionCount", - "range": true, - "refId": "T" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getTransactionReceipt_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getTransactionReceipt", - "range": true, - "refId": "U" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getUncleCountByBlockHash_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getUncleCountByBlockHash", - "range": true, - "refId": "V" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_getUncleCountByBlockNumber_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_getUncleCountByBlockNumber", - "range": true, - "refId": "W" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_mining_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_mining_success", - "range": true, - "refId": "X" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_newBlockFilter_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_newBlockFilter", - "range": true, - "refId": "Y" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_newFilter_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_newFilter", - "range": true, - "refId": "Z" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_newPendingTransactionFilter_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_newPendingTransactionFilter", - "range": true, - "refId": "AA" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_sendRawTransaction_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_sendRawTransaction", - "range": true, - "refId": "AB" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_signTransaction_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_signTransaction", - "range": true, - "refId": "AC" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_subscribe_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_subscribe", - "range": true, - "refId": "AD" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_syncing_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_syncing", - "range": true, - "refId": "AE" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_eth_unsubscribe_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "eth_unsubscribe", - "range": true, - "refId": "AF" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_statediff_writeStateDiffFor_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "statediff_writeStateDiffFor", - "range": true, - "refId": "AG" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "editorMode": "code", - "expr": "rate(rpc_duration_statediff_writeStateDiffAt_success_count{instance=\"${node}:6060\"}[$__rate_interval])", - "hide": false, - "legendFormat": "statediff_writeStateDiffAt", - "range": true, - "refId": "AH" + "refId": "A" } ], - "title": "geth API Requests/sec", - "type": "timeseries" + "title": "Head Positions", + "transformations": [ + ], + "type": "stat" }, { "datasource": { @@ -756,6 +141,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -772,7 +158,9 @@ "mode": "off" } }, + "decimals": 2, "mappings": [], + "min": 0, "thresholds": { "mode": "absolute", "steps": [ @@ -781,15 +169,16 @@ "value": null } ] - } + }, + "unit": "none" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 12, - "x": 12, - "y": 9 + "w": 8, + "x": 4, + "y": 1 }, "id": 2, "options": { @@ -813,11 +202,11 @@ }, "editorMode": "code", "exemplar": false, - "expr": "rate(keycloak_logins{instance=\"keycloak:8080\"}[90s]) * 60", + "expr": "rate(keycloak_logins[$__rate_interval]) * 60", "format": "time_series", "instant": false, - "interval": "2m", - "legendFormat": "{{client_id}}", + "interval": "5m", + "legendFormat": "{{client_id}} ({{instance}})", "range": true, "refId": "A" } @@ -839,7 +228,11 @@ "13761bf2-2c0e-42fd-acc8-09a677ab179e": true, "79a56c4e-0bfb-4ef0-87d4-244c4ace9b4b": true, "9c41e289-92f0-456f-bd65-8f73024a9e45": true, - "c9718dd1-06d6-4f98-a821-9adbeb4b663b": true + "VVQkSrRksVEKAqUmiNh4aMAVD6BcviyYV4b5LpnCrtUkRwTMoE (jackal.lan.vdb.to:8080)": true, + "c9718dd1-06d6-4f98-a821-9adbeb4b663b": true, + "nYByi9xhWdDHPpStoPLP3hjeJUzyQou8dsjK8aSipOglB3yx75 (jackal.lan.vdb.to:8080)": true, + "oA7XX21gTNMFRJJJdbDzjBVERbjrWamzIGhwHUAeMLrd1sXCWx (jackal.lan.vdb.to:8080)": true, + "oJf5jLHEqRbZg7BvSboYX1DM2T25K7XS4jgwF8NNzl3AHNWHm2 (jackal.lan.vdb.to:8080)": true }, "indexByName": {}, "renameByName": { @@ -867,13 +260,49 @@ "color": { "mode": "palette-classic" }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 28, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, "mappings": [], + "min": 0, "thresholds": { - "mode": "percentage", + "mode": "absolute", "steps": [ { "color": "green", "value": null + }, + { + "color": "red", + "value": 80 } ] } @@ -881,27 +310,24 @@ "overrides": [] }, "gridPos": { - "h": 7, - "w": 6, - "x": 0, - "y": 17 + "h": 8, + "w": 12, + "x": 12, + "y": 1 }, - "id": 12, + "id": 20, "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "textMode": "auto" + "tooltip": { + "mode": "single", + "sort": "none" + } }, - "pluginVersion": "9.3.2", "targets": [ { "datasource": { @@ -909,9 +335,240 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "chain_head_block{instance=\"${node}:6060\"}", + "expr": "rate(rpc_duration_all_count[$__rate_interval])", "hide": false, - "legendFormat": "geth", + "instant": false, + "legendFormat": "Requests ({{instance}})", + "range": true, + "refId": "A" + } + ], + "title": "geth API Requests/sec", + "transformations": [ + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 67, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "9.0.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "p2p_peers{job=\"geth\"}", + "legendFormat": "geth ({{instance}})", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "network_inbound_peers{job=\"lighthouse-beacon\"}", + "hide": false, + "legendFormat": "lighthouse ({{instance}})", + "range": true, + "refId": "B" + } + ], + "title": "P2P Peers", + "transformations": [ + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 32, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(system_disk_writebytes[$__rate_interval])", + "interval": "", + "legendFormat": "Process Write ({{instance}})", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(system_disk_readbytes[$__rate_interval])", + "hide": false, + "legendFormat": "Process Read ({{instance}})", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_disk_read[$__rate_interval])", + "hide": false, + "legendFormat": "ethdb Read ({{instance}})", "range": true, "refId": "C" }, @@ -921,14 +578,267 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "statediff_service_last_statediff_height{instance=\"${node}:6060\"}", - "legendFormat": "statediff", + "expr": "rate(eth_db_chaindata_disk_write[$__rate_interval])", + "hide": false, + "legendFormat": "ethdb Write ({{instance}})", "range": true, - "refId": "A" + "refId": "D" } ], - "title": "Block Positions", - "type": "stat" + "title": "geth Disk Bytes/sec", + "transformations": [ + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 17 + }, + "id": 34, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(system_disk_readcount[$__rate_interval])", + "legendFormat": "Process Read ({{instance}})", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(system_disk_writecount[$__rate_interval])", + "hide": false, + "legendFormat": "Process Write ({{instance}})", + "range": true, + "refId": "B" + } + ], + "title": "geth Disk Operations/sec", + "transformations": [ + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 17 + }, + "id": 61, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_db_get_time_count[$__rate_interval])", + "legendFormat": "get ({{instance}})", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_db_put_time_count[$__rate_interval])", + "hide": false, + "legendFormat": "put ({{instance}})", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_db_has_time_count[$__rate_interval])", + "hide": false, + "legendFormat": "has ({{instance}})", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_db_delete_time_count[$__rate_interval])", + "hide": false, + "legendFormat": "delete ({{instance}})", + "range": true, + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_db_batch_write_time_count[$__rate_interval])", + "hide": false, + "legendFormat": "batch_write ({{instance}})", + "range": true, + "refId": "E" + } + ], + "title": "geth LevelDB Operations/sec", + "transformations": [ + ], + "type": "timeseries" }, { "datasource": { @@ -939,7 +849,7 @@ "fieldConfig": { "defaults": { "color": { - "mode": "continuous-GrYlRd" + "mode": "palette-classic" }, "custom": { "axisCenteredZero": false, @@ -955,6 +865,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -984,132 +895,18 @@ "value": 80 } ] - } - }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "Distance" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] - } - ] - }, - "gridPos": { - "h": 7, - "w": 6, - "x": 6, - "y": 17 - }, - "id": 22, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" }, - "editorMode": "code", - "expr": "clamp_min(chain_head_block{instance=\"${node}:6060\"} - on() statediff_service_last_statediff_height{instance=\"${node}:6060\"}, 0)", - "interval": "1m", - "legendFormat": "Distance", - "range": true, - "refId": "A" - } - ], - "title": "Block Distance (geth to statediff)", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "none" + "unit": "percent" }, "overrides": [] }, "gridPos": { - "h": 7, + "h": 8, "w": 12, - "x": 12, - "y": 17 + "x": 0, + "y": 25 }, - "id": 10, + "id": 63, "options": { "legend": { "calcs": [], @@ -1122,7 +919,6 @@ "sort": "none" } }, - "pluginVersion": "9.0.1", "targets": [ { "datasource": { @@ -1130,12 +926,8 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "exemplar": false, - "expr": "increase(statediff_service_succeeded{instance=\"${node}:6060\"}[1m])", - "format": "time_series", - "instant": false, - "interval": "1m", - "legendFormat": "Succeeded", + "expr": "rate(eth_db_chaindata_db_get_time_total[$__rate_interval]) / 10000000", + "legendFormat": "get ({{instance}})", "range": true, "refId": "A" }, @@ -1145,10 +937,9 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "increase(statediff_service_failed{instance=\"${node}:6060\"}[1m])", + "expr": "rate(eth_db_chaindata_db_put_time_total[$__rate_interval]) / 10000000", "hide": false, - "interval": "1m", - "legendFormat": "Failed", + "legendFormat": "put ({{instance}})", "range": true, "refId": "B" }, @@ -1158,119 +949,40 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "statediff_service_underway{instance=\"${node}:6060\"}", + "expr": "rate(eth_db_chaindata_db_has_time_total[$__rate_interval]) / 10000000", "hide": false, - "interval": "1s", - "legendFormat": "Underway", + "legendFormat": "has ({{instance}})", "range": true, "refId": "C" - } - ], - "title": "Statediff Operations", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "jZUuGao4k" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "#EAB839", - "value": 50 - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ms" }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 24 - }, - "id": 14, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "9.0.1", - "targets": [ { "datasource": { "type": "prometheus", "uid": "jZUuGao4k" }, "editorMode": "code", - "exemplar": false, - "expr": "rate(statediff_service_total_processing_time{instance=\"${node}:6060\"}[$__rate_interval])", - "instant": false, - "interval": "1m", - "legendFormat": "__auto", + "expr": "rate(eth_db_chaindata_db_delete_time_total[$__rate_interval]) / 10000000", + "hide": false, + "legendFormat": "delete ({{instance}})", "range": true, - "refId": "A" + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "jZUuGao4k" + }, + "editorMode": "code", + "expr": "rate(eth_db_chaindata_db_batch_write_time_total[$__rate_interval]) / 10000000", + "hide": false, + "legendFormat": "batch_write ({{instance}})", + "range": true, + "refId": "E" } ], - "title": "Statediff Duty Cycle", + "title": "geth LevelDB Utilization", + "transformations": [ + ], "type": "timeseries" }, { @@ -1297,6 +1009,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1314,6 +1027,7 @@ } }, "mappings": [], + "min": 0, "thresholds": { "mode": "absolute", "steps": [ @@ -1334,9 +1048,9 @@ "h": 8, "w": 12, "x": 12, - "y": 24 + "y": 25 }, - "id": 4, + "id": 65, "options": { "legend": { "calcs": [], @@ -1356,54 +1070,33 @@ "uid": "jZUuGao4k" }, "editorMode": "code", - "expr": "rate(statediff_service_api_requests{instance=\"${node}:6060\"}[$__rate_interval])", - "legendFormat": "__auto", + "expr": "rate(eth_db_chaindata_db_batch_item_count[$__rate_interval])", + "legendFormat": "batch_items ({{instance}})", "range": true, "refId": "A" } ], - "title": "Statediff API Requests/sec", + "title": "geth LevelDB Batch Items Written/sec", + "transformations": [ + ], "type": "timeseries" } ], - "refresh": "5s", - "schemaVersion": 37, + "refresh": "30s", + "schemaVersion": 38, "style": "dark", "tags": [], "templating": { - "list": [ - { - "current": { - "selected": true, - "text": "mainnet-eth-geth-1", - "value": "mainnet-eth-geth-1" - }, - "hide": 0, - "includeAll": false, - "multi": false, - "name": "node", - "options": [ - { - "selected": true, - "text": "mainnet-eth-geth-1", - "value": "mainnet-eth-geth-1" - } - ], - "query": "mainnet-eth-geth-1", - "queryValue": "", - "skipUrlSync": false, - "type": "custom" - } - ] + "list": [] }, "time": { - "from": "now-15m", + "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "", - "title": "cerc-io overview", - "uid": "nT9VeZoVk", - "version": 2, + "title": "eth API Simple", + "uid": "b4ba9b2e-965d-4c71-8735-78b6af93156e", + "version": 4, "weekStart": "" } diff --git a/app/data/config/mainnet-eth-metrics/prometheus/etc/prometheus.yml b/app/data/config/mainnet-eth-metrics/prometheus/etc/prometheus.yml index e9f23e89..4cc74fc0 100644 --- a/app/data/config/mainnet-eth-metrics/prometheus/etc/prometheus.yml +++ b/app/data/config/mainnet-eth-metrics/prometheus/etc/prometheus.yml @@ -10,6 +10,13 @@ scrape_configs: static_configs: - targets: ['mainnet-eth-geth-1:6060'] + # lighthouse + - job_name: 'lighthouse' + metrics_path: /metrics + scheme: http + static_configs: + - targets: ['mainnet-eth-lighthouse-1:5054'] + # keycloak - job_name: 'keycloak' scrape_interval: 5s -- 2.45.2 From 3dc9cd584a870dcd4caeac0266067d03f14acc98 Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Wed, 20 Sep 2023 09:48:15 +0530 Subject: [PATCH 7/9] Add a mobymask-v3 stack (#531) * Add a mobymask-v3 stack * Fix Nitro deployment script and add watcher container * Setup Nitro config * Run build after setting Nitro addresses * Setup consensus config * Add a container for web-app * Use node 18 for the web-app * Persist Nitro node data to a volume * Add clean up steps * Update query rates --- .../docker-compose-mobymask-app-v3.yml | 38 +++++ .../docker-compose-watcher-mobymask-v3.yml | 128 +++++++++++++++++ .../deploy-nitro-contracts.sh | 58 ++++++++ .../deploy-nitro-contracts.ts | 49 +++++++ ...T9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ.json | 11 ++ ...S4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5.json | 11 ++ ...kAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi.json | 11 ++ .../watcher-mobymask-v3/mobymask-app-start.sh | 62 ++++++++ .../watcher-mobymask-v3/mobymask-params.env | 34 +++++ .../watcher-mobymask-v3/start-server.sh | 133 +++++++++++++++++ .../watcher-config-rates.toml | 14 ++ .../watcher-config-template.toml | 103 +++++++++++++ .../cerc-mobymask-ui/Dockerfile | 4 +- .../cerc-watcher-mobymask-v3/Dockerfile | 20 +++ .../cerc-watcher-mobymask-v3/build.sh | 9 ++ app/data/container-image-list.txt | 1 + app/data/pod-list.txt | 2 + app/data/stacks/mobymask-v3/README.md | 6 + app/data/stacks/mobymask-v3/stack.yml | 16 +++ app/data/stacks/mobymask-v3/watcher.md | 135 ++++++++++++++++++ app/data/stacks/mobymask-v3/web-app.md | 86 +++++++++++ 21 files changed, 929 insertions(+), 2 deletions(-) create mode 100644 app/data/compose/docker-compose-mobymask-app-v3.yml create mode 100644 app/data/compose/docker-compose-watcher-mobymask-v3.yml create mode 100755 app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.sh create mode 100644 app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.ts create mode 100644 app/data/config/watcher-mobymask-v3/keys/12D3KooWAMjBkFCT9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ.json create mode 100644 app/data/config/watcher-mobymask-v3/keys/12D3KooWBNEbY3QS4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5.json create mode 100644 app/data/config/watcher-mobymask-v3/keys/12D3KooWSRH6ftgkAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi.json create mode 100644 app/data/config/watcher-mobymask-v3/mobymask-app-start.sh create mode 100644 app/data/config/watcher-mobymask-v3/mobymask-params.env create mode 100755 app/data/config/watcher-mobymask-v3/start-server.sh create mode 100644 app/data/config/watcher-mobymask-v3/watcher-config-rates.toml create mode 100644 app/data/config/watcher-mobymask-v3/watcher-config-template.toml create mode 100644 app/data/container-build/cerc-watcher-mobymask-v3/Dockerfile create mode 100755 app/data/container-build/cerc-watcher-mobymask-v3/build.sh create mode 100644 app/data/stacks/mobymask-v3/README.md create mode 100644 app/data/stacks/mobymask-v3/stack.yml create mode 100644 app/data/stacks/mobymask-v3/watcher.md create mode 100644 app/data/stacks/mobymask-v3/web-app.md diff --git a/app/data/compose/docker-compose-mobymask-app-v3.yml b/app/data/compose/docker-compose-mobymask-app-v3.yml new file mode 100644 index 00000000..bc0973c8 --- /dev/null +++ b/app/data/compose/docker-compose-mobymask-app-v3.yml @@ -0,0 +1,38 @@ +version: '3.2' + +services: + # Builds and serves the MobyMask v3 react-app + mobymask-v3-app: + restart: unless-stopped + image: cerc/mobymask-ui:local + env_file: + - ../config/watcher-mobymask-v3/mobymask-params.env + environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + CERC_CHAIN_ID: ${CERC_CHAIN_ID} + CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} + CERC_RELAY_NODES: ${CERC_RELAY_NODES} + CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} + CERC_PUBSUB: ${CERC_PUBSUB} + CERC_RELEASE: "laconic-v3" + CERC_NA_ADDRESS: ${CERC_NA_ADDRESS} + CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS} + CERC_CA_ADDRESS: ${CERC_CA_ADDRESS} + CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL} + CERC_PAYMENT_NITRO_ADDRESS: ${CERC_PAYMENT_NITRO_ADDRESS} + CERC_SNAP_URL: ${CERC_SNAP_URL} + working_dir: /scripts + command: ["sh", "mobymask-app-start.sh"] + volumes: + - ../config/watcher-mobymask-v3/mobymask-app-start.sh:/scripts/mobymask-app-start.sh + - ../config/watcher-mobymask-v2/mobymask-app-config.json:/app/src/mobymask-app-config.json + ports: + - "127.0.0.1:3004:80" + healthcheck: + test: ["CMD", "nc", "-vz", "localhost", "80"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 10s + extra_hosts: + - "host.docker.internal:host-gateway" diff --git a/app/data/compose/docker-compose-watcher-mobymask-v3.yml b/app/data/compose/docker-compose-watcher-mobymask-v3.yml new file mode 100644 index 00000000..8c351ae7 --- /dev/null +++ b/app/data/compose/docker-compose-watcher-mobymask-v3.yml @@ -0,0 +1,128 @@ +version: '3.2' + +services: + # Starts the PostgreSQL database for watcher + mobymask-watcher-db: + restart: unless-stopped + image: postgres:14-alpine + environment: + - POSTGRES_USER=vdbm + - POSTGRES_MULTIPLE_DATABASES=mobymask-watcher,mobymask-watcher-job-queue + - POSTGRES_EXTENSION=mobymask-watcher-job-queue:pgcrypto + - POSTGRES_PASSWORD=password + volumes: + - ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh + - mobymask_watcher_db_data:/var/lib/postgresql/data + ports: + - "127.0.0.1:15432:5432" + healthcheck: + test: ["CMD", "nc", "-v", "localhost", "5432"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 10s + + # Deploys the MobyMask contract and generates an invite link + # Deployment is skipped if CERC_DEPLOYED_CONTRACT env is set + mobymask: + image: cerc/mobymask:local + working_dir: /app/packages/server + env_file: + - ../config/watcher-mobymask-v3/mobymask-params.env + environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + ENV: "PROD" + CERC_L2_GETH_RPC: ${CERC_L2_GETH_RPC} + CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL} + CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER} + CERC_MOBYMASK_APP_BASE_URI: ${CERC_MOBYMASK_APP_BASE_URI} + CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} + CERC_L2_GETH_HOST: ${CERC_L2_GETH_HOST} + CERC_L2_GETH_PORT: ${CERC_L2_GETH_PORT} + CERC_L2_NODE_HOST: ${CERC_L2_NODE_HOST} + CERC_L2_NODE_PORT: ${CERC_L2_NODE_PORT} + command: ["sh", "deploy-and-generate-invite.sh"] + volumes: + - ../config/network/wait-for-it.sh:/app/packages/server/wait-for-it.sh + - ../config/watcher-mobymask-v2/secrets-template.json:/app/packages/server/secrets-template.json + - ../config/watcher-mobymask-v2/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh + - mobymask_deployment:/app/packages/server + extra_hosts: + - "host.docker.internal:host-gateway" + + # Creates peer-id files if they don't exist + peer-ids-gen: + image: cerc/watcher-ts:local + restart: on-failure + environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + working_dir: /app/packages/peer + command: ["sh", "generate-peer-ids.sh"] + volumes: + - ../config/watcher-mobymask-v2/generate-peer-ids.sh:/app/packages/peer/generate-peer-ids.sh + - peers_ids:/peer-ids + + # Optionally deploys the Nitro contracts; sets them at the required path + # Starts the MobyMask v3 watcher server + mobymask-watcher-server: + image: cerc/watcher-mobymask-v3:local + restart: unless-stopped + depends_on: + mobymask-watcher-db: + condition: service_healthy + peer-ids-gen: + condition: service_completed_successfully + mobymask: + condition: service_completed_successfully + env_file: + - ../config/watcher-mobymask-v3/mobymask-params.env + environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + CERC_L2_GETH_RPC: ${CERC_L2_GETH_RPC} + CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL} + CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER} + CERC_RELAY_PEERS: ${CERC_RELAY_PEERS} + CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} + CERC_PUBSUB: ${CERC_PUBSUB} + CERC_RELAY_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN} + CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS} + CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} + CERC_NA_ADDRESS: ${CERC_NA_ADDRESS} + CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS} + CERC_CA_ADDRESS: ${CERC_CA_ADDRESS} + CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER} + CERC_PRIVATE_KEY_NITRO: ${CERC_PRIVATE_KEY_NITRO} + CERC_PEER_ID: ${CERC_PEER_ID} + entrypoint: ["bash", "-c"] + command: ["./deploy-nitro-contracts.sh && ./start-server.sh"] + volumes: + - ../config/watcher-mobymask-v3/deploy-nitro-contracts.sh:/app/deploy-nitro-contracts.sh + - ../config/watcher-mobymask-v3/deploy-nitro-contracts.ts:/app/deploy-nitro-contracts.ts + - ../config/watcher-mobymask-v3/watcher-config-template.toml:/app/environments/watcher-config-template.toml + - ../config/watcher-mobymask-v3/watcher-config-rates.toml:/app/environments/rates.toml + - ../config/watcher-mobymask-v3/keys:/app/keys + - ../config/watcher-mobymask-v3/start-server.sh:/app/start-server.sh + - nitro_data:/app/out/nitro-db + - peers_ids:/app/peers + - nitro_addresses:/nitro + - mobymask_deployment:/server + # Expose GQL, metrics and relay node ports + ports: + - "127.0.0.1:3001:3001" + - "127.0.0.1:9001:9001" + - "127.0.0.1:9090:9090" + healthcheck: + test: ["CMD", "busybox", "nc", "localhost", "9090"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 5s + extra_hosts: + - "host.docker.internal:host-gateway" + +volumes: + mobymask_watcher_db_data: + peers_ids: + mobymask_deployment: + nitro_addresses: + nitro_data: diff --git a/app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.sh b/app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.sh new file mode 100755 index 00000000..b12e9ce2 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +CERC_NA_ADDRESS="${CERC_NA_ADDRESS:-${DEFAULT_CERC_NA_ADDRESS}}" +CERC_VPA_ADDRESS="${CERC_VPA_ADDRESS:-${DEFAULT_CERC_VPA_ADDRESS}}" +CERC_CA_ADDRESS="${CERC_CA_ADDRESS:-${DEFAULT_CERC_CA_ADDRESS}}" + +NITRO_ADDRESSES_FILE_PATH="/nitro/nitro-addresses.json" + +# Check if CERC_NA_ADDRESS environment variable set to skip contract deployment +if [ -n "$CERC_NA_ADDRESS" ]; then + echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'" + echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'" + echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'" + echo "Using the above addresses and skipping Nitro contracts deployment" + + # Create the required JSON and write it to a file + nitro_addresses_json=$(jq -n \ + --arg na "$CERC_NA_ADDRESS" \ + --arg vpa "$CERC_VPA_ADDRESS" \ + --arg ca "$CERC_CA_ADDRESS" \ + '.nitroAdjudicatorAddress = $na | .virtualPaymentAppAddress = $vpa | .consensusAppAddress = $ca') + echo "$nitro_addresses_json" > "${NITRO_ADDRESSES_FILE_PATH}" + + exit +fi + +# Check and exit if a deployment already exists (on restarts) +if [ -f ${NITRO_ADDRESSES_FILE_PATH} ]; then + echo "${NITRO_ADDRESSES_FILE_PATH} already exists, skipping Nitro contracts deployment" + exit +fi + +echo "Using L2 RPC endpoint ${CERC_L2_GETH_RPC}" + +if [ -n "$CERC_L1_ACCOUNTS_CSV_URL" ] && \ + l1_accounts_response=$(curl -L --write-out '%{http_code}' --silent --output /dev/null "$CERC_L1_ACCOUNTS_CSV_URL") && \ + [ "$l1_accounts_response" -eq 200 ]; +then + echo "Fetching L1 account credentials using provided URL" + mkdir -p /geth-accounts + wget -O /geth-accounts/accounts.csv "$CERC_L1_ACCOUNTS_CSV_URL" + + # Read the private key of an L1 account to deploy contract + CERC_PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3) +else + echo "Couldn't fetch L1 account credentials, using CERC_PRIVATE_KEY_DEPLOYER from env" +fi + +echo "RPC_URL=${CERC_L2_GETH_RPC}" > .env +echo "NITRO_ADDRESSES_FILE_PATH=${NITRO_ADDRESSES_FILE_PATH}" >> .env +echo "PRIVATE_KEY=${CERC_PRIVATE_KEY_DEPLOYER}" >> .env + +yarn ts-node --esm deploy-nitro-contracts.ts diff --git a/app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.ts b/app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.ts new file mode 100644 index 00000000..c738083d --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/deploy-nitro-contracts.ts @@ -0,0 +1,49 @@ +import 'dotenv/config'; +import fs from 'fs'; +import { providers, Wallet } from 'ethers'; +import { deployContracts } from '@cerc-io/nitro-util'; + +async function main () { + const rpcURL = process.env.RPC_URL; + const addressesFilePath = process.env.NITRO_ADDRESSES_FILE_PATH; + const deployerKey = process.env.PRIVATE_KEY; + + if (!rpcURL) { + console.log('RPC_URL not set, skipping deployment'); + return; + } + + if (!addressesFilePath) { + console.log('NITRO_ADDRESSES_FILE_PATH not set, skipping deployment'); + return; + } + + if (!deployerKey) { + console.log('PRIVATE_KEY not set, skipping deployment'); + return; + } + + const provider = new providers.JsonRpcProvider(process.env.RPC_URL); + const signer = new Wallet(deployerKey, provider); + + const [ + nitroAdjudicatorAddress, + virtualPaymentAppAddress, + consensusAppAddress + ] = await deployContracts(signer as any); + + const output = { + nitroAdjudicatorAddress, + virtualPaymentAppAddress, + consensusAppAddress + }; + + fs.writeFileSync(addressesFilePath, JSON.stringify(output, null, 2)); + console.log('Nitro contracts deployed, addresses written to', addressesFilePath); + console.log('Result:', JSON.stringify(output, null, 2)); +} + +main() + .catch((err) => { + console.log(err); + }); diff --git a/app/data/config/watcher-mobymask-v3/keys/12D3KooWAMjBkFCT9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ.json b/app/data/config/watcher-mobymask-v3/keys/12D3KooWAMjBkFCT9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ.json new file mode 100644 index 00000000..84465346 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/keys/12D3KooWAMjBkFCT9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ.json @@ -0,0 +1,11 @@ +{ + "peerId": { + "id": "12D3KooWAMjBkFCT9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ", + "privKey": "CAESQAKCrnY0QKTky1I18fqn+VPydXGUv1NYiV+nVKqBFkw/CAjE9sKKIDGnYAo8mivnI6dngFenERY+0Q8AJrPTaXY=", + "pubKey": "CAESIAgIxPbCiiAxp2AKPJor5yOnZ4BXpxEWPtEPACaz02l2" + }, + "consensus": { + "publicKey": "02cd17b05ca998955be5ca7bf4fd4531243d438f1aae7ce8a0ed5159f53cee5b40", + "privateKey": "67d80505614bdf61fca11cbad31d93acb2c7df1c653dc25975d77d05f05f154f" + } +} diff --git a/app/data/config/watcher-mobymask-v3/keys/12D3KooWBNEbY3QS4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5.json b/app/data/config/watcher-mobymask-v3/keys/12D3KooWBNEbY3QS4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5.json new file mode 100644 index 00000000..8eea1872 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/keys/12D3KooWBNEbY3QS4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5.json @@ -0,0 +1,11 @@ +{ + "peerId": { + "id": "12D3KooWBNEbY3QS4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5", + "privKey": "CAESQGSTw0ymvn8+wX9Dbvyr4/Gib1q2voe0CC0VyeClMQP6FwW14x0fpRbBIx0XhLdxWHkRndphVg3gVAHyC+7ZI8o=", + "pubKey": "CAESIBcFteMdH6UWwSMdF4S3cVh5EZ3aYVYN4FQB8gvu2SPK" + }, + "consensus": { + "publicKey": "029c8035b3e9401b8f178f7c37285b5cb22501e017340e2058b3b842f2a1f0ae45", + "privateKey": "0261008e8e3ec808168e99333599da38ca59a056a2ae4510a6ad3d8b5cb0918c" + } +} diff --git a/app/data/config/watcher-mobymask-v3/keys/12D3KooWSRH6ftgkAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi.json b/app/data/config/watcher-mobymask-v3/keys/12D3KooWSRH6ftgkAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi.json new file mode 100644 index 00000000..80721faa --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/keys/12D3KooWSRH6ftgkAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi.json @@ -0,0 +1,11 @@ +{ + "peerId": { + "id": "12D3KooWSRH6ftgkAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi", + "privKey": "CAESQHBjlHxfVhZ2gXsBItrIEEgSGKcjMkFiGs3PPz9E3ace9qyWEkvR4oit5ve9SAROVoh20hoa42IC91NIafMaqws=", + "pubKey": "CAESIPaslhJL0eKIreb3vUgETlaIdtIaGuNiAvdTSGnzGqsL" + }, + "consensus": { + "publicKey": "039160c244a7ad8be16a64bdb69e6dbacdcfe20b37076792a0d06032a8097468ca", + "privateKey": "8894685fe81001d75662b079905472699373967451d1255ee5fc669d0a09a9ca" + } +} diff --git a/app/data/config/watcher-mobymask-v3/mobymask-app-start.sh b/app/data/config/watcher-mobymask-v3/mobymask-app-start.sh new file mode 100644 index 00000000..d7f87f19 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/mobymask-app-start.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +CERC_CHAIN_ID="${CERC_CHAIN_ID:-${DEFAULT_CERC_CHAIN_ID}}" +CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" +CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}" +CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" +CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}" + +echo "Using CERC_RELAY_NODES $CERC_RELAY_NODES" + +if [ -z "$CERC_DEPLOYED_CONTRACT" ]; then + echo "CERC_DEPLOYED_CONTRACT not set" + exit 1 +else + echo "Using CERC_DEPLOYED_CONTRACT ${CERC_DEPLOYED_CONTRACT} from env as the MobyMask contract address" +fi + +# Checkout to the required release/branch +cd /app +git checkout $CERC_RELEASE + +# Check if CERC_NA_ADDRESS is set +if [ -n "$CERC_NA_ADDRESS" ]; then + echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'" + echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'" + echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'" + echo "Using the above Nitro addresses" + + # Create the required JSON and write it to a file + nitro_addresses_json=$(jq -n \ + --arg na "$CERC_NA_ADDRESS" \ + --arg vpa "$CERC_VPA_ADDRESS" \ + --arg ca "$CERC_CA_ADDRESS" \ + '.nitroAdjudicatorAddress = $na | .virtualPaymentAppAddress = $vpa | .consensusAppAddress = $ca') + echo "$nitro_addresses_json" > /app/src/utils/nitro-addresses.json +else + echo "Nitro addresses not provided" + exit 1 +fi + +# Export config values in a json file +jq --arg address "$CERC_DEPLOYED_CONTRACT" \ + --argjson chainId "$CERC_CHAIN_ID" \ + --argjson relayNodes "$CERC_RELAY_NODES" \ + --argjson denyMultiaddrs "$CERC_DENY_MULTIADDRS" \ + --arg pubsub "$CERC_PUBSUB" \ + '.address = $address | .chainId = $chainId | .relayNodes = $relayNodes | .peer.denyMultiaddrs = $denyMultiaddrs | .peer.pubsub = $pubsub' \ + /app/src/mobymask-app-config.json > /app/src/utils/config.json + +yarn install + +REACT_APP_WATCHER_URI="$CERC_APP_WATCHER_URL/graphql" \ +REACT_APP_PAY_TO_NITRO_ADDRESS="$CERC_PAYMENT_NITRO_ADDRESS" \ +REACT_APP_SNAP_ORIGIN="local:$CERC_SNAP_URL" \ +yarn build + +http-server -p 80 /app/build diff --git a/app/data/config/watcher-mobymask-v3/mobymask-params.env b/app/data/config/watcher-mobymask-v3/mobymask-params.env new file mode 100644 index 00000000..35a54b69 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/mobymask-params.env @@ -0,0 +1,34 @@ +# Defaults + +# Set of relay peers to connect to from the relay node +DEFAULT_CERC_RELAY_PEERS=[] + +# Domain to be used in the relay node's announce address +DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN= + +# Base URI for mobymask-app (used for generating invite) +DEFAULT_CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#" + +# Set to false for disabling watcher peer to send txs to L2 +DEFAULT_CERC_ENABLE_PEER_L2_TXS=true + +# Set deployed MobyMask contract address to avoid deploying contract in stack +# mobymask-app will use this contract address in config if run separately +DEFAULT_CERC_DEPLOYED_CONTRACT= + +# Chain ID is used by mobymask web-app for txs +DEFAULT_CERC_CHAIN_ID=42069 + +# Set of relay nodes to be used by web-apps +DEFAULT_CERC_RELAY_NODES=[] + +# Set of multiaddrs to be avoided while dialling +DEFAULT_CERC_DENY_MULTIADDRS=[] + +# Type of pubsub to be used +DEFAULT_CERC_PUBSUB="" + +# Set deployed Nitro addresses to avoid deploying them in the stack +DEFAULT_CERC_NA_ADDRESS= +DEFAULT_CERC_VPA_ADDRESS= +DEFAULT_CERC_CA_ADDRESS= diff --git a/app/data/config/watcher-mobymask-v3/start-server.sh b/app/data/config/watcher-mobymask-v3/start-server.sh new file mode 100755 index 00000000..9ff4020f --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/start-server.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +CERC_L2_GETH_RPC="${CERC_L2_GETH_RPC:-${DEFAULT_CERC_L2_GETH_RPC}}" + +CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}" +CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" +CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}" +CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN}}" +CERC_ENABLE_PEER_L2_TXS="${CERC_ENABLE_PEER_L2_TXS:-${DEFAULT_CERC_ENABLE_PEER_L2_TXS}}" +CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" + +nitro_addresses_file="/nitro/nitro-addresses.json" +nitro_addresses_destination_file="./src/nitro-addresses.json" + +watcher_keys_dir="./keys" + +echo "Using L2 RPC endpoint ${CERC_L2_GETH_RPC}" + +# Use public domain for relay multiaddr in peer config if specified +# Otherwise, use the docker container's host IP +if [ -n "$CERC_RELAY_ANNOUNCE_DOMAIN" ]; then + CERC_RELAY_MULTIADDR="/dns4/${CERC_RELAY_ANNOUNCE_DOMAIN}/tcp/443/wss/p2p/$(jq -r '.id' /app/peers/relay-id.json)" +else + CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id' /app/peers/relay-id.json)" +fi + +# Use contract address from environment variable or set from config.json in mounted volume +if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then + CONTRACT_ADDRESS="${CERC_DEPLOYED_CONTRACT}" +else + # Assign deployed contract address from server config (created by mobymask container after deploying contract) + CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"') +fi + +# Copy the deployed Nitro addresses to the required path +if [ -f "$nitro_addresses_file" ]; then + cat "$nitro_addresses_file" > "$nitro_addresses_destination_file" + echo "Nitro addresses set to ${nitro_addresses_destination_file}" + + # Build after setting the Nitro addresses + yarn build +else + echo "File ${nitro_addresses_file} does not exist" + exit 1 +fi + +echo "Using CERC_PRIVATE_KEY_PEER (account with funds) from env for sending txs to L2" +echo "Using CERC_PRIVATE_KEY_NITRO from env for Nitro account" + +if [ -n "$CERC_PEER_ID" ]; then + echo "Using CERC_PEER_ID ${CERC_PEER_ID} from env for watcher fixture" + echo "Consensus module enabled" + + # Set corresponding variables + PEER_ID_FILE='./peer-id.json' + CONSENSUS_ENABLED=true + WATCHER_PARTY_PEERS_FILE='./watcher-party-peers.json' + + # Create watcher party array + watcher_parties=() + + # Iterate over each fixture JSON file + for peer_data_file in "$watcher_keys_dir"/*.json; do + # Extract the filename without the path and extension + peer_id=$(basename "$peer_data_file" .json) + + # Read the consensus keys + consensus_public_key=$(jq -r '.consensus.publicKey' "$peer_data_file") + consensus_private_key=$(jq -r '.consensus.privateKey' "$peer_data_file") + + # Append watcher party + watcher_party=$(jq -n \ + --arg peerId "$peer_id" \ + --arg publicKey "$consensus_public_key" \ + '.peerId = $peerId | .publicKey = $publicKey') + watcher_parties+=("$watcher_party") + + if [ "$peer_id" = "$CERC_PEER_ID" ]; then + # Export peer id + peer_id_data=$(jq '.peerId' "$peer_data_file") + echo "$peer_id_data" > "${PEER_ID_FILE}" + + # Set consensus keys for this peer + CONSENSUS_PUBLIC_KEY=${consensus_public_key} + CONSENSUS_PRIVATE_KEY=${consensus_private_key} + fi + done + + # Export watcher party file + watcher_parties_json=$(printf '%s\n' "${watcher_parties[@]}" | jq -s .) + echo "$watcher_parties_json" > "${WATCHER_PARTY_PEERS_FILE}" + echo "Watcher party peers exported to ${WATCHER_PARTY_PEERS_FILE}" +else + echo "Using generated peer id" + echo "Consensus module disabled" + + # Set corresponding variables + PEER_ID_FILE='./peers/peer-id.json' + CONSENSUS_ENABLED=false + WATCHER_PARTY_PEERS_FILE='' + CONSENSUS_PUBLIC_KEY='' + CONSENSUS_PRIVATE_KEY='' +fi + +# Read in the config template TOML file and modify it +WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml) +WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ + sed -E "s|REPLACE_WITH_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \ + s|REPLACE_WITH_CERC_DENY_MULTIADDRS|${CERC_DENY_MULTIADDRS}|g; \ + s/REPLACE_WITH_CERC_PUBSUB/${CERC_PUBSUB}/g; \ + s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \ + s|REPLACE_WITH_CERC_RELAY_MULTIADDR|${CERC_RELAY_MULTIADDR}|g; \ + s|REPLACE_WITH_PEER_ID_FILE|${PEER_ID_FILE}|g; \ + s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \ + s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \ + s/REPLACE_WITH_CERC_PRIVATE_KEY_NITRO/${CERC_PRIVATE_KEY_NITRO}/g; \ + s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \ + s/REPLACE_WITH_CONSENSUS_ENABLED/${CONSENSUS_ENABLED}/g; \ + s/REPLACE_WITH_CONSENSUS_PUBLIC_KEY/${CONSENSUS_PUBLIC_KEY}/g; \ + s/REPLACE_WITH_CONSENSUS_PRIVATE_KEY/${CONSENSUS_PRIVATE_KEY}/g; \ + s|REPLACE_WITH_WATCHER_PARTY_PEERS_FILE|${WATCHER_PARTY_PEERS_FILE}|g; \ + s|REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT|${CERC_L2_GETH_RPC}| ") + +# Write the modified content to a new file +echo "$WATCHER_CONFIG" > environments/local.toml + +echo 'yarn server' +yarn server diff --git a/app/data/config/watcher-mobymask-v3/watcher-config-rates.toml b/app/data/config/watcher-mobymask-v3/watcher-config-rates.toml new file mode 100644 index 00000000..ebb8f8a1 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/watcher-config-rates.toml @@ -0,0 +1,14 @@ +freeQueriesLimit = 10 + +freeQueriesList = [] + +[queries] + multiNonce = '50' + _owner = '50' + isRevoked = '50' + isPhisher = '50' + isMember = '50' + +[mutations] + invoke = '100' + revoke = '100' diff --git a/app/data/config/watcher-mobymask-v3/watcher-config-template.toml b/app/data/config/watcher-mobymask-v3/watcher-config-template.toml new file mode 100644 index 00000000..dbf5b407 --- /dev/null +++ b/app/data/config/watcher-mobymask-v3/watcher-config-template.toml @@ -0,0 +1,103 @@ +[server] + host = "0.0.0.0" + port = 3001 + kind = "lazy" + + # Checkpointing state. + checkpointing = true + + # Checkpoint interval in number of blocks. + checkpointInterval = 2000 + + # Enable state creation + enableState = true + + # Boolean to filter logs by contract. + filterLogs = true + + # Max block range for which to return events in eventsInRange GQL query. + # Use -1 for skipping check on block range. + maxEventsBlockRange = -1 + + [server.p2p] + enableRelay = true + enablePeer = true + + [server.p2p.relay] + host = "0.0.0.0" + port = 9090 + relayPeers = REPLACE_WITH_CERC_RELAY_PEERS + denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS + peerIdFile = './peers/relay-id.json' + announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN' + pubsub = 'REPLACE_WITH_CERC_PUBSUB' + enableDebugInfo = true + + [server.p2p.peer] + relayMultiaddr = 'REPLACE_WITH_CERC_RELAY_MULTIADDR' + pubSubTopic = 'mobymask' + denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS + peerIdFile = 'REPLACE_WITH_PEER_ID_FILE' + pubsub = 'REPLACE_WITH_CERC_PUBSUB' + enableDebugInfo = true + enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS + + [server.p2p.peer.l2TxsConfig] + privateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER' + contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS' + + [server.p2p.nitro] + store = './out/nitro-db' + privateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_NITRO' + chainPrivateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER' + + [server.p2p.nitro.payments] + ratesFile = './environments/rates.toml' + requestTimeoutInSecs = 10 + + [server.p2p.nitro.payments.cache] + maxAccounts = 1000 + accountTTLInSecs = 1800 + maxVouchersPerAccount = 1000 + voucherTTLInSecs = 300 + maxPaymentChannels = 10000 + paymentChannelTTLInSecs = 1800 + + [server.p2p.consensus] + enabled = REPLACE_WITH_CONSENSUS_ENABLED + publicKey = 'REPLACE_WITH_CONSENSUS_PUBLIC_KEY' + privateKey = 'REPLACE_WITH_CONSENSUS_PRIVATE_KEY' + watcherPartyFile = 'REPLACE_WITH_WATCHER_PARTY_PEERS_FILE' + +[metrics] + host = "0.0.0.0" + port = 9000 + [metrics.gql] + port = 9001 + +[database] + type = "postgres" + host = "mobymask-watcher-db" + port = 5432 + database = "mobymask-watcher" + username = "vdbm" + password = "password" + synchronize = true + logging = false + +[upstream] + [upstream.ethServer] + gqlApiEndpoint = "http://ipld-eth-server:8083/graphql" + rpcProviderEndpoint = "REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT" + blockDelayInMilliSecs = 60000 + + [upstream.cache] + name = "requests" + enabled = false + deleteOnStart = false + +[jobQueue] + dbConnectionString = "postgres://vdbm:password@mobymask-watcher-db/mobymask-watcher-job-queue" + maxCompletionLagInSecs = 300 + jobDelayInMilliSecs = 100 + eventsInBatch = 50 diff --git a/app/data/container-build/cerc-mobymask-ui/Dockerfile b/app/data/container-build/cerc-mobymask-ui/Dockerfile index 56e72a7a..e00ac663 100644 --- a/app/data/container-build/cerc-mobymask-ui/Dockerfile +++ b/app/data/container-build/cerc-mobymask-ui/Dockerfile @@ -1,6 +1,6 @@ # Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile # [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster -ARG VARIANT=16-bullseye +ARG VARIANT=18-bullseye FROM node:${VARIANT} ARG USERNAME=node @@ -37,7 +37,7 @@ RUN yarn global add http-server WORKDIR /app COPY . . -RUN npm install +RUN yarn install # Expose port for http EXPOSE 80 diff --git a/app/data/container-build/cerc-watcher-mobymask-v3/Dockerfile b/app/data/container-build/cerc-watcher-mobymask-v3/Dockerfile new file mode 100644 index 00000000..3e07eec9 --- /dev/null +++ b/app/data/container-build/cerc-watcher-mobymask-v3/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:22.04 + +RUN apt-get update \ + && apt-get install -y curl wget gnupg build-essential \ + && curl --silent --location https://deb.nodesource.com/setup_18.x | bash - \ + && apt-get update \ + && apt-get install -y nodejs git busybox jq \ + && node -v + +RUN corepack enable \ + && yarn --version + +WORKDIR /app + +COPY . . + +RUN echo "Building mobymask-v2-watcher-ts" && \ + yarn && yarn build + +WORKDIR /app diff --git a/app/data/container-build/cerc-watcher-mobymask-v3/build.sh b/app/data/container-build/cerc-watcher-mobymask-v3/build.sh new file mode 100755 index 00000000..1c26a4ce --- /dev/null +++ b/app/data/container-build/cerc-watcher-mobymask-v3/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Build cerc/watcher-mobymask-v3 + +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh + +# See: https://stackoverflow.com/a/246128/1701505 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build -t cerc/watcher-mobymask-v3:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/mobymask-v2-watcher-ts diff --git a/app/data/container-image-list.txt b/app/data/container-image-list.txt index 9ed473ba..ab8bc3ce 100644 --- a/app/data/container-image-list.txt +++ b/app/data/container-image-list.txt @@ -50,3 +50,4 @@ cerc/watcher-sushiswap cerc/graph-node cerc/sushiswap-subgraphs cerc/webapp-base +cerc/watcher-mobymask-v3 diff --git a/app/data/pod-list.txt b/app/data/pod-list.txt index d375fd8e..ee3fc53b 100644 --- a/app/data/pod-list.txt +++ b/app/data/pod-list.txt @@ -35,3 +35,5 @@ contract-sushiswap graph-node sushiswap-subgraph-v3 fixturenet-sushiswap-subgraph-v3 +watcher-mobymask-v3 +mobymask-app-v3 diff --git a/app/data/stacks/mobymask-v3/README.md b/app/data/stacks/mobymask-v3/README.md new file mode 100644 index 00000000..6ea57af5 --- /dev/null +++ b/app/data/stacks/mobymask-v3/README.md @@ -0,0 +1,6 @@ +# MobyMask v3 + +Instructions to setup and deploy MobyMask v3 stack (watcher + web-app) using [laconic-stack-orchestrator](/README.md#install) + +* Follow [watcher.md](./watcher.md) for deploying the watcher +* Follow [web-app.md](./web-app.md) for deploying the app diff --git a/app/data/stacks/mobymask-v3/stack.yml b/app/data/stacks/mobymask-v3/stack.yml new file mode 100644 index 00000000..85af73ac --- /dev/null +++ b/app/data/stacks/mobymask-v3/stack.yml @@ -0,0 +1,16 @@ +version: "1.0" +description: "MobyMask v3 stack" +name: mobymask-v3 +repos: + - github.com/cerc-io/watcher-ts@v0.2.57 + - github.com/cerc-io/mobymask-v2-watcher-ts@v3 + - github.com/cerc-io/MobyMask@v0.1.3 + - github.com/cerc-io/mobymask-ui +containers: + - cerc/watcher-ts + - cerc/watcher-mobymask-v3 + - cerc/mobymask + - cerc/mobymask-ui +pods: + - watcher-mobymask-v3 + - mobymask-app-v3 diff --git a/app/data/stacks/mobymask-v3/watcher.md b/app/data/stacks/mobymask-v3/watcher.md new file mode 100644 index 00000000..9063b022 --- /dev/null +++ b/app/data/stacks/mobymask-v3/watcher.md @@ -0,0 +1,135 @@ +# MobyMask v3 Watcher + +## Setup + +Prerequisite: L2 Optimism Geth and Node RPC endpoints + +Clone required repositories: + +```bash +laconic-so --stack mobymask-v3 setup-repositories --pull --exclude github.com/cerc-io/mobymask-ui +``` + +Build the container images: + +```bash +laconic-so --stack mobymask-v3 build-containers --exclude cerc/mobymask-ui +``` + +## Deploy + +### Configuration + +Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v3/mobymask-params.env)): + + ```bash + # External L2 endpoints + CERC_L2_GETH_RPC= + + # Endpoints waited on before contract deployment + CERC_L2_GETH_HOST= + CERC_L2_GETH_PORT= + + CERC_L2_NODE_HOST= + CERC_L2_NODE_PORT= + + # URL (fixturenet-eth-bootnode-lighthouse) to get CSV with credentials for accounts on L1 to perform txs on L2 + CERC_L1_ACCOUNTS_CSV_URL= + + # OR + # Specify the required account credentials + CERC_PRIVATE_KEY_DEPLOYER= + + # Base URI for mobymask-app + # (used for generating a root invite link after deploying the contract) + CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#" + + # (Optional) Domain to be used in the relay node's announce address + CERC_RELAY_ANNOUNCE_DOMAIN= + + # (Optional) Set of relay peers to connect to from the relay node + CERC_RELAY_PEERS=[] + + # (Optional) Set of multiaddrs to be avoided while dialling + CERC_DENY_MULTIADDRS=[] + + # (Optional) Type of pubsub to be used + CERC_PUBSUB="" + + # Set to false for disabling watcher peer to send txs to L2 + CERC_ENABLE_PEER_L2_TXS=true + + # (Optional) Set already deployed MobyMask contract address to avoid deploying contract in the stack + CERC_DEPLOYED_CONTRACT= + + # (Optional) Set already deployed Nitro addresses to avoid deploying them in the stack + CERC_NA_ADDRESS= + CERC_VPA_ADDRESS= + CERC_CA_ADDRESS= + + # Specify private key of a funded account for sending txs to L2 + CERC_PRIVATE_KEY_PEER= + + # Specify private key for the Nitro account + CERC_PRIVATE_KEY_NITRO= + + # (Optional) Set a pre-existing peer id to be used (enables consensus) + # Uses a generated peer id if not set (disables consensus) + CERC_PEER_ID= + ``` + +* NOTE: If Optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host port + +### Deploy the stack + +```bash +laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include watcher-mobymask-v3 --env-file up +``` + +* To list down and monitor the running containers: + + ```bash + laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include watcher-mobymask-v3 ps + + # With status + docker ps -a + + # Check logs for a container + docker logs -f + ``` + +* The watcher endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090` + +* Check the logs of the MobyMask contract deployment container to get the deployed contract's address and generated root invite link: + + ```bash + docker logs -f $(docker ps -aq --filter name="mobymask-1") + ``` + +* Check the logs of the watcher server container to get the deployed Nitro contracts' addresses: + +```bash +docker exec -it $(docker ps -q --filter name="mobymask-watcher-server") bash -c "cat /nitro/nitro-addresses.json" +``` + +## Clean up + +Stop all services running in the background: + +```bash +laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include watcher-mobymask-v3 down +``` + +Clear volumes created by this stack: + +```bash +# List all relevant volumes +docker volume ls -q --filter "name=mobymask_v3" + +# Remove all the listed volumes +docker volume rm $(docker volume ls -q --filter "name=mobymask_v3") + +# WARNING: To avoid changing peer ids for the watcher, `peers_ids` volume can be persisted +# To delete all volumes except for `peers_ids` +docker volume rm $(docker volume ls -q --filter "name=mobymask_v3" | grep -v "peers_ids$") +``` diff --git a/app/data/stacks/mobymask-v3/web-app.md b/app/data/stacks/mobymask-v3/web-app.md new file mode 100644 index 00000000..d0efee81 --- /dev/null +++ b/app/data/stacks/mobymask-v3/web-app.md @@ -0,0 +1,86 @@ +# MobyMask v3 App + +## Setup + +Prerequisite: Watcher with GQL and relay node endpoints + +Clone required repositories: + +```bash +laconic-so --stack mobymask-v3 setup-repositories --pull --include github.com/cerc-io/mobymask-ui +``` + +Build the container images: + +```bash +laconic-so --stack mobymask-v3 build-containers --include cerc/mobymask-ui +``` + +## Deploy + +### Configuration + +Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v3/mobymask-params.env)): + + ```bash + # Set of relay nodes to be used by the web-app + # (use double quotes " for strings, avoid space after commas) + # Eg. CERC_RELAY_NODES=["/dns4/example.com/tcp/443/wss/p2p/12D3KooWGHmDDCc93XUWL16FMcTPCGu2zFaMkf67k8HZ4gdQbRDr"] + CERC_RELAY_NODES=[] + + # Set of multiaddrs to be avoided while dialling + CERC_DENY_MULTIADDRS=[] + + # Also add if running MobyMask app: + + # Watcher endpoint used by the app for GQL queries + CERC_APP_WATCHER_URL="http://127.0.0.1:3001" + + # Set deployed MobyMask contract address to be used in MobyMask app's config + CERC_DEPLOYED_CONTRACT= + + # L2 Chain ID used by mobymask web-app for L2 txs + CERC_CHAIN_ID=42069 + + # (Optional) Type of pubsub to be used ("floodsub" | "gossipsub") + CERC_PUBSUB="" + + # Set Nitro addresses + CERC_NA_ADDRESS= + CERC_VPA_ADDRESS= + CERC_CA_ADDRESS= + + # Nitro account address to make the query and mutation payments to + CERC_PAYMENT_NITRO_ADDRESS= + + # Endpoint for Mobymask snap installation + CERC_SNAP_URL= + ``` + +### Deploy the stack + +```bash +laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include mobymask-app-v3 --env-file up + +# Runs the MobyMask v3 app on host port 3004 +``` + +To list down and monitor the running containers: + +```bash +laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include mobymask-app-v3 ps + +# With status +docker ps -a + +# Check logs for a container +docker logs -f +``` + +## Clean up + +Stop all services running in the background: + +```bash +laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include mobymask-app-v3 down +``` -- 2.45.2 From 2425aa8556e5fdef1b031a2c28d807b8ab04353f Mon Sep 17 00:00:00 2001 From: Zach Date: Wed, 20 Sep 2023 10:31:14 -0400 Subject: [PATCH 8/9] fix readme (#519) --- .../stacks/fixturenet-laconic-loaded/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/data/stacks/fixturenet-laconic-loaded/README.md b/app/data/stacks/fixturenet-laconic-loaded/README.md index b94189c2..c82e48ad 100644 --- a/app/data/stacks/fixturenet-laconic-loaded/README.md +++ b/app/data/stacks/fixturenet-laconic-loaded/README.md @@ -4,6 +4,8 @@ Testing a "Loaded" fixturenet with console. Instructions for deploying a local Laconic blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator. +**Note:** For building some NPMs, access to the @lirewine repositories is required. If you don't have access, see [this tutorial](/docs/laconicd-fixturenet.md) to run this stack + ## 1. Install Laconic Stack Orchestrator Installation is covered in detail [here](https://github.com/cerc-io/stack-orchestrator#user-mode) but if you're on Linux and already have docker installed it should be as simple as: ``` @@ -30,24 +32,24 @@ $ export CERC_NPM_AUTH_TOKEN= ## 3. Clone required repositories ``` -$ laconic-so --stack fixturenet-laconicd setup-repositories +$ laconic-so --stack fixturenet-laconic-loaded setup-repositories ``` ## 4. Build the stack's packages and containers ``` -$ laconic-so --stack fixturenet-laconicd build-npms -$ laconic-so --stack fixturenet-laconicd build-containers +$ laconic-so --stack fixturenet-laconic-loaded build-npms +$ laconic-so --stack fixturenet-laconic-loaded build-containers ``` ## 5. Deploy the stack ``` -$ laconic-so --stack fixturenet-laconicd deploy up +$ laconic-so --stack fixturenet-laconic-loaded deploy up ``` Correct operation should be verified by checking the laconicd container's logs with: ``` -$ laconic-so --stack fixturenet-laconicd deploy logs +$ laconic-so --stack fixturenet-laconic-loaded deploy logs ``` ## 6. Test with the Registry CLI ``` -$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status" +$ laconic-so --stack fixturenet-laconic-loaded deploy exec cli "laconic cns status" ``` ## 7. View the laconic console Get the URL for the console web app with this command (the port number will be different for each deployment): -- 2.45.2 From c538c18a95352fa227f021fa3ddcd2a72d3574c7 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 20 Sep 2023 22:46:58 +0800 Subject: [PATCH 9/9] plugeth fix - forward CERC_RUN_STATEDIFF --- app/data/compose/docker-compose-fixturenet-plugeth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/compose/docker-compose-fixturenet-plugeth.yml b/app/data/compose/docker-compose-fixturenet-plugeth.yml index 598b25ea..f31ef559 100644 --- a/app/data/compose/docker-compose-fixturenet-plugeth.yml +++ b/app/data/compose/docker-compose-fixturenet-plugeth.yml @@ -20,7 +20,7 @@ services: - SYS_PTRACE environment: CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true} - CERC_RUN_STATEDIFF: "detect" + CERC_RUN_STATEDIFF: ${CERC_RUN_STATEDIFF:-detect} CERC_STATEDIFF_DB_NODE_ID: 1 CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} env_file: -- 2.45.2