eth-stack/stack-orchestrator/config/eth/run-cl.sh
Prathamesh Musale 47cc5ed527 Add a stack to run an Ethereum node (#1)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8) and [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270)

Reviewed-on: #1
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-11 04:18:18 +00:00

50 lines
1.3 KiB
Bash

#!/bin/bash
set -e
set -o pipefail
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "Using the following env:"
echo "CERC_NETWORK: ${CERC_NETWORK}"
echo "CERC_CHECKPOINT_SYNC_URL: ${CERC_CHECKPOINT_SYNC_URL}"
echo "CERC_DEBUG_LEVEL: ${CERC_DEBUG_LEVEL}"
echo "LIGHTHOUSE_DATADIR: ${LIGHTHOUSE_DATADIR}"
echo "ETH_ENDPOINT: ${ETH_ENDPOINT}"
echo "EXECUTION_ENDPOINT: ${EXECUTION_ENDPOINT}"
# See https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script
cleanup() {
echo "Signal received, cleaning up..."
kill $(jobs -p)
wait
echo "Done"
}
trap 'cleanup' SIGINT SIGTERM
# Create a JWT secret at shared path if not found
jwtsecret_file_path=/root/secrets/jwtsecret
if [ ! -f "$jwtsecret_file_path" ]; then
openssl rand -hex 32 | tr -d "\n" > $jwtsecret_file_path
echo "Generated JWT secret at $jwtsecret_file_path"
fi
http_port=8001
lighthouse bn \
--network $CERC_NETWORK \
--datadir $LIGHTHOUSE_DATADIR/$CERC_NETWORK \
--execution-endpoint $EXECUTION_ENDPOINT \
--execution-jwt $jwtsecret_file_path \
--checkpoint-sync-url $CERC_CHECKPOINT_SYNC_URL \
--disable-deposit-contract-sync \
--debug-level $CERC_DEBUG_LEVEL \
--http \
--http-address 0.0.0.0 \
--http-port $http_port \
2>&1 | tee /var/log/lighthouse_bn.log &
beacon_pid=$!
wait $beacon_pid