diff --git a/lighthouse-cl-only.yml b/lighthouse-cl-only.yml index e192412f..96b7f161 100644 --- a/lighthouse-cl-only.yml +++ b/lighthouse-cl-only.yml @@ -37,6 +37,7 @@ services: - ARCHIVE_NODE=${ARCHIVE_NODE:-false} - IPV6=${IPV6:-false} - CL_P2P_PORT=${CL_P2P_PORT:-9000} + - NETWORK=${NETWORK} ports: - ${HOST_IP:-}${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp - ${HOST_IP:-}${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp @@ -57,8 +58,6 @@ services: - 0.0.0.0 - --http-port - ${CL_REST_PORT:-5052} - - --network - - ${NETWORK} - --port - ${CL_P2P_PORT:-9000} - --target-peers diff --git a/lighthouse-vc-only.yml b/lighthouse-vc-only.yml index 86db8431..4bf7c6fb 100644 --- a/lighthouse-vc-only.yml +++ b/lighthouse-vc-only.yml @@ -29,6 +29,7 @@ services: - VC_EXTRAS=${VC_EXTRAS:-} - GRAFFITI=${GRAFFITI:-} - DEFAULT_GRAFFITI=${DEFAULT_GRAFFITI:-false} + - NETWORK=${NETWORK} volumes: - lhvalidator-data:/var/lib/lighthouse - /etc/localtime:/etc/localtime:ro @@ -45,8 +46,6 @@ services: - /var/lib/lighthouse - --beacon-nodes - ${CL_NODE:-http://consensus:5052} - - --network - - ${NETWORK} - --debug-level=${LOG_LEVEL} - --metrics - --metrics-address diff --git a/lighthouse.yml b/lighthouse.yml index d3d44748..011d6c6b 100644 --- a/lighthouse.yml +++ b/lighthouse.yml @@ -38,6 +38,7 @@ services: - ARCHIVE_NODE=${ARCHIVE_NODE:-false} - IPV6=${IPV6:-false} - CL_P2P_PORT=${CL_P2P_PORT:-9000} + - NETWORK=${NETWORK} ports: - ${HOST_IP:-}${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp - ${HOST_IP:-}${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp @@ -58,8 +59,6 @@ services: - 0.0.0.0 - --http-port - ${CL_REST_PORT:-5052} - - --network - - ${NETWORK} - --listen-address - 0.0.0.0 - --port @@ -94,6 +93,7 @@ services: - VC_EXTRAS=${VC_EXTRAS:-} - GRAFFITI=${GRAFFITI:-} - DEFAULT_GRAFFITI=${DEFAULT_GRAFFITI:-false} + - NETWORK=${NETWORK} volumes: - lhvalidator-data:/var/lib/lighthouse - /etc/localtime:/etc/localtime:ro @@ -110,8 +110,6 @@ services: - /var/lib/lighthouse - --beacon-nodes - ${CL_NODE:-http://consensus:5052} - - --network - - ${NETWORK} - --debug-level=${LOG_LEVEL} - --metrics - --metrics-address diff --git a/lighthouse/Dockerfile.binary b/lighthouse/Dockerfile.binary index 04d00e33..2868e076 100644 --- a/lighthouse/Dockerfile.binary +++ b/lighthouse/Dockerfile.binary @@ -43,7 +43,7 @@ RUN mkdir -p /var/lib/lighthouse/validators && chown ${USER}:${USER} /var/lib/li RUN set -eux; \ apt-get update; \ - DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y gosu ca-certificates tzdata; \ + DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y gosu ca-certificates tzdata git; \ rm -rf /var/lib/apt/lists/*; \ # verify that the binary works gosu nobody true diff --git a/lighthouse/Dockerfile.source b/lighthouse/Dockerfile.source index c223a634..e439f4fe 100644 --- a/lighthouse/Dockerfile.source +++ b/lighthouse/Dockerfile.source @@ -36,6 +36,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install ca-certificates \ wget \ tzdata \ + git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/lighthouse/docker-entrypoint-vc.sh b/lighthouse/docker-entrypoint-vc.sh index 36ea622a..e97ae5ca 100755 --- a/lighthouse/docker-entrypoint-vc.sh +++ b/lighthouse/docker-entrypoint-vc.sh @@ -6,6 +6,29 @@ if [ "$(id -u)" = '0' ]; then exec gosu lhvalidator docker-entrypoint.sh "$@" fi +if [[ "${NETWORK}" =~ ^https?:// ]]; then + echo "Custom testnet at ${NETWORK}" + repo=$(awk -F'/tree/' '{print $1}' <<< "${NETWORK}") + branch=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f1) + config_dir=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f2-) + echo "This appears to be the ${repo} repo, branch ${branch} and config directory ${config_dir}." + # For want of something more amazing, let's just fail if git fails to pull this + set -e + if [ ! -d "/var/lib/lighthouse/validators/testnet/${config_dir}" ]; then + mkdir -p /var/lib/lighthouse/validators/testnet + cd /var/lib/lighthouse/validators/testnet + git init --initial-branch="${branch}" + git remote add origin "${repo}" + git config core.sparseCheckout true + echo "${config_dir}" > .git/info/sparse-checkout + git pull origin "${branch}" + fi + set +e + __network="--testnet-dir=/var/lib/lighthouse/validators/testnet/${config_dir}" +else + __network="--network=${NETWORK}" +fi + # Check whether we should use MEV Boost if [ "${MEV_BOOST}" = "true" ]; then __mev_boost="--builder-proposals" @@ -32,9 +55,9 @@ fi if [ "${DEFAULT_GRAFFITI}" = "true" ]; then # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 - exec "$@" ${__mev_boost} ${__beacon_stats} ${__doppel} ${VC_EXTRAS} + exec "$@" ${__network} ${__mev_boost} ${__beacon_stats} ${__doppel} ${VC_EXTRAS} else # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 - exec "$@" "--graffiti" "${GRAFFITI}" ${__mev_boost} ${__beacon_stats} ${__doppel} ${VC_EXTRAS} + exec "$@" ${__network} "--graffiti" "${GRAFFITI}" ${__mev_boost} ${__beacon_stats} ${__doppel} ${VC_EXTRAS} fi diff --git a/lighthouse/docker-entrypoint.sh b/lighthouse/docker-entrypoint.sh index fd73915a..a8a7ac46 100755 --- a/lighthouse/docker-entrypoint.sh +++ b/lighthouse/docker-entrypoint.sh @@ -19,6 +19,31 @@ if [[ -O "/var/lib/lighthouse/ee-secret/jwtsecret" ]]; then chmod 666 /var/lib/lighthouse/beacon/ee-secret/jwtsecret fi +if [[ "${NETWORK}" =~ ^https?:// ]]; then + echo "Custom testnet at ${NETWORK}" + repo=$(awk -F'/tree/' '{print $1}' <<< "${NETWORK}") + branch=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f1) + config_dir=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f2-) + echo "This appears to be the ${repo} repo, branch ${branch} and config directory ${config_dir}." + # For want of something more amazing, let's just fail if git fails to pull this + set -e + if [ ! -d "/var/lib/lighthouse/beacon/testnet/${config_dir}" ]; then + mkdir -p /var/lib/lighthouse/beacon/testnet + cd /var/lib/lighthouse/beacon/testnet + git init --initial-branch="${branch}" + git remote add origin "${repo}" + git config core.sparseCheckout true + echo "${config_dir}" > .git/info/sparse-checkout + git pull origin "${branch}" + fi + bootnodes="$(paste -s -d, "/var/lib/lighthouse/beacon/testnet/${config_dir}/bootstrap_nodes.txt")" + set +e + __network="--testnet-dir=/var/lib/lighthouse/beacon/testnet/${config_dir} --boot-nodes=${bootnodes} \ +--self-limiter=blob_sidecars_by_range:256/10" +else + __network="--network=${NETWORK}" +fi + # Check whether we should rapid sync if [ -n "${RAPID_SYNC_URL}" ]; then __rapid_sync="--checkpoint-sync-url=${RAPID_SYNC_URL}" @@ -58,4 +83,4 @@ fi # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 -exec "$@" ${__mev_boost} ${__rapid_sync} ${__prune} ${__beacon_stats} ${__ipv6} ${CL_EXTRAS} +exec "$@" ${__network} ${__mev_boost} ${__rapid_sync} ${__prune} ${__beacon_stats} ${__ipv6} ${CL_EXTRAS} diff --git a/lodestar.yml b/lodestar.yml index 0c191860..53323890 100644 --- a/lodestar.yml +++ b/lodestar.yml @@ -87,6 +87,7 @@ services: - GRAFFITI=${GRAFFITI:-} - DEFAULT_GRAFFITI=${DEFAULT_GRAFFITI:-false} - WEB3SIGNER=${WEB3SIGNER} + - NETWORK=${NETWORK} volumes: - lsvalidator-data:/var/lib/lodestar/validators - /etc/localtime:/etc/localtime:ro @@ -120,8 +121,6 @@ services: - 0.0.0.0 - --logLevel - ${LOG_LEVEL} - - --network - - ${NETWORK} - --suggestedFeeRecipient - ${FEE_RECIPIENT} - --force diff --git a/lodestar/docker-entrypoint-vc.sh b/lodestar/docker-entrypoint-vc.sh index cb1ecf79..b204b340 100755 --- a/lodestar/docker-entrypoint-vc.sh +++ b/lodestar/docker-entrypoint-vc.sh @@ -6,6 +6,29 @@ if [ "$(id -u)" = '0' ]; then exec su-exec lsvalidator docker-entrypoint.sh "$@" fi +if [[ "${NETWORK}" =~ ^https?:// ]]; then + echo "Custom testnet at ${NETWORK}" + repo=$(awk -F'/tree/' '{print $1}' <<< "${NETWORK}") + branch=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f1) + config_dir=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f2-) + echo "This appears to be the ${repo} repo, branch ${branch} and config directory ${config_dir}." + # For want of something more amazing, let's just fail if git fails to pull this + set -e + if [ ! -d "/var/lib/lodestar/validators/testnet/${config_dir}" ]; then + mkdir -p /var/lib/lodestar/validators/testnet + cd /var/lib/lodestar/validators/testnet + git init --initial-branch="${branch}" + git remote add origin "${repo}" + git config core.sparseCheckout true + echo "${config_dir}" > .git/info/sparse-checkout + git pull origin "${branch}" + fi + set +e + __network="--paramsFile=/var/lib/lodestar/validators/testnet/${config_dir}/config.yaml" +else + __network="--network ${NETWORK}" +fi + # Check whether we should use MEV Boost if [ "${MEV_BOOST}" = "true" ]; then __mev_boost="--builder" @@ -40,9 +63,9 @@ fi if [ "${DEFAULT_GRAFFITI}" = "true" ]; then # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 - exec "$@" ${__mev_boost} ${__beacon_stats} ${__doppel} ${__w3s_url} ${VC_EXTRAS} + exec "$@" ${__network} ${__mev_boost} ${__beacon_stats} ${__doppel} ${__w3s_url} ${VC_EXTRAS} else # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 - exec "$@" "--graffiti" "${GRAFFITI}" ${__mev_boost} ${__beacon_stats} ${__doppel} ${__w3s_url} ${VC_EXTRAS} + exec "$@" ${__network} "--graffiti" "${GRAFFITI}" ${__mev_boost} ${__beacon_stats} ${__doppel} ${__w3s_url} ${VC_EXTRAS} fi diff --git a/teku-vc-only.yml b/teku-vc-only.yml index 1ee0d452..427e51c0 100644 --- a/teku-vc-only.yml +++ b/teku-vc-only.yml @@ -32,6 +32,7 @@ services: - GRAFFITI=${GRAFFITI:-} - DEFAULT_GRAFFITI=${DEFAULT_GRAFFITI:-false} - WEB3SIGNER=${WEB3SIGNER:-false} + - NETWORK=${NETWORK} networks: default: aliases: @@ -44,7 +45,6 @@ services: - --beacon-node-api-endpoints=${CL_NODE:-http://consensus:5052} - --data-path=/var/lib/teku - --log-destination=CONSOLE - - --network=${NETWORK} - --validator-keys=/var/lib/teku/validator-keys:/var/lib/teku/validator-passwords - --validators-early-attestations-enabled=false - --validator-api-enabled=true diff --git a/teku/docker-entrypoint-vc.sh b/teku/docker-entrypoint-vc.sh index 301c7cf4..d8e22af1 100755 --- a/teku/docker-entrypoint-vc.sh +++ b/teku/docker-entrypoint-vc.sh @@ -5,6 +5,29 @@ if [ "$(id -u)" = '0' ]; then exec gosu teku docker-entrypoint.sh "$@" fi +if [[ "${NETWORK}" =~ ^https?:// ]]; then + echo "Custom testnet at ${NETWORK}" + repo=$(awk -F'/tree/' '{print $1}' <<< "${NETWORK}") + branch=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f1) + config_dir=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f2-) + echo "This appears to be the ${repo} repo, branch ${branch} and config directory ${config_dir}." + # For want of something more amazing, let's just fail if git fails to pull this + set -e + if [ ! -d "/var/lib/teku/testnet/${config_dir}" ]; then + mkdir -p /var/lib/teku/testnet + cd /var/lib/teku/testnet + git init --initial-branch="${branch}" + git remote add origin "${repo}" + git config core.sparseCheckout true + echo "${config_dir}" > .git/info/sparse-checkout + git pull origin "${branch}" + fi + set +e + __network="--network=/var/lib/teku/testnet/${config_dir}/config.yaml" +else + __network="--network=${NETWORK}" +fi + if [ -f /var/lib/teku/teku-keyapi.keystore ]; then if [ "$(date +%s -r /var/lib/teku/teku-keyapi.keystore)" -lt "$(date +%s --date="300 days ago")" ]; then rm /var/lib/teku/teku-keyapi.keystore @@ -59,9 +82,9 @@ fi if [ "${DEFAULT_GRAFFITI}" = "true" ]; then # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 - exec "$@" ${__w3s_url} ${__mev_boost} ${__doppel} ${VC_EXTRAS} + exec "$@" ${__network} ${__w3s_url} ${__mev_boost} ${__doppel} ${VC_EXTRAS} else # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 - exec "$@" "--validators-graffiti=${GRAFFITI}" ${__w3s_url} ${__mev_boost} ${__doppel} ${VC_EXTRAS} + exec "$@" ${__network} "--validators-graffiti=${GRAFFITI}" ${__w3s_url} ${__mev_boost} ${__doppel} ${VC_EXTRAS} fi