Skip to content

Commit

Permalink
Add Nimbus custom testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Sep 1, 2023
1 parent 6efab76 commit e557350
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
1 change: 0 additions & 1 deletion nimbus-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ services:
- --tcp-port=${CL_P2P_PORT:-9000}
- --udp-port=${CL_P2P_PORT:-9000}
- --max-peers=${CL_MAX_PEER_COUNT:-160}
- --network=${NETWORK}
- --el=${EL_NODE}
- --jwt-secret=/var/lib/nimbus/ee-secret/jwtsecret
- --rest
Expand Down
1 change: 0 additions & 1 deletion nimbus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ services:
- --tcp-port=${CL_P2P_PORT:-9000}
- --udp-port=${CL_P2P_PORT:-9000}
- --max-peers=${CL_MAX_PEER_COUNT:-160}
- --network=${NETWORK}
- --el=${EL_NODE}
- --jwt-secret=/var/lib/nimbus/ee-secret/jwtsecret
- --rest
Expand Down
2 changes: 1 addition & 1 deletion nimbus/Dockerfile.binary
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN groupmod -g "${UID}" ${USER} && usermod -u "${UID}" -g "${UID}" ${USER}

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y gosu ca-certificates bash tzdata; \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y gosu ca-certificates bash tzdata git; \
rm -rf /var/lib/apt/lists/*; \
# verify that the binary works
gosu nobody true
Expand Down
2 changes: 1 addition & 1 deletion nimbus/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARG USER=user
ARG UID=10002

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \
ca-certificates bash tzdata \
ca-certificates bash tzdata git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion nimbus/Dockerfile.sourcegnosis
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARG USER=user
ARG UID=10002

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \
ca-certificates bash tzdata \
ca-certificates bash tzdata git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion nimbus/Dockerfile.sourceslottime
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARG USER=user
ARG UID=10002

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \
ca-certificates bash tzdata \
ca-certificates bash tzdata git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
36 changes: 32 additions & 4 deletions nimbus/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,42 @@ if [[ -O "/var/lib/nimbus/ee-secret/jwtsecret" ]]; then
chmod 666 /var/lib/nimbus/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/nimbus/testnet/${config_dir}" ]; then
mkdir -p /var/lib/nimbus/testnet
cd /var/lib/nimbus/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/nimbus/testnet/${config_dir}/bootstrap_nodes.txt")"
set +e
__network="--network=/var/lib/nimbus/testnet/${config_dir} --bootstrap-node=${bootnodes}"
else
__network="--network=${NETWORK}"
fi

if [ -n "${RAPID_SYNC_URL:+x}" ] && [ ! -f "/var/lib/nimbus/setupdone" ]; then
if [ "${ARCHIVE_NODE}" = "true" ]; then
echo "Starting checkpoint sync with backfill and archive reindex. Nimbus will restart when done."
/usr/local/bin/nimbus_beacon_node trustedNodeSync --backfill=true --reindex --network="${NETWORK}" --data-dir=/var/lib/nimbus --trusted-node-url="${RAPID_SYNC_URL}"
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
/usr/local/bin/nimbus_beacon_node trustedNodeSync --backfill=true --reindex ${__network} --data-dir=/var/lib/nimbus --trusted-node-url="${RAPID_SYNC_URL}"
touch /var/lib/nimbus/setupdone
else
echo "Starting checkpoint sync. Nimbus will restart when done."
/usr/local/bin/nimbus_beacon_node trustedNodeSync --backfill=false --network="${NETWORK}" --data-dir=/var/lib/nimbus --trusted-node-url="${RAPID_SYNC_URL}"
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
/usr/local/bin/nimbus_beacon_node trustedNodeSync --backfill=false ${__network} --data-dir=/var/lib/nimbus --trusted-node-url="${RAPID_SYNC_URL}"
touch /var/lib/nimbus/setupdone
fi
fi
Expand Down Expand Up @@ -69,9 +97,9 @@ fi
if [ "${DEFAULT_GRAFFITI}" = "true" ]; then
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${__mev_boost} ${__log_level} ${__doppel} ${__prune} ${CL_EXTRAS} ${VC_EXTRAS}
exec "$@" ${__network} ${__mev_boost} ${__log_level} ${__doppel} ${__prune} ${CL_EXTRAS} ${VC_EXTRAS}
else
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" "--graffiti=${GRAFFITI}" ${__mev_boost} ${__log_level} ${__doppel} ${__prune} ${CL_EXTRAS} ${VC_EXTRAS}
exec "$@" ${__network} "--graffiti=${GRAFFITI}" ${__mev_boost} ${__log_level} ${__doppel} ${__prune} ${CL_EXTRAS} ${VC_EXTRAS}
fi

0 comments on commit e557350

Please sign in to comment.