Add a service to run a lighthouse beacon node
This commit is contained in:
parent
3b6c958f75
commit
50f77a1b85
@ -2,21 +2,21 @@ services:
|
||||
eth-geth:
|
||||
restart: on-failure
|
||||
hostname: eth-geth
|
||||
image: ethereum/client-go:alltools-v1.14.8
|
||||
env_file:
|
||||
- ../config/eth/params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_NETWORK: ${CERC_NETWORK:-sepolia}
|
||||
CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS:-false}
|
||||
CERC_ETH_DATADIR: ${CERC_ETH_DATADIR:-/root/ethdata}
|
||||
CERC_GETH_VERBOSITY: ${CERC_GETH_VERBOSITY:-3}
|
||||
env_file:
|
||||
- ../config/eth/params.env
|
||||
image: ethereum/client-go:alltools-v1.14.8
|
||||
entrypoint: ["sh", "-c"]
|
||||
command: |
|
||||
"/scripts/run-el.sh"
|
||||
"/root/scripts/run-el.sh"
|
||||
volumes:
|
||||
- eth_geth_data:/root/ethdata
|
||||
- ../config/eth/run-el.sh:/scripts/run-el.sh
|
||||
- eth_geth_data:/root/.ethereum
|
||||
- ../config/eth/run-el.sh:/root/scripts/run-el.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
||||
interval: 30s
|
||||
@ -28,5 +28,36 @@ services:
|
||||
- "8546"
|
||||
- "6060"
|
||||
|
||||
eth-lighthouse:
|
||||
restart: on-failure
|
||||
hostname: eth-lighthouse
|
||||
image: sigp/lighthouse:v5.3.0
|
||||
depends_on:
|
||||
eth-geth:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/eth/params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
ETH_ENDPOINT: "http://eth-geth:8545"
|
||||
EXECUTION_ENDPOINT: "http://eth-geth:8551"
|
||||
CERC_NETWORK: ${CERC_NETWORK:-sepolia}
|
||||
CERC_LIGHTHOUSE_DATADIR: ${CERC_LIGHTHOUSE_DATADIR:-/root/.lighthouse}
|
||||
CERC_CHECKPOINT_SYNC_URL: ${CERC_CHECKPOINT_SYNC_URL}
|
||||
CERC_DEBUG_LEVEL: ${CERC_DEBUG_LEVEL:-info}
|
||||
command: bash /root/scripts/run-cl.sh
|
||||
volumes:
|
||||
- eth_lighthouse_data:/root/.lighthouse
|
||||
- ../config/eth/run-cl.sh:/root/scripts/run-cl.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
ports:
|
||||
- "8001"
|
||||
|
||||
volumes:
|
||||
eth_geth_data:
|
||||
eth_lighthouse_data:
|
||||
|
45
stack-orchestrator/config/eth/run-cl.sh
Normal file
45
stack-orchestrator/config/eth/run-cl.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/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_LIGHTHOUSE_DATADIR: ${CERC_LIGHTHOUSE_DATADIR}"
|
||||
echo "CERC_CHECKPOINT_SYNC_URL: ${CERC_CHECKPOINT_SYNC_URL}"
|
||||
echo "CERC_DEBUG_LEVEL: ${CERC_DEBUG_LEVEL}"
|
||||
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
|
||||
|
||||
jwtsecret_file_path=/opt/jwtsecret
|
||||
echo -n "$JWT" > $jwtsecret_file_path
|
||||
|
||||
http_port=8001
|
||||
lighthouse bn \
|
||||
--network $CERC_NETWORK \
|
||||
--datadir $CERC_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
|
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
@ -8,6 +9,7 @@ echo "Using the following env:"
|
||||
echo "CERC_NETWORK: ${CERC_NETWORK}"
|
||||
echo "CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS}"
|
||||
echo "CERC_ETH_DATADIR: ${CERC_ETH_DATADIR}"
|
||||
echo "CERC_GETH_VERBOSITY: ${CERC_GETH_VERBOSITY}"
|
||||
|
||||
# See https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script
|
||||
cleanup() {
|
||||
|
Loading…
Reference in New Issue
Block a user