Improve run.sh for better developer experience (#6945)
* run.sh: Create genesis file for ad-hoc validators * run.sh: Prefer release under NDEBUG * run.sh: Add sanity test for run.sh * run.sh: Conditionally re-gen drone and faucet keys * Make shellcheck happy * Address code review comments * Clean up a bit
This commit is contained in:
parent
5d8c1a303e
commit
5ad09afc15
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
rm -f config/run/init-completed
|
||||
|
||||
timeout 15 ./run.sh &
|
||||
pid=$!
|
||||
|
||||
attempts=10
|
||||
while [[ ! -f config/run/init-completed ]]; do
|
||||
sleep 1
|
||||
if ((--attempts == 0)); then
|
||||
echo "Error: validator failed to boot"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"validatorExit"}' http://localhost:8899
|
||||
|
||||
wait $pid
|
|
@ -121,9 +121,11 @@ test-local-cluster)
|
|||
;;
|
||||
esac
|
||||
|
||||
echo --- ci/localnet-sanity.sh
|
||||
export CARGO_TOOLCHAIN=+"$rust_stable"
|
||||
(
|
||||
set -x
|
||||
export CARGO_TOOLCHAIN=+"$rust_stable"
|
||||
echo --- ci/localnet-sanity.sh
|
||||
ci/localnet-sanity.sh -x
|
||||
|
||||
echo --- ci/run-sanity.sh
|
||||
ci/run-sanity.sh -x
|
||||
)
|
||||
|
|
25
run.sh
25
run.sh
|
@ -9,7 +9,12 @@ set -e
|
|||
|
||||
# Prefer possible `cargo build` binaries over PATH binaries
|
||||
cd "$(dirname "$0")/"
|
||||
PATH=$PWD/target/debug:$PATH
|
||||
|
||||
profile=debug
|
||||
if [[ -n $NDEBUG ]]; then
|
||||
profile=release
|
||||
fi
|
||||
PATH=$PWD/target/$profile:$PATH
|
||||
|
||||
ok=true
|
||||
for program in solana-{drone,genesis,keygen,validator}; do
|
||||
|
@ -59,8 +64,18 @@ if [[ -e $leader_stake_account_keypair ]]; then
|
|||
else
|
||||
solana-keygen new -o "$leader_stake_account_keypair"
|
||||
fi
|
||||
solana-keygen new -f -o "$dataDir"/faucet-keypair.json
|
||||
solana-keygen new -f -o "$dataDir"/leader-storage-account-keypair.json
|
||||
faucet_keypair="$dataDir"/faucet-keypair.json
|
||||
if [[ -e $faucet_keypair ]]; then
|
||||
echo "Use existing faucet keypair"
|
||||
else
|
||||
solana-keygen new -f -o "$faucet_keypair"
|
||||
fi
|
||||
leader_storage_account_keypair="$dataDir"/leader-storage-account-keypair.json
|
||||
if [[ -e $leader_storage_account_keypair ]]; then
|
||||
echo "Use existing leader storage account keypair"
|
||||
else
|
||||
solana-keygen new -f -o "$leader_storage_account_keypair"
|
||||
fi
|
||||
|
||||
solana-genesis \
|
||||
--hashes-per-tick sleep \
|
||||
|
@ -72,10 +87,12 @@ solana-genesis \
|
|||
--bootstrap-storage-pubkey "$dataDir"/leader-storage-account-keypair.json \
|
||||
--ledger "$ledgerDir" \
|
||||
--operating-mode development
|
||||
tar jcfS "$ledgerDir/genesis.tar.bz2" -C "$ledgerDir" genesis.bin rocksdb
|
||||
|
||||
abort() {
|
||||
set +e
|
||||
kill "$drone" "$validator"
|
||||
wait "$validator"
|
||||
}
|
||||
trap abort INT TERM EXIT
|
||||
|
||||
|
@ -92,6 +109,8 @@ args=(
|
|||
--rpc-drone-address 127.0.0.1:9900
|
||||
--accounts "$dataDir"/accounts
|
||||
--log -
|
||||
--enable-rpc-exit
|
||||
--init-complete-file "$dataDir"/init-completed
|
||||
)
|
||||
if [[ -n $blockstreamSocket ]]; then
|
||||
args+=(--blockstream "$blockstreamSocket")
|
||||
|
|
Loading…
Reference in New Issue