Skip to content

Commit

Permalink
Improve scripts setting up nodes for production
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Dec 14, 2023
1 parent 6a38f79 commit c246f70
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 31 deletions.
1 change: 0 additions & 1 deletion web/packages/test/scripts/deploy-ethereum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ start_lodestar() {
timestamp=$(date -d'+10second' +%s)
fi

local config_dir="$web_dir/packages/test/config"
pushd $root_dir/lodestar
./lodestar dev \
--genesisValidators 8 \
Expand Down
2 changes: 2 additions & 0 deletions web/packages/test/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ root_dir="$(realpath ../../..)"
web_dir="$root_dir/web"
lodestar_version="${LODESTAR_VER:-1.12.0}"
geth_version="${GETH_VER:-v1.13.5}"
config_dir="$web_dir/packages/test/config"
export contract_dir="$root_dir/contracts"
test_helpers_dir="$web_dir/packages/test-helpers"
relay_dir="$root_dir/relayer"
Expand Down Expand Up @@ -56,6 +57,7 @@ relaychain_ws_url="${RELAYCHAIN_WS_URL:-ws://127.0.0.1:9944}"
relaychain_sudo_seed="${RELAYCHAIN_SUDO_SEED:-//Alice}"

skip_relayer="${SKIP_RELAYER:-false}"
reset_ethereum="${RESET_ETHEREUM:-true}"

## Important accounts

Expand Down
23 changes: 23 additions & 0 deletions web/packages/test/scripts/start-beacon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -eu

source scripts/set-env.sh

if [ -z "${from_start_services:-}" ]; then
echo "start nodes locally!"
trap kill_all SIGINT SIGTERM EXIT
# set true to clean db and start from a new checkpoint
if [ "$reset_ethereum" == "true" ]; then
echo "db reset!"
rm -rf "$ethereum_data_dir"
fi
read -p "Chain: (goerli/sepolia/mainnet): " chain
if [ "$chain" != "goerli" ] && [ "$chain" != "sepolia" ] && [ "$chain" != "mainnet" ]; then
echo "chain type not allowed"
exit
fi
pushd $root_dir/lodestar
./lodestar beacon --dataDir="$ethereum_data_dir" --network=$chain --execution.engineMock --eth1=false --rest.namespace="*" --chain.archiveStateEpochFrequency=1 --checkpointSyncUrl=https://beaconstate-$chain.chainsafe.io >"$output_dir/lodestar.log" 2>&1 &
popd
wait
fi
30 changes: 0 additions & 30 deletions web/packages/test/scripts/start-goerli.sh

This file was deleted.

28 changes: 28 additions & 0 deletions web/packages/test/scripts/start-nodes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -eu

source scripts/set-env.sh

if [ -z "${from_start_services:-}" ]; then
echo "start nodes locally!"
trap kill_all SIGINT SIGTERM EXIT
# set true to clean db and start from a new checkpoint
if [ "$reset_ethereum" == "true" ]; then
echo "db reset!"
rm -rf "$ethereum_data_dir"
fi
read -p "Chain: (goerli/sepolia/mainnet): " chain
if [ "$chain" != "goerli" ] && [ "$chain" != "sepolia" ] && [ "$chain" != "mainnet" ]; then
echo "chain type not allowed"
exit
fi
echo "Starting execution node"
geth --$chain --datadir="$ethereum_data_dir" --authrpc.addr="127.0.0.1" --http.addr="0.0.0.0" --authrpc.vhosts "*" --http.corsdomain "*" --http --http.api web3,eth,net,engine,admin --ws --ws.api eth,net,web3 --authrpc.jwtsecret config/jwtsecret >"$output_dir/geth.log" 2>&1 &
echo "Waiting for geth API to be ready"
sleep 5
echo "Starting beacon node"
pushd $root_dir/lodestar
./lodestar beacon --dataDir="$ethereum_data_dir" --network=$chain --eth1=true --rest.namespace="*" --jwt-secret=$config_dir/jwtsecret --chain.archiveStateEpochFrequency=1 --checkpointSyncUrl=https://beaconstate-$chain.chainsafe.io >"$output_dir/lodestar.log" 2>&1 &
popd
wait
fi

0 comments on commit c246f70

Please sign in to comment.