solana/multinode-demo/bootstrap-leader.sh

93 lines
2.2 KiB
Bash
Raw Normal View History

2018-12-07 10:00:35 -08:00
#!/usr/bin/env bash
#
# Start the bootstrap leader node
#
set -e
2018-12-07 10:00:35 -08:00
here=$(dirname "$0")
# shellcheck source=multinode-demo/common.sh
source "$here"/common.sh
if [[ "$SOLANA_GPU_MISSING" -eq 1 ]]; then
echo "Testnet requires GPUs, but none were found! Aborting..."
exit 1
fi
if [[ -n $SOLANA_CUDA ]]; then
program=$solana_validator_cuda
else
program=$solana_validator
fi
args=()
while [[ -n $1 ]]; do
if [[ ${1:0:1} = - ]]; then
if [[ $1 = --init-complete-file ]]; then
args+=("$1" "$2")
shift 2
2019-11-20 15:57:24 -08:00
elif [[ $1 = --gossip-host ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 = --gossip-port ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 = --dynamic-port-range ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 = --limit-ledger-size ]]; then
args+=("$1")
shift
elif [[ $1 = --skip-poh-verify ]]; then
2019-10-21 10:21:43 -07:00
args+=("$1")
shift
elif [[ $1 = --log ]]; then
args+=("$1" "$2")
shift 2
else
echo "Unknown argument: $1"
$program --help
exit 1
fi
else
echo "Unknown argument: $1"
$program --help
exit 1
fi
done
if [[ -z $CI ]]; then # Skip in CI
# shellcheck source=scripts/tune-system.sh
source "$here"/../scripts/tune-system.sh
fi
# These keypairs are created by ./setup.sh and included in the genesis config
2019-07-30 22:43:47 -07:00
identity_keypair=$SOLANA_CONFIG_DIR/bootstrap-leader/identity-keypair.json
vote_keypair="$SOLANA_CONFIG_DIR"/bootstrap-leader/vote-keypair.json
storage_keypair=$SOLANA_CONFIG_DIR/bootstrap-leader/storage-keypair.json
ledger_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader
2019-07-30 22:43:47 -07:00
[[ -d "$ledger_dir" ]] || {
echo "$ledger_dir does not exist"
echo
echo "Please run: $here/setup.sh"
exit 1
}
args+=(
2019-07-30 22:43:47 -07:00
--accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader/accounts
--enable-rpc-exit
--identity "$identity_keypair"
2019-07-30 22:43:47 -07:00
--ledger "$ledger_dir"
--rpc-port 8899
--snapshot-interval-slots 100
--storage-keypair "$storage_keypair"
--voting-keypair "$vote_keypair"
--rpc-drone-address 127.0.0.1:9900
)
default_arg --gossip-port 8001
default_arg --log -
set -x
# shellcheck disable=SC2086 # Don't want to double quote $program
exec $program "${args[@]}"