Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ LOG_LEVEL=info
JWT_SECRET=
# Authenticated execution client endpoint. This default uses the execution node container.
EL_NODE=http://execution:8551
# Consensus client address. This could be comma-separated for Lighthouse, Nimbus or Teku VC clients, with failover,
# Consensus client address. This could be a comma-separated list with failover,
# or could just be a remote consensus client URL for "validator only" setups.
CL_NODE=http://consensus:5052
# Used by "ethd keys", adjust this if you have multiple Eth Docker stacks connected to the same Docker bridge network
Expand Down
1 change: 1 addition & 0 deletions ethdo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install
adduser \
bash \
jq \
curl \
&& gosu nobody true \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand Down
16 changes: 14 additions & 2 deletions ethdo/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,20 @@ if [[ "$*" =~ "--offline" ]]; then
chown ethdo:ethdo /app/offline-preparation.json
fi
else
# Get just the first CL_NODE
__args=( "${__args[@]:0:1}" "--connection" "$(cut -d, -f1 <<<"${CL_NODE}")" "${__args[@]:1}" )
nodes=$(echo "${CL_NODE}" | tr ',' ' ')
for node in ${nodes}; do
if curl -s -m 5 -o /dev/null -w "%{http_code}" "${node}" | grep -q "^[23]"; then
node_reachable=1
break
fi
done

if [[ "${node_reachable}" -eq 0 ]]; then
echo "No consensus client node is reachable via any URL in ${CL_NODE}"
exit 1
fi

__args=( "${__args[@]:0:1}" "--connection" "${node}" "${__args[@]:1}" )
fi

set +e
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-vc-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ services:
depends_on:
lighthouse-builder:
condition: service_completed_successfully
environment:
- CL_NODE=${CL_NODE}
volumes:
- lhvalidator-data:/var/lib/lighthouse
- ./.eth/validator_keys:/validator_keys
Expand All @@ -103,8 +105,6 @@ services:
- account
- validator
- exit
- --beacon-node
- ${CL_NODE:-http://consensus:5052}
- --datadir
- /var/lib/lighthouse
- --network
Expand Down
4 changes: 2 additions & 2 deletions lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ services:
condition: service_started
lighthouse-builder:
condition: service_completed_successfully
environment:
- CL_NODE=${CL_NODE}
volumes:
- lhvalidator-data:/var/lib/lighthouse
- ./.eth/validator_keys:/validator_keys
Expand All @@ -187,8 +189,6 @@ services:
- account
- validator
- exit
- --beacon-node
- http://consensus:5052
- --datadir
- /var/lib/lighthouse
- --network
Expand Down
17 changes: 17 additions & 0 deletions lighthouse/validator-exit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,21 @@ if [[ "$(id -u)" -eq 0 ]]; then
exec gosu lhvalidator "${BASH_SOURCE[0]}" "$@"
fi

nodes=$(echo "${CL_NODE}" | tr ',' ' ')
for node in ${nodes}; do
if curl -s -m 5 -o /dev/null -w "%{http_code}" "${node}" | grep -q "^[23]"; then
node_reachable=1
break
fi
done

if [[ "${node_reachable}" -eq 0 ]]; then
echo "No consensus client node is reachable via any URL in ${CL_NODE}"
sleep 30
exit 1
fi

# Insert the --beacon-node after the 4th position
set -- "${@:1:4}" "--beacon-node" "${node}" "${@:5}"

exec "$@"
7 changes: 6 additions & 1 deletion siren.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ services:
- NODE_OPTIONS="--dns-result-order=ipv4first"
<<: *logging
entrypoint:
- docker-entrypoint.sh
- /bin/bash
- -c
command:
- |
export BEACON_URL="$${BEACON_URL%%,*}"
exec /app/docker-assets/docker-entrypoint.sh
labels:
- traefik.enable=true
- traefik.http.routers.$(SIREN_HOST:-siren}.service=${SIREN_HOST:-siren}
Expand Down
2 changes: 1 addition & 1 deletion teku-vc-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ services:
entrypoint:
- /opt/teku/bin/teku
- voluntary-exit
- --beacon-node-api-endpoint=${CL_NODE:-http://consensus:5052}
- --beacon-node-api-endpoints=${CL_NODE:-http://consensus:5052}
- --validator-keys=/var/lib/teku/validator-keys:/var/lib/teku/validator-passwords
- --validator-keys=/var/lib/teku/validator/key-manager/local:/var/lib/teku/validator/key-manager/local-passwords

Expand Down
2 changes: 1 addition & 1 deletion teku.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ services:
entrypoint:
- /opt/teku/bin/teku
- voluntary-exit
- --beacon-node-api-endpoint=${CL_NODE:-http://consensus:5052}
- --beacon-node-api-endpoints=${CL_NODE:-http://consensus:5052}
- --validator-keys=/var/lib/teku/validator-keys:/var/lib/teku/validator-passwords
- --validator-keys=/var/lib/teku/validator/key-manager/local:/var/lib/teku/validator/key-manager/local-passwords

Expand Down
40 changes: 36 additions & 4 deletions vc-utils/keymanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,35 @@ else

__call_cl_api() {
local exitstatus
local nodes
local node
local node_reachable=0

nodes=$(echo "${CL_NODE}" | tr ',' ' ')
for node in ${nodes}; do
if curl -s -m 5 -o /dev/null -w "%{http_code}" "${node}" | grep -q "^[23]"; then
node_reachable=1
break
fi
done

if [[ "${node_reachable}" -eq 0 ]]; then
echo "No consensus client node is reachable via any URL in ${CL_NODE}"
exit 1
fi

set +e
if [[ -z "${__api_data}" ]]; then
__code=$(curl -m 60 -s --show-error -o /tmp/result.txt -w "%{http_code}" -X "${__http_method}" -H "Accept: application/json" \
"${CL_NODE}"/"${__api_path}")
"${node}"/"${__api_path}")
else
__code=$(curl -m 60 -s --show-error -o /tmp/result.txt -w "%{http_code}" -X "${__http_method}" -H "Accept: application/json" -H "Content-Type: application/json" \
--data "${__api_data}" "${CL_NODE}"/"${__api_path}")
--data "${__api_data}" "${node}"/"${__api_path}")
fi
exitstatus=$?
if [[ "${exitstatus}" -ne 0 ]]; then
echo "Error encountered while trying to call the consensus client REST API via curl."
echo "Please make sure the ${CL_NODE} URL is reachable."
echo "Please make sure the ${node} URL is reachable."
echo "Error code ${exitstatus}"
exit ${exitstatus}
fi
Expand Down Expand Up @@ -585,6 +601,9 @@ validator-list() {


validator-count() {
local nodes
local node
local node_reachable=0
local vc_api_container
local vc_service
local vc_api_port
Expand Down Expand Up @@ -635,9 +654,22 @@ validator-count() {
fi
fi

nodes=$(echo "${CL_NODE}" | tr ',' ' ')
for node in ${nodes}; do
if curl -s -m 5 -o /dev/null -w "%{http_code}" "${node}" | grep -q "^[23]"; then
node_reachable=1
break
fi
done

if [[ "${node_reachable}" -eq 0 ]]; then
echo "No consensus client node is reachable via any URL in ${CL_NODE}"
exit 1
fi

echo "Querying validator state, this may take a minute"
for __pubkey in $(echo "${vals}" | jq -r '.data[].validating_pubkey'); do
val_state=$(curl -k -m 60 -s --show-error "${CL_NODE}/eth/v1/beacon/states/head/validators/${__pubkey}" | jq -r .data.status)
val_state=$(curl -k -m 60 -s --show-error "${node}/eth/v1/beacon/states/head/validators/${__pubkey}" | jq -r .data.status)
case "${val_state}" in
active_ongoing) ((vals_active++));;
active_exiting) ((vals_exiting++));;
Expand Down
Loading