support multiple local Witti nodes [skip ci]
This commit is contained in:
parent
421378b92d
commit
f5ec1bc5bb
10
Makefile
10
Makefile
|
@ -131,10 +131,10 @@ eth2_network_simulation: | build deps clean_eth2_network_simulation_files
|
|||
+ GIT_ROOT="$$PWD" NIMFLAGS="$(NIMFLAGS)" LOG_LEVEL="$(LOG_LEVEL)" tests/simulation/start.sh
|
||||
|
||||
clean-testnet0:
|
||||
rm -rf build/data/testnet0
|
||||
rm -rf build/data/testnet0*
|
||||
|
||||
clean-testnet1:
|
||||
rm -rf build/data/testnet1
|
||||
rm -rf build/data/testnet1*
|
||||
|
||||
# - we're getting the preset from a testnet-specific .env file
|
||||
# - try SCRIPT_PARAMS="--skipGoerliKey"
|
||||
|
@ -143,7 +143,7 @@ testnet0 testnet1: | build deps
|
|||
NIM_PARAMS="$(subst ",\",$(NIM_PARAMS))" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) --const-preset=$$CONST_PRESET --dev-build $@
|
||||
|
||||
clean-schlesi:
|
||||
rm -rf build/data/shared_schlesi
|
||||
rm -rf build/data/shared_schlesi*
|
||||
|
||||
schlesi: | build deps
|
||||
NIM_PARAMS="$(subst ",\",$(NIM_PARAMS))" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/schlesi
|
||||
|
@ -152,7 +152,7 @@ schlesi-dev: | build deps
|
|||
NIM_PARAMS="$(subst ",\",$(NIM_PARAMS))" LOG_LEVEL="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/schlesi
|
||||
|
||||
clean-witti:
|
||||
rm -rf build/data/shared_witti
|
||||
rm -rf build/data/shared_witti*
|
||||
|
||||
witti: | build deps
|
||||
NIM_PARAMS="$(subst ",\",$(NIM_PARAMS))" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/witti
|
||||
|
@ -161,7 +161,7 @@ witti-dev: | build deps
|
|||
NIM_PARAMS="$(subst ",\",$(NIM_PARAMS))" LOG_LEVEL="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/witti
|
||||
|
||||
clean: | clean-common
|
||||
rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_testnet*,block_sim,state_sim,transition*}
|
||||
rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_*,block_sim,state_sim,transition*}
|
||||
ifneq ($(USE_LIBBACKTRACE), 0)
|
||||
+ $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
|
||||
endif
|
||||
|
|
17
README.md
17
README.md
|
@ -113,6 +113,20 @@ make witti # This will build Nimbus and all other dependencies
|
|||
# and connect you to Witti
|
||||
```
|
||||
|
||||
Sometimes, you may want to disable the interactive prompt asking you for a Goerli key in order to become a validator:
|
||||
|
||||
```bash
|
||||
make SCRIPT_PARAMS="--skipGoerliKey" witti # not a validator
|
||||
```
|
||||
|
||||
You can also start multiple local nodes, in different terminal windows/tabs, by specifying their numeric IDs:
|
||||
|
||||
```bash
|
||||
make SCRIPT_PARAMS="--nodeID=0" witti # the default
|
||||
make SCRIPT_PARAMS="--nodeID=1" witti
|
||||
make SCRIPT_PARAMS="--nodeID=2" witti
|
||||
```
|
||||
|
||||
### Getting metrics from a local testnet client
|
||||
|
||||
```bash
|
||||
|
@ -123,7 +137,8 @@ make NIMFLAGS="-d:insecure" witti
|
|||
You can now see the raw metrics on http://127.0.0.1:8008/metrics but they're not very useful like this, so let's feed them to a Prometheus instance:
|
||||
|
||||
```bash
|
||||
prometheus --config.file=build/data/shared_witti/prometheus.yml
|
||||
prometheus --config.file=build/data/shared_witti_0/prometheus.yml
|
||||
# when starting multiple nodes at the same time, just use the config file from the one with the highest ID
|
||||
```
|
||||
|
||||
For some pretty pictures, get [Grafana](https://grafana.com/) up and running, then import the dashboard definition in "grafana/beacon\_nodes\_Grafana\_dashboard.json".
|
||||
|
|
|
@ -34,6 +34,15 @@ cli do (skipGoerliKey {.
|
|||
desc: "Enables more extensive logging and debugging support"
|
||||
name: "dev-build" .} = false,
|
||||
|
||||
nodeID {.
|
||||
desc: "Node ID" .} = 0.int,
|
||||
|
||||
basePort {.
|
||||
desc: "Base TCP/UDP port (nodeID will be added to it)" .} = 9000.int,
|
||||
|
||||
baseMetricsPort {.
|
||||
desc: "Base metrics port (nodeID will be added to it)" .} = 8008.int,
|
||||
|
||||
testnetName {.argument .}: string):
|
||||
let
|
||||
nameParts = testnetName.split "/"
|
||||
|
@ -84,7 +93,7 @@ cli do (skipGoerliKey {.
|
|||
let
|
||||
dataDirName = testnetName.replace("/", "_")
|
||||
.replace("(", "_")
|
||||
.replace(")", "_")
|
||||
.replace(")", "_") & "_" & $nodeID
|
||||
dataDir = buildDir / "data" / dataDirName
|
||||
validatorsDir = dataDir / "validators"
|
||||
secretsDir = dataDir / "secrets"
|
||||
|
@ -123,7 +132,7 @@ cli do (skipGoerliKey {.
|
|||
mkDir dataDir
|
||||
|
||||
# macOS may not have gnu-getopts installed and in the PATH
|
||||
execIgnoringExitCode &"""./scripts/make_prometheus_config.sh --nodes 1 --base-metrics-port 8008 --config-file "{dataDir}/prometheus.yml""""
|
||||
execIgnoringExitCode &"""./scripts/make_prometheus_config.sh --nodes """ & $(1 + nodeID) & &""" --base-metrics-port {baseMetricsPort} --config-file "{dataDir}/prometheus.yml""""
|
||||
|
||||
exec &"""nim c {nimFlags} -d:"const_preset={preset}" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim"""
|
||||
|
||||
|
@ -159,7 +168,10 @@ cli do (skipGoerliKey {.
|
|||
--data-dir="{dataDir}"
|
||||
--dump
|
||||
--web3-url={web3Url}
|
||||
--tcp-port=""" & $(basePort + nodeID) & &"""
|
||||
--udp-port=""" & $(basePort + nodeID) & &"""
|
||||
--metrics
|
||||
--metrics-port=""" & $(baseMetricsPort + nodeID) & &"""
|
||||
{bootstrapFileOpt}
|
||||
{logLevelOpt}
|
||||
{depositContractOpt}
|
||||
|
|
Loading…
Reference in New Issue