-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fff815
commit ca2b6c0
Showing
4 changed files
with
51 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,55 @@ | ||
#!/bin/sh | ||
|
||
set_jwt_path() { | ||
CLIENT=$1 | ||
echo "Using $CLIENT JWT" | ||
JWT_PATH="/security/$CLIENT/jwtsecret.hex" | ||
} | ||
|
||
set_network_specific_config() { | ||
CONSENSUS_DNP=$1 | ||
P2P_PORT=$2 | ||
|
||
echo "[INFO - entrypoint] Initializing $NETWORK specific config for client" | ||
|
||
set_consensus_dnp | ||
|
||
# If consensus client is prysm-prater.dnp.dappnode.eth --> CLIENT=prysm | ||
CLIENT=$(echo "$CONSENSUS_DNP" | cut -d'.' -f1 | cut -d'-' -f1) | ||
consensus_client=$(echo "$CONSENSUS_DNP" | cut -d'.' -f1 | cut -d'-' -f1) | ||
|
||
set_jwt_path "$consensus_client" | ||
} | ||
|
||
set_jwt_path "$CLIENT" | ||
set_consensus_dnp() { | ||
uppercase_network=$(echo "$NETWORK" | tr '[:lower:]' '[:upper:]') | ||
consensus_dnp_var="_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_${uppercase_network}" | ||
eval "CONSENSUS_DNP=\${$consensus_dnp_var}" | ||
} | ||
|
||
set_jwt_path() { | ||
consensus_client=$1 | ||
echo "[INFO - entrypoint] Using $consensus_client JWT" | ||
JWT_PATH="/security/$consensus_client/jwtsecret.hex" | ||
|
||
if [ ! -f "${JWT_PATH}" ]; then | ||
echo "[ERROR - entrypoint] JWT not found at ${JWT_PATH}" | ||
exit 1 | ||
fi | ||
} | ||
|
||
case "$NETWORK" in | ||
"holesky") set_network_specific_config "$_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_HOLESKY" 30415 ;; | ||
"mainnet") set_network_specific_config "$_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_MAINNET" 30414 ;; | ||
*) | ||
echo "Unsupported network: $NETWORK" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Check if curl is installed (not installed in ARM64 arch) | ||
if command -v curl >/dev/null 2>&1; then | ||
# Print the jwt to the dappmanager | ||
post_jwt_to_dappmanager() { | ||
echo "[INFO - entrypoint] Posting JWT to DAppManager" | ||
JWT=$(cat "${JWT_PATH}") | ||
curl -X POST "http://my.dappnode/data-send?key=jwt&data=${JWT}" | ||
else | ||
echo "curl is not installed in ARM64 arch. Skipping the JWT post to package info." | ||
fi | ||
|
||
exec besu --rpc-ws-enabled="${WS_ENABLED}" \ | ||
--engine-jwt-secret="${JWT_PATH}" \ | ||
--data-storage-format="${STORAGE_FORMAT}" \ | ||
--sync-mode="${SYNC_MODE}" \ | ||
--rpc-http-max-active-connections="${MAX_HTTP_CONNECTIONS}" \ | ||
--p2p-port="${P2P_PORT}" \ | ||
--network="${NETWORK}" \ | ||
"${EXTRA_OPTS}" | ||
|
||
curl -X POST "http://my.dappnode/data-send?key=jwt&data=${JWT}" || { | ||
echo "[ERROR - entrypoint] JWT could not be posted to package info" | ||
} | ||
} | ||
|
||
run_client() { | ||
echo "[INFO - entrypoint] Running client" | ||
|
||
exec besu --rpc-ws-enabled="${WS_ENABLED}" \ | ||
--engine-jwt-secret="${JWT_PATH}" \ | ||
--data-storage-format="${STORAGE_FORMAT}" \ | ||
--sync-mode="${SYNC_MODE}" \ | ||
--rpc-http-max-active-connections="${MAX_HTTP_CONNECTIONS}" \ | ||
--p2p-port="${P2P_PORT}" \ | ||
--network="${NETWORK}" \ | ||
"${EXTRA_OPTS}" | ||
} | ||
|
||
set_network_specific_config | ||
post_jwt_to_dappmanager | ||
run_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ services: | |
build: | ||
args: | ||
NETWORK: holesky | ||
P2P_PORT: 30415 | ||
ports: | ||
- 30415:30415/tcp | ||
- 30415:30415/udp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ services: | |
build: | ||
args: | ||
NETWORK: mainnet | ||
P2P_PORT: 30414 | ||
ports: | ||
- 30414:30414/tcp | ||
- 30414:30414/udp | ||
|