Skip to content

Commit

Permalink
Switch to new Blox SSV network
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Aug 3, 2023
1 parent d9b8e2b commit c954b33
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ ext-network.yml.original
*.swp
alertmanager/config.yml
prometheus/custom-prom.yml
blox-ssv-config.yaml
blox-ssv-config.yaml.bak
ssv-config.yaml
ssv-config.yaml.bak
promtail/custom-lokiurl.yml
2 changes: 1 addition & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ MEV_NODE=http://mev-boost:18550
# The default source build targets build from the latest github tag

# SSV
SSV2_NODE_TAG=latest
SSV_NODE_TAG=latest

# MEV-Boost
# If mev-boost terminates with a SIGILL, make this one of the "portable" tags
Expand Down
74 changes: 62 additions & 12 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ 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
}

handle_root() {
Expand Down Expand Up @@ -671,11 +675,11 @@ 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 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 \
OLD_VARS=( LH_PORT PRYSM_WEB_PORT EC_NODE REWARDS_TO GETH_CACHE CF_API_TOKEN SSV2_NODE_TAG \
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 )
NEW_VARS=( CL_P2P_PORT KEY_API_PORT EL_NODE FEE_RECIPIENT EL_EXTRAS CF_DNS_API_TOKEN \
NEW_VARS=( CL_P2P_PORT KEY_API_PORT EL_NODE FEE_RECIPIENT EL_EXTRAS CF_DNS_API_TOKEN SSV_NODE_TAG \
EL_HOST EL_LB EL_WS_HOST EL_WS_LB CL_HOST CL_LB EL_P2P_PORT CL_NODE CL_P2P_PORT EL_RPC_PORT EL_WS_PORT )

if [ "${EUID}" -eq 0 ]; then
Expand All @@ -693,6 +697,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
blox_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 +809,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 ssv.yml "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" )

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

blox_switch() {
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}" = "prater" ]; 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 @@ -2154,8 +2204,8 @@ config() {
query_validator_client
;;
"blox")
if [ ! -f "./blox-ssv-config.yaml" ]; then
${__as_owner} cp ./blox-ssv-config-sample.yaml ./blox-ssv-config.yaml
if [ ! -f "./ssv-config.yaml" ]; then
${__as_owner} cp ./ssv-config-sample.yaml ./ssv-config.yaml
fi
query_consensus_only_client
;;
Expand Down Expand Up @@ -2199,7 +2249,7 @@ config() {
COMPOSE_FILE="${COMPOSE_FILE}:${EXECUTION_CLIENT}"
fi
if [ "${__deployment}" = "blox" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:blox-ssv2.yml"
COMPOSE_FILE="${COMPOSE_FILE}:ssv.yml"
fi
if [ -n "${GRAFANA_CLIENT+x}" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:${GRAFANA_CLIENT}"
Expand Down Expand Up @@ -2263,8 +2313,8 @@ version() {
value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" ".env" || true)
# Client versions
case "${value}" in
*blox-ssv2.yml* )
docompose exec ssv2-node /go/bin/ssvnode --version
*ssv.yml* )
docompose exec ssv-node /go/bin/ssvnode --version
echo
;;&
*lighthouse.yml* | *lighthouse-cl-only* )
Expand Down Expand Up @@ -2433,7 +2483,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
8 changes: 4 additions & 4 deletions grafana/provision-dashboards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ case "$CLIENT" in
# wget -t 3 -T 10 -qcO - "${__url}" | jq '.templating.list[0].current |= (.selected = true) | (.isNone = true) | (.text = "None") | (.value = "") | del(.allValue, .label, .description, .error, .includeAll, .multi) | .templating.list[1] |= (.hide = 2) | (.query = "execution:6060") | (.type = "constant") | (.current |= del(.selected, .text, .value)) | del(.allValue, .label, .description, .error, .includeAll, .multi, .options, .datasource, .definition, .refresh, .regex, .sort, .tagValuesQuery, .tagsQuery, .useTags)' >"${__file}"
cp /tmp/nethermind_dashboard.json "${__file}"
;;&
*blox-ssv* )
# Blox SSV Operator Dashboard
*ssv* )
# SSV Operator Dashboard
__url='https://raw.githubusercontent.com/bloxapp/ssv/main/monitoring/grafana/dashboard_ssv_operator_performance.json'
__file='/etc/grafana/provisioning/dashboards/blox_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}"
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/blox_ssv_node_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}"
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}"
;;&
* )
# Home staking dashboard
Expand Down
2 changes: 1 addition & 1 deletion prometheus/choose-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ case "$CLIENT" in
esac

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

case "$CLIENT" in
Expand Down
4 changes: 2 additions & 2 deletions prometheus/blox-ssv2-prom.yml → prometheus/ssv-prom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
metrics_path: /metrics
static_configs:
- targets:
- ssv2-node:15000
- ssv-node:15000
- job_name: ssv_health
metrics_path: /health
static_configs:
- targets:
- ssv2-node:15000
- ssv-node:15000
12 changes: 7 additions & 5 deletions blox-ssv-config-sample.yaml → ssv-config-sample.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
db:
Path: /tmp/ssv-db
Type: badger-db
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
Network: prater
eth1:
ETH1Addr: ws://execution:8546
OperatorPrivateKey: YOURPRIVATEKEYHERE
MetricsAPIPort: 15000
global:
LogFormat: json
LogLevelFormat: lowercase
LogLevel: info
LogFilePath: /tmp/ssv/debug.log
12 changes: 6 additions & 6 deletions blox-ssv2.yml → ssv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ x-logging: &logging
tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}'

services:
ssv2-node:
ssv-node:
restart: "unless-stopped"
image: bloxstaking/ssv-node:${SSV2_NODE_TAG:-latest}
image: bloxstaking/ssv-node:${SSV_NODE_TAG:-latest}
user: 12000:12000
volumes:
- ./blox-ssv-config.yaml:/config.yaml
- ssv2-data:/tmp
- ./ssv-config.yaml:/config.yaml
- ssv-data:/tmp
- /etc/localtime:/etc/localtime:ro
ports:
- ${SSV_P2P_PORT}:${SSV_P2P_PORT}/tcp
Expand All @@ -27,7 +27,7 @@ services:
ssv-generate-keys:
profiles: ["tools"]
restart: "no"
image: bloxstaking/ssv-node:${SSV2_NODE_TAG:-latest}
image: bloxstaking/ssv-node:${SSV_NODE_TAG:-latest}
command: /go/bin/ssvnode generate-operator-keys
volumes:
ssv2-data:
ssv-data:

0 comments on commit c954b33

Please sign in to comment.