Skip to content

Commit

Permalink
Switch to new Blox SSV network (#1459)
Browse files Browse the repository at this point in the history
* Switch to new Blox SSV network

* Fix ssv-config.yaml

* Fix SSV Dashboard jq

* Support legacy along jato v2 SSV

* Create legacy SSV conf file on start

* Rename role to ssv
  • Loading branch information
yorickdowne authored Aug 8, 2023
1 parent 7ac9773 commit a09adba
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ext-network.yml.original
*.swp
alertmanager/config.yml
prometheus/custom-prom.yml
ssv-config.yaml
ssv-config.yaml.bak
blox-ssv-config.yaml
blox-ssv-config.yaml.bak
promtail/custom-lokiurl.yml
2 changes: 2 additions & 0 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ MEV_NODE=http://mev-boost:18550
# The default source build targets build from the latest github tag

# SSV
SSV_NODE_TAG=latest
# Legacy
SSV2_NODE_TAG=latest

# MEV-Boost
Expand Down
91 changes: 80 additions & 11 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,19 @@ upgrade_compose() {
fi
}

prep_prometheus() {
prep_conffiles() {
# Create custom-prom.yml if it doesn't exist
if [ ! -f "./prometheus/custom-prom.yml" ]; then
${__as_owner} touch "./prometheus/custom-prom.yml"
fi
# Create ssv-config.yml if it doesn't exist
if [ ! -f "./ssv-config.yaml" ]; then
${__as_owner} cp ./ssv-config-sample.yaml ./ssv-config.yaml
fi
# Create blox-ssv-config.yml if it doesn't exist
if [ ! -f "./blox-ssv-config.yaml" ]; then
${__as_owner} cp ./blox-ssv-config-sample.yaml ./blox-ssv-config.yaml
fi
}

handle_root() {
Expand Down Expand Up @@ -671,7 +679,7 @@ envmigrate() {
ERIGON_DOCKERFILE MEV_DOCKERFILE MEV_DOCKER_TAG NIMEL_SRC_BUILD_TARGET NIMEL_DOCKER_TAG NIMEL_DOCKERFILE \
LS_SRC_BUILD_TARGET LS_DOCKER_TAG LS_DOCKERFILE GETH_SRC_BUILD_TARGET GETH_DOCKER_TAG TRAEFIK_TAG DDNS_TAG \
GETH_DOCKERFILE NM_SRC_BUILD_TARGET NM_DOCKER_TAG NM_DOCKERFILE BESU_SRC_BUILD_TARGET \
BESU_DOCKER_TAG BESU_DOCKERFILE SSV2_NODE_TAG DEPCLI_SRC_BUILD_TARGET DEPCLI_DOCKER_TAG W3S_DOCKER_TAG \
BESU_DOCKER_TAG BESU_DOCKERFILE SSV_NODE_TAG SSV2_NODE_TAG DEPCLI_SRC_BUILD_TARGET DEPCLI_DOCKER_TAG W3S_DOCKER_TAG \
PG_DOCKER_TAG RETH_SRC_BUILD_TARGET RETH_DOCKER_TAG RETH_DOCKERFILE NODE_EXPORTER_IGNORE_MOUNT_REGEX )
OLD_VARS=( LH_PORT PRYSM_WEB_PORT EC_NODE REWARDS_TO GETH_CACHE CF_API_TOKEN \
EC_HOST EC_LB EC_WS_HOST EC_WS_LB CC_HOST CC_LB EC_P2P_PORT CC_NODE CC_P2P_PORT EC_RPC_PORT EC_WS_PORT )
Expand All @@ -693,6 +701,15 @@ envmigrate() {
else
__pre_merge=0
fi

var="COMPOSE_FILE"
value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" ".env" || true)
# Literal match intended
# shellcheck disable=SC2076
if [[ "${value}" =~ "blox-ssv2.yml" ]]; then
ssv_switch
fi

# Migrate over user settings
for var in "${ALL_VARS[@]}"; do
value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" ".env.source" || true)
Expand Down Expand Up @@ -796,8 +813,8 @@ envmigrate() {
migrate_compose_file() {
# When this gets called $var is COMPOSE_FILE and $value is what is set in .env for it
# Some files have been renamed and others removed altogether
FROM_YML=( ec-shared.yml ec-traefik.yml cc-shared.yml grafana-insecure.yml prysm-web-insecure.yml lh-base-notz.yml lh-validator-notz.yml lh-slasher.yml teku-base-notz.yml teku-validator-notz.yml lh-consensus.yml lh-validator.yml lodestar-consensus.yml lodestar-validator.yml nimbus-consensus.yml prysm-consensus.yml prysm-consensus-rest.yml prysm-validator.yml teku-consensus.yml teku-validator.yml lh-base.yml lh-vc-only.yml lh-cl-only.yml nm.yml lighthouse-base.yml teku-base.yml nimbus-base.yml prysm-base.yml lodestar-base.yml traefik-cf-v6.yml prysm-web.yml blank-grafana.yml lh-grafana.yml lhcc-grafana.yml nimbus-grafana.yml prysm-grafana.yml teku-grafana.yml geth-grafana.yml erigon-grafana.yml oe.yml teku-stats.yml lh-stats.yml lh-stats-consensus.yml lh-stats-validator.yml traefik-shared.yml lighthouse-slasher.yml prysm-slasher.yml )
TO_YML=( el-shared.yml el-traefik.yml cl-shared.yml grafana-shared.yml prysm-web-shared.yml lighthouse-base.yml lighthouse-vc-only.yml lighthouse-slasher.yml teku-base.yml teku-vc-only.yml lighthouse-cl-only.yml lighthouse-vc-only.yml lodestar-cl-only.yml lodestar-vc-only.yml nimbus-cl-only.yml prysm-cl-only.yml prysm-cl-only.yml prysm-vc-only.yml teku-cl-only.yml teku-vc-only.yml lighthouse-base.yml lighthouse-vc-only.yml lighthouse-cl-only.yml nethermind.yml lighthouse.yml teku.yml nimbus.yml prysm.yml lodestar.yml traefik-cf.yml "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" )
FROM_YML=( ec-shared.yml ec-traefik.yml cc-shared.yml grafana-insecure.yml prysm-web-insecure.yml lh-base-notz.yml lh-validator-notz.yml lh-slasher.yml teku-base-notz.yml teku-validator-notz.yml lh-consensus.yml lh-validator.yml lodestar-consensus.yml lodestar-validator.yml nimbus-consensus.yml prysm-consensus.yml prysm-consensus-rest.yml prysm-validator.yml teku-consensus.yml teku-validator.yml lh-base.yml lh-vc-only.yml lh-cl-only.yml nm.yml lighthouse-base.yml teku-base.yml nimbus-base.yml prysm-base.yml lodestar-base.yml traefik-cf-v6.yml blox-ssv2.yml prysm-web.yml blank-grafana.yml lh-grafana.yml lhcc-grafana.yml nimbus-grafana.yml prysm-grafana.yml teku-grafana.yml geth-grafana.yml erigon-grafana.yml oe.yml teku-stats.yml lh-stats.yml lh-stats-consensus.yml lh-stats-validator.yml traefik-shared.yml lighthouse-slasher.yml prysm-slasher.yml )
TO_YML=( el-shared.yml el-traefik.yml cl-shared.yml grafana-shared.yml prysm-web-shared.yml lighthouse-base.yml lighthouse-vc-only.yml lighthouse-slasher.yml teku-base.yml teku-vc-only.yml lighthouse-cl-only.yml lighthouse-vc-only.yml lodestar-cl-only.yml lodestar-vc-only.yml nimbus-cl-only.yml prysm-cl-only.yml prysm-cl-only.yml prysm-vc-only.yml teku-cl-only.yml teku-vc-only.yml lighthouse-base.yml lighthouse-vc-only.yml lighthouse-cl-only.yml nethermind.yml lighthouse.yml teku.yml nimbus.yml prysm.yml lodestar.yml traefik-cf.yml blox-ssv2.yml "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" )

__old_grafana=0
__new_grafana=0
Expand Down Expand Up @@ -840,6 +857,45 @@ migrate_compose_file() {
fi
}

ssv_switch() {
echo "Detected legacy SSV Node. Not migrating, yet."
return
echo "Detected legacy SSV Node. Migrating config to new testnet."
echo
echo "Stopping SSV Node container"
docompose stop ssv2-node && docompose rm -f ssv2-node
docker volume rm "$(docker volume ls -q | grep "$(basename "$(realpath .)")"_ssv2-data)"
echo ""
echo "SSV Node stopped and database deleted."
echo ""
cp blox-ssv-config.yaml blox-ssv-config.yaml.bak
cp blox-ssv-config.yaml ssv-config.yaml
rm blox-ssv-config.yaml
echo "Backup copy blox-ssv-config.yaml.bak created"
echo "Making changes to ssv-config.yaml"
var="NETWORK"
value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" ".env" || true)
sed -i'' 's/blox-ssv2.yml/ssv.yml/' .env
if ! grep -q "LogFilePath:" ssv-config.yaml; then
sed -i'' '/Global:/a\\n LogFilePath: /tmp/ssv/debug.log' ssv-config.yaml
fi
if ! grep -q "MetricsAPIPort:" ssv-config.yaml; then
sed -i'' '$a\MetricsAPIPort: 15000' ssv-config.yaml
fi
if ! grep -q "ssv:" ssv-config.yaml; then
sed -i'' '$a\ssv:' ssv-config.yaml
if [ "${NETWORK}" = "goerli" ]; then
sed -i'' '$a\ Network: jato-v2' ssv-config.yaml
elif [ "${NETWORK}" = "mainnet" ]; then
sed -i'' '$a\ Network: mainnet' ssv-config.yaml
else
echo "${NETWORK} is not something that works with SSV. This needs to be fixed before running ./ethd update again"
echo "Aborting."
exit 1
fi
fi
}

delete_erigon() {
# Check for Erigon
var="COMPOSE_FILE"
Expand Down Expand Up @@ -1700,7 +1756,7 @@ query_deployment() {
"What kind of deployment do you want to run?" 12 80 5 \
"node" "Ethereum node - consensus, execution and validator client" \
"rocket" "Validator client only - integrate with RocketPool" \
"blox" "Blox SSV node - consensus, execution and ssv-node" \
"ssv" "SSV node - consensus, execution and ssv-node" \
"rpc" "Ethereum RPC node - consensus and execution client" 3>&1 1>&2 2>&3)
fi

Expand Down Expand Up @@ -2153,9 +2209,18 @@ config() {
"validator" | "rocket")
query_validator_client
;;
"blox")
if [ ! -f "./blox-ssv-config.yaml" ]; then
${__as_owner} cp ./blox-ssv-config-sample.yaml ./blox-ssv-config.yaml
"ssv")
if [ ! -f "./ssv-config.yaml" ]; then
${__as_owner} cp ./ssv-config-sample.yaml ./ssv-config.yaml
fi
if [ "${NETWORK}" = "goerli" ]; then
sed -i'' 's/ Network: .*/ Network: jato-v2/' ssv-config.yaml
elif [ "${NETWORK}" = "mainnet" ]; then
sed -i'' 's/ Network: .*/ Network: mainnet' ssv-config.yaml
else
echo "${NETWORK} is not something that works with SSV. This needs to be fixed when running ./ethd config again"
echo "Aborting."
exit 1
fi
query_consensus_only_client
;;
Expand Down Expand Up @@ -2198,8 +2263,8 @@ config() {
if [ -n "${EXECUTION_CLIENT+x}" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:${EXECUTION_CLIENT}"
fi
if [ "${__deployment}" = "blox" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:blox-ssv2.yml"
if [ "${__deployment}" = "ssv" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:ssv.yml"
fi
if [ -n "${GRAFANA_CLIENT+x}" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:${GRAFANA_CLIENT}"
Expand Down Expand Up @@ -2263,6 +2328,10 @@ version() {
value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" ".env" || true)
# Client versions
case "${value}" in
*ssv.yml* )
docompose exec ssv-node /go/bin/ssvnode --version
echo
;;&
*blox-ssv2.yml* )
docompose exec ssv2-node /go/bin/ssvnode --version
echo
Expand Down Expand Up @@ -2433,7 +2502,7 @@ shift

determine_distro
handle_root
prep_prometheus
prep_conffiles

# Don't check for docker before it's installed
if [ "$command" = "install" ]; then
Expand Down
13 changes: 11 additions & 2 deletions grafana/provision-dashboards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,17 @@ case "$CLIENT" in
wget -t 3 -T 10 -qcO - "${__url}" | jq 'walk(if . == "prometheus_ds" then "Prometheus" else . end)' >"${__file}"
# cp /tmp/nethermind_dashboard.json "${__file}"
;;&
*blox-ssv* )
# Blox SSV Operator Dashboard
*ssv.yml* )
# SSV Operator Dashboard
__url='https://raw.githubusercontent.com/bloxapp/ssv/main/monitoring/grafana/dashboard_ssv_operator_performance.json'
__file='/etc/grafana/provisioning/dashboards/ssv_operator_dashboard.json'
wget -t 3 -T 10 -qcO - "${__url}" | jq '.templating.list[0].current |= {selected: false, text: "ssv-node", value: "ssv-node"} | .templating.list[0].options = [ { "selected": true, "text": "ssv-node", "value": "ssv-node" } ] | .templating.list[0].query = "ssv-node"' >"${__file}"
__url='https://raw.githubusercontent.com/bloxapp/ssv/main/monitoring/grafana/dashboard_ssv_node.json'
__file='/etc/grafana/provisioning/dashboards/ssv_node_dashboard.json'
wget -t 3 -T 10 -qcO - "${__url}" | jq '.templating.list[0].current |= {selected: false, text: "ssv-node", value: "ssv-node"} | .templating.list[0].options = [ { "selected": true, "text": "ssv-node", "value": "ssv-node" } ] | .templating.list[0].query = "ssv-node"' >"${__file}"
;;&
*blox-ssv2.yml* )
# SSV Operator Dashboard
__url='https://raw.githubusercontent.com/bloxapp/ssv/main/monitoring/grafana/dashboard_ssv_operator_performance.json'
__file='/etc/grafana/provisioning/dashboards/ssv_operator_dashboard.json'
wget -t 3 -T 10 -qcO - "${__url}" | jq '.templating.list[0].current |= {selected: false, text: "ssv2-node", value: "ssv2-node"} | .templating.list[0].options = [ { "selected": true, "text": "ssv2-node", "value": "ssv2-node" } ] | .templating.list[0].query = "ssv2-node"' >"${__file}"
Expand Down
3 changes: 2 additions & 1 deletion prometheus/choose-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ case "$CLIENT" in
esac

case "$CLIENT" in
*blox-ssv2* ) cat /etc/prometheus/blox-ssv2-prom.yml >> /etc/prometheus/prometheus.yml ;;
*ssv.yml* ) cat /etc/prometheus/ssv-prom.yml >> /etc/prometheus/prometheus.yml ;;
*blox-ssv2.yml* ) cat /etc/prometheus/blox-ssv2-prom.yml >> /etc/prometheus/prometheus.yml ;;
esac

case "$CLIENT" in
Expand Down
10 changes: 10 additions & 0 deletions prometheus/ssv-prom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- job_name: ssv
metrics_path: /metrics
static_configs:
- targets:
- ssv-node:15000
- job_name: ssv_health
metrics_path: /health
static_configs:
- targets:
- ssv-node:15000
20 changes: 20 additions & 0 deletions ssv-config-sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
OperatorPrivateKey: YOURPRIVATEKEYHERE
ssv:
Network: jato-v2
p2p:
DiscoveryType: discv5
TcpPort: 13001
UdpPort: 12001
db:
Path: /tmp/ssv/db
Type: badger-db
eth2:
BeaconNodeAddr: http://consensus:5052
eth1:
ETH1Addr: ws://execution:8546
MetricsAPIPort: 15000
global:
LogFormat: json
LogLevelFormat: lowercase
LogLevel: info
LogFilePath: /tmp/ssv/debug.log
34 changes: 34 additions & 0 deletions ssv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.9"
x-logging: &logging
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}'

services:
ssv-node:
restart: "unless-stopped"
# image: bloxstaking/ssv-node:${SSV_NODE_TAG:-latest}
image: bloxstaking/ssv-node-unstable:${SSV_NODE_TAG:-latest}
user: 12000:12000
volumes:
- ./ssv-config.yaml:/config.yaml
- ssv-data:/tmp
- /etc/localtime:/etc/localtime:ro
ports:
- ${SSV_P2P_PORT}:${SSV_P2P_PORT}/tcp
- ${SSV_P2P_PORT_UDP}:${SSV_P2P_PORT_UDP}/udp
<<: *logging
environment:
- CONFIG_PATH=/config.yaml
- HOME=/tmp
command: make BUILD_PATH=/go/bin/ssvnode start-node
ssv-generate-keys:
profiles: ["tools"]
restart: "no"
image: bloxstaking/ssv-node:${SSV_NODE_TAG:-latest}
command: /go/bin/ssvnode generate-operator-keys
volumes:
ssv-data:

0 comments on commit a09adba

Please sign in to comment.