Start up scripting
This commit is contained in:
parent
56c9e5b717
commit
f1e68233dd
@ -11,11 +11,13 @@ services:
|
|||||||
CERC_RUN_STATEDIFF: ${CERC_RUN_STATEDIFF:-detect}
|
CERC_RUN_STATEDIFF: ${CERC_RUN_STATEDIFF:-detect}
|
||||||
CERC_STATEDIFF_DB_NODE_ID: 1
|
CERC_STATEDIFF_DB_NODE_ID: 1
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
env_file:
|
|
||||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
|
||||||
image: cerc/go-ethereum:local
|
image: cerc/go-ethereum:local
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
command: -c "/opt/run-geth.sh"
|
||||||
volumes:
|
volumes:
|
||||||
- mainnet_eth_geth_1_data:/root/ethdata
|
- mainnet_eth_geth_1_data:/root/ethdata
|
||||||
|
- mainnet_eth_config_data:/etc/mainnet-eth
|
||||||
|
- ../config/mainnet-eth/scripts/run-geth.sh:/opt/run-geth.sh
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@ -36,15 +38,15 @@ services:
|
|||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
env_file:
|
|
||||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
|
||||||
environment:
|
environment:
|
||||||
NODE_NUMBER: "1"
|
|
||||||
ETH1_ENDPOINT: "http://mainnet-eth-geth-1:8545"
|
|
||||||
EXECUTION_ENDPOINT: "http://mainnet-eth-geth-1:8551"
|
EXECUTION_ENDPOINT: "http://mainnet-eth-geth-1:8551"
|
||||||
image: cerc/lighthouse:local
|
image: cerc/lighthouse:local
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
command: -c "/opt/run-lighthouse.sh"
|
||||||
volumes:
|
volumes:
|
||||||
- mainnet_eth_lighthouse_1_data:/opt/testnet/build/cl
|
- mainnet_eth_lighthouse_1_data:/var/lighthouse-data-dir
|
||||||
|
- mainnet_eth_config_data:/etc/mainnet-eth
|
||||||
|
- ../config/mainnet-eth/scripts/run-lighthouse.sh:/opt/run-lighthouse.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
mainnet-eth-geth-1:
|
mainnet-eth-geth-1:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@ -52,5 +54,6 @@ services:
|
|||||||
- "8001"
|
- "8001"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
mainnet_eth_config_data:
|
||||||
mainnet_eth_geth_1_data:
|
mainnet_eth_geth_1_data:
|
||||||
mainnet_eth_lighthouse_1_data:
|
mainnet_eth_lighthouse_1_data:
|
||||||
|
67
app/data/config/mainnet-eth/scripts/run-geth.sh
Executable file
67
app/data/config/mainnet-eth/scripts/run-geth.sh
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
CERC_ETH_DATADIR=/root/ethdata
|
||||||
|
|
||||||
|
START_CMD="geth"
|
||||||
|
if [ "true" == "$CERC_REMOTE_DEBUG" ] && [ -x "/usr/local/bin/dlv" ]; then
|
||||||
|
START_CMD="/usr/local/bin/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /usr/local/bin/geth --continue --"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# See https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script
|
||||||
|
cleanup() {
|
||||||
|
echo "Signal received, cleaning up..."
|
||||||
|
|
||||||
|
# Kill the child process first (CERC_REMOTE_DEBUG=true uses dlv which starts geth as a child process)
|
||||||
|
pkill -P ${geth_pid}
|
||||||
|
sleep 2
|
||||||
|
kill $(jobs -p)
|
||||||
|
|
||||||
|
wait
|
||||||
|
echo "Done"
|
||||||
|
}
|
||||||
|
|
||||||
|
$START_CMD \
|
||||||
|
--datadir="${CERC_ETH_DATADIR}" \
|
||||||
|
--allow-insecure-unlock \
|
||||||
|
--http \
|
||||||
|
--http.addr="0.0.0.0" \
|
||||||
|
--http.vhosts="*" \
|
||||||
|
--http.api="${CERC_GETH_HTTP_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||||
|
--http.corsdomain="*" \
|
||||||
|
--authrpc.addr="0.0.0.0" \
|
||||||
|
--authrpc.vhosts="*" \
|
||||||
|
--authrpc.jwtsecret="/opt/testnet/build/el/jwtsecret" \
|
||||||
|
--ws \
|
||||||
|
--ws.addr="0.0.0.0" \
|
||||||
|
--ws.origins="*" \
|
||||||
|
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||||
|
--http.corsdomain="*" \
|
||||||
|
--networkid="${NETWORK_ID}" \
|
||||||
|
--netrestrict="${NETRESTRICT}" \
|
||||||
|
--gcmode archive \
|
||||||
|
--txlookuplimit=0 \
|
||||||
|
--cache.preimages \
|
||||||
|
--syncmode=full \
|
||||||
|
--mine \
|
||||||
|
--miner.threads=1 \
|
||||||
|
--metrics \
|
||||||
|
--metrics.addr="0.0.0.0" \
|
||||||
|
--verbosity=${CERC_GETH_VERBOSITY:-3} \
|
||||||
|
--log.vmodule="${CERC_GETH_VMODULE:-statediff/*=5}" \
|
||||||
|
--miner.etherbase="${ETHERBASE}" \
|
||||||
|
${STATEDIFF_OPTS} \
|
||||||
|
&
|
||||||
|
|
||||||
|
geth_pid=$!
|
||||||
|
|
||||||
|
|
||||||
|
wait $geth_pid
|
||||||
|
|
||||||
|
if [ "true" == "$CERC_KEEP_RUNNING_AFTER_GETH_EXIT" ]; then
|
||||||
|
while [ 1 -eq 1 ]; do
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
fi
|
34
app/data/config/mainnet-eth/scripts/run-lighthouse.sh
Executable file
34
app/data/config/mainnet-eth/scripts/run-lighthouse.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEBUG_LEVEL=${CERC_LIGHTHOUSE_DEBUG_LEVEL:-info}
|
||||||
|
|
||||||
|
# Get positional arguments
|
||||||
|
data_dir=$DATADIR/node_${NODE_NUMBER}
|
||||||
|
network_port=9001
|
||||||
|
http_port=8001
|
||||||
|
authrpc_port=8551
|
||||||
|
|
||||||
|
exec lighthouse \
|
||||||
|
bn \
|
||||||
|
--debug-level $DEBUG_LEVEL \
|
||||||
|
--boot-nodes "$ENR" \
|
||||||
|
--datadir $data_dir \
|
||||||
|
--testnet-dir $TESTNET_DIR \
|
||||||
|
--enable-private-discovery \
|
||||||
|
--staking \
|
||||||
|
--enr-address $ENR_IP \
|
||||||
|
--enr-udp-port $network_port \
|
||||||
|
--enr-tcp-port $network_port \
|
||||||
|
--port $network_port \
|
||||||
|
--http-address 0.0.0.0 \
|
||||||
|
--http-port $http_port \
|
||||||
|
--disable-packet-filter \
|
||||||
|
--execution-endpoint $EXECUTION_ENDPOINT \
|
||||||
|
--execution-jwt $JWTSECRET \
|
||||||
|
--terminal-total-difficulty-override $ETH1_TTD \
|
||||||
|
--suggested-fee-recipient $SUGGESTED_FEE_RECIPIENT \
|
||||||
|
--target-peers $((BN_COUNT - 1)) \
|
||||||
|
--http-allow-sync-stalled \
|
Loading…
Reference in New Issue
Block a user