Leader rotation flag plumbing
This commit is contained in:
parent
3d996bf080
commit
094f0a8be3
|
@ -13,6 +13,7 @@ snapChannel=edge
|
||||||
tarChannelOrTag=edge
|
tarChannelOrTag=edge
|
||||||
delete=false
|
delete=false
|
||||||
enableGpu=false
|
enableGpu=false
|
||||||
|
leaderRotation=true
|
||||||
useTarReleaseChannel=false
|
useTarReleaseChannel=false
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
@ -42,6 +43,7 @@ Deploys a CD testnet
|
||||||
-P - Use public network IP addresses (default: $publicNetwork)
|
-P - Use public network IP addresses (default: $publicNetwork)
|
||||||
-G - Enable GPU, and set count/type of GPUs to use (e.g n1-standard-16 --accelerator count=4,type=nvidia-tesla-k80)
|
-G - Enable GPU, and set count/type of GPUs to use (e.g n1-standard-16 --accelerator count=4,type=nvidia-tesla-k80)
|
||||||
-g - Enable GPU (default: $enableGpu)
|
-g - Enable GPU (default: $enableGpu)
|
||||||
|
-b - Disable leader rotation
|
||||||
-a [address] - Set the bootstrap fullnode's external IP address to this GCE address
|
-a [address] - Set the bootstrap fullnode's external IP address to this GCE address
|
||||||
-d - Delete the network
|
-d - Delete the network
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ zone=$3
|
||||||
[[ -n $zone ]] || usage "Zone not specified"
|
[[ -n $zone ]] || usage "Zone not specified"
|
||||||
shift 3
|
shift 3
|
||||||
|
|
||||||
while getopts "h?p:Pn:c:s:t:gG:a:d" opt; do
|
while getopts "h?p:Pn:c:s:t:gG:a:db" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h | \?)
|
h | \?)
|
||||||
usage
|
usage
|
||||||
|
@ -94,6 +96,9 @@ while getopts "h?p:Pn:c:s:t:gG:a:d" opt; do
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
b)
|
||||||
|
leaderRotation=false
|
||||||
|
;;
|
||||||
g)
|
g)
|
||||||
enableGpu=true
|
enableGpu=true
|
||||||
;;
|
;;
|
||||||
|
@ -130,6 +135,10 @@ if $enableGpu; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! $leaderRotation; then
|
||||||
|
create_args+=(-b)
|
||||||
|
fi
|
||||||
|
|
||||||
if $publicNetwork; then
|
if $publicNetwork; then
|
||||||
create_args+=(-P)
|
create_args+=(-P)
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -29,11 +29,28 @@ else
|
||||||
program="$solana_fullnode"
|
program="$solana_fullnode"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
maybe_no_leader_rotation=
|
||||||
|
if [[ $1 = --no-leader-rotation ]]; then
|
||||||
|
maybe_no_leader_rotation="--no-leader-rotation"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
echo "Unknown argument: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d $SNAP ]]; then
|
||||||
|
if [[ $(snapctl get leader-rotation) = false ]]; then
|
||||||
|
maybe_no_leader_rotation="--no-leader-rotation"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
tune_networking
|
tune_networking
|
||||||
|
|
||||||
trap 'kill "$pid" && wait "$pid"' INT TERM
|
trap 'kill "$pid" && wait "$pid"' INT TERM
|
||||||
$program \
|
$program \
|
||||||
--no-leader-rotation \
|
$maybe_no_leader_rotation \
|
||||||
--identity "$SOLANA_CONFIG_DIR"/bootstrap-leader.json \
|
--identity "$SOLANA_CONFIG_DIR"/bootstrap-leader.json \
|
||||||
--ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger \
|
--ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger \
|
||||||
--rpc 8899 \
|
--rpc 8899 \
|
||||||
|
|
|
@ -20,11 +20,12 @@ usage() {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
echo "usage: $0 [-x] [rsync network path to bootstrap leader configuration] [network entry point]"
|
echo "usage: $0 [-x] [--no-leader-rotation] [rsync network path to bootstrap leader configuration] [network entry point]"
|
||||||
echo
|
echo
|
||||||
echo " Start a full node on the specified network"
|
echo " Start a full node on the specified network"
|
||||||
echo
|
echo
|
||||||
echo " -x: runs a new, dynamically-configured full node"
|
echo " -x: runs a new, dynamically-configured full node"
|
||||||
|
echo " --no-leader-rotation: disable leader rotation"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -33,13 +34,25 @@ if [[ $1 = -h ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == -x ]]; then
|
if [[ $1 = -x ]]; then
|
||||||
self_setup=1
|
self_setup=1
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
self_setup=0
|
self_setup=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
maybe_no_leader_rotation=
|
||||||
|
if [[ $1 = --no-leader-rotation ]]; then
|
||||||
|
maybe_no_leader_rotation="--no-leader-rotation"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d $SNAP ]]; then
|
||||||
|
if [[ $(snapctl get leader-rotation) = false ]]; then
|
||||||
|
maybe_no_leader_rotation="--no-leader-rotation"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n $3 ]]; then
|
if [[ -n $3 ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
@ -175,7 +188,7 @@ $solana_wallet \
|
||||||
|
|
||||||
trap 'kill "$pid" && wait "$pid"' INT TERM
|
trap 'kill "$pid" && wait "$pid"' INT TERM
|
||||||
$program \
|
$program \
|
||||||
--no-leader-rotation \
|
$maybe_no_leader_rotation \
|
||||||
--identity "$fullnode_json_path" \
|
--identity "$fullnode_json_path" \
|
||||||
--network "$leader_address" \
|
--network "$leader_address" \
|
||||||
--ledger "$ledger_config_dir"/ledger \
|
--ledger "$ledger_config_dir"/ledger \
|
||||||
|
|
|
@ -29,6 +29,7 @@ fullnodeIpList=()
|
||||||
fullnodeIpListPrivate=()
|
fullnodeIpListPrivate=()
|
||||||
clientIpList=()
|
clientIpList=()
|
||||||
clientIpListPrivate=()
|
clientIpListPrivate=()
|
||||||
|
leaderRotation=
|
||||||
|
|
||||||
buildSshOptions() {
|
buildSshOptions() {
|
||||||
sshOptions=(
|
sshOptions=(
|
||||||
|
@ -50,6 +51,7 @@ loadConfigFile() {
|
||||||
[[ -n "$publicNetwork" ]] || usage "Config file invalid, publicNetwork unspecified: $configFile"
|
[[ -n "$publicNetwork" ]] || usage "Config file invalid, publicNetwork unspecified: $configFile"
|
||||||
[[ -n "$netBasename" ]] || usage "Config file invalid, netBasename unspecified: $configFile"
|
[[ -n "$netBasename" ]] || usage "Config file invalid, netBasename unspecified: $configFile"
|
||||||
[[ -n $sshPrivateKey ]] || usage "Config file invalid, sshPrivateKey unspecified: $configFile"
|
[[ -n $sshPrivateKey ]] || usage "Config file invalid, sshPrivateKey unspecified: $configFile"
|
||||||
|
[[ -n $leaderRotation ]] || usage "Config file invalid, leaderRotation unspecified: $configFile"
|
||||||
[[ ${#fullnodeIpList[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpList unspecified: $configFile"
|
[[ ${#fullnodeIpList[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpList unspecified: $configFile"
|
||||||
[[ ${#fullnodeIpListPrivate[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpListPrivate unspecified: $configFile"
|
[[ ${#fullnodeIpListPrivate[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpListPrivate unspecified: $configFile"
|
||||||
|
|
||||||
|
|
13
net/gce.sh
13
net/gce.sh
|
@ -43,6 +43,7 @@ clientBootDiskSizeInGb=75
|
||||||
publicNetwork=false
|
publicNetwork=false
|
||||||
enableGpu=false
|
enableGpu=false
|
||||||
bootstrapLeaderAddress=
|
bootstrapLeaderAddress=
|
||||||
|
leaderRotation=true
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
exitcode=0
|
exitcode=0
|
||||||
|
@ -76,6 +77,7 @@ Manage testnet instances
|
||||||
For EC2, [address] is the "allocation ID" of the desired
|
For EC2, [address] is the "allocation ID" of the desired
|
||||||
Elastic IP.
|
Elastic IP.
|
||||||
-d [disk-type] - Specify a boot disk type (default None) Use pd-ssd to get ssd on GCE.
|
-d [disk-type] - Specify a boot disk type (default None) Use pd-ssd to get ssd on GCE.
|
||||||
|
-b - Disable leader rotation
|
||||||
|
|
||||||
config-specific options:
|
config-specific options:
|
||||||
-P - Use public network IP addresses (default: $publicNetwork)
|
-P - Use public network IP addresses (default: $publicNetwork)
|
||||||
|
@ -93,7 +95,7 @@ command=$1
|
||||||
shift
|
shift
|
||||||
[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command"
|
[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command"
|
||||||
|
|
||||||
while getopts "h?p:Pn:c:z:gG:a:d:" opt; do
|
while getopts "h?p:Pn:c:z:gG:a:d:b" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h | \?)
|
h | \?)
|
||||||
usage
|
usage
|
||||||
|
@ -114,6 +116,9 @@ while getopts "h?p:Pn:c:z:gG:a:d:" opt; do
|
||||||
z)
|
z)
|
||||||
cloud_SetZone "$OPTARG"
|
cloud_SetZone "$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
b)
|
||||||
|
leaderRotation=false
|
||||||
|
;;
|
||||||
g)
|
g)
|
||||||
enableGpu=true
|
enableGpu=true
|
||||||
bootstrapLeaderMachineType=$gpuBootstrapLeaderMachineType
|
bootstrapLeaderMachineType=$gpuBootstrapLeaderMachineType
|
||||||
|
@ -179,6 +184,9 @@ ec2)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if $leaderRotation; then
|
||||||
|
fullNodeMachineType=$bootstrapLeaderMachineType
|
||||||
|
fi
|
||||||
|
|
||||||
# cloud_ForEachInstance [cmd] [extra args to cmd]
|
# cloud_ForEachInstance [cmd] [extra args to cmd]
|
||||||
#
|
#
|
||||||
|
@ -218,6 +226,7 @@ prepareInstancesAndWriteConfigFile() {
|
||||||
netBasename=$prefix
|
netBasename=$prefix
|
||||||
publicNetwork=$publicNetwork
|
publicNetwork=$publicNetwork
|
||||||
sshPrivateKey=$sshPrivateKey
|
sshPrivateKey=$sshPrivateKey
|
||||||
|
leaderRotation=$leaderRotation
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
buildSshOptions
|
buildSshOptions
|
||||||
|
@ -369,6 +378,8 @@ Network composition:
|
||||||
Additional fullnodes = $additionalFullNodeCount x $fullNodeMachineType
|
Additional fullnodes = $additionalFullNodeCount x $fullNodeMachineType
|
||||||
Client(s) = $clientNodeCount x $clientMachineType
|
Client(s) = $clientNodeCount x $clientMachineType
|
||||||
|
|
||||||
|
Leader rotation: $leaderRotation
|
||||||
|
|
||||||
========================================================================================
|
========================================================================================
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -197,6 +197,7 @@ startBootstrapLeader() {
|
||||||
${#fullnodeIpList[@]} \
|
${#fullnodeIpList[@]} \
|
||||||
\"$RUST_LOG\" \
|
\"$RUST_LOG\" \
|
||||||
$skipSetup \
|
$skipSetup \
|
||||||
|
$leaderRotation \
|
||||||
"
|
"
|
||||||
) >> "$logFile" 2>&1 || {
|
) >> "$logFile" 2>&1 || {
|
||||||
cat "$logFile"
|
cat "$logFile"
|
||||||
|
@ -223,6 +224,7 @@ startNode() {
|
||||||
${#fullnodeIpList[@]} \
|
${#fullnodeIpList[@]} \
|
||||||
\"$RUST_LOG\" \
|
\"$RUST_LOG\" \
|
||||||
$skipSetup \
|
$skipSetup \
|
||||||
|
$leaderRotation \
|
||||||
"
|
"
|
||||||
) >> "$logFile" 2>&1 &
|
) >> "$logFile" 2>&1 &
|
||||||
declare pid=$!
|
declare pid=$!
|
||||||
|
|
|
@ -11,6 +11,7 @@ entrypointIp="$4"
|
||||||
numNodes="$5"
|
numNodes="$5"
|
||||||
RUST_LOG="$6"
|
RUST_LOG="$6"
|
||||||
skipSetup="$7"
|
skipSetup="$7"
|
||||||
|
leaderRotation="$8"
|
||||||
set +x
|
set +x
|
||||||
export RUST_LOG=${RUST_LOG:-solana=warn} # if RUST_LOG is unset, default to warn
|
export RUST_LOG=${RUST_LOG:-solana=warn} # if RUST_LOG is unset, default to warn
|
||||||
|
|
||||||
|
@ -25,11 +26,13 @@ missing() {
|
||||||
[[ -n $entrypointIp ]] || missing entrypointIp
|
[[ -n $entrypointIp ]] || missing entrypointIp
|
||||||
[[ -n $numNodes ]] || missing numNodes
|
[[ -n $numNodes ]] || missing numNodes
|
||||||
[[ -n $skipSetup ]] || missing skipSetup
|
[[ -n $skipSetup ]] || missing skipSetup
|
||||||
|
[[ -n $leaderRotation ]] || missing leaderRotation
|
||||||
|
|
||||||
cat > deployConfig <<EOF
|
cat > deployConfig <<EOF
|
||||||
deployMethod="$deployMethod"
|
deployMethod="$deployMethod"
|
||||||
entrypointIp="$entrypointIp"
|
entrypointIp="$entrypointIp"
|
||||||
numNodes="$numNodes"
|
numNodes="$numNodes"
|
||||||
|
leaderRotation=$leaderRotation
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
source net/common.sh
|
source net/common.sh
|
||||||
|
@ -83,6 +86,7 @@ snap)
|
||||||
rust-log=\"$RUST_LOG\" \
|
rust-log=\"$RUST_LOG\" \
|
||||||
setup-args=\"$setupArgs\" \
|
setup-args=\"$setupArgs\" \
|
||||||
skip-setup=$skipSetup \
|
skip-setup=$skipSetup \
|
||||||
|
leader-rotation=\"$leaderRotation\" \
|
||||||
"
|
"
|
||||||
|
|
||||||
if [[ -e /dev/nvidia0 ]]; then
|
if [[ -e /dev/nvidia0 ]]; then
|
||||||
|
@ -134,6 +138,12 @@ local|tar)
|
||||||
scripts/oom-monitor.sh > oom-monitor.log 2>&1 &
|
scripts/oom-monitor.sh > oom-monitor.log 2>&1 &
|
||||||
scripts/net-stats.sh > net-stats.log 2>&1 &
|
scripts/net-stats.sh > net-stats.log 2>&1 &
|
||||||
|
|
||||||
|
maybeNoLeaderRotation=
|
||||||
|
if ! $leaderRotation; then
|
||||||
|
maybeNoLeaderRotation="--no-leader-rotation"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
case $nodeType in
|
case $nodeType in
|
||||||
bootstrap-leader)
|
bootstrap-leader)
|
||||||
if [[ -e /dev/nvidia0 && -x ~/.cargo/bin/solana-fullnode-cuda ]]; then
|
if [[ -e /dev/nvidia0 && -x ~/.cargo/bin/solana-fullnode-cuda ]]; then
|
||||||
|
@ -144,7 +154,7 @@ local|tar)
|
||||||
./multinode-demo/setup.sh -t bootstrap-leader $setupArgs
|
./multinode-demo/setup.sh -t bootstrap-leader $setupArgs
|
||||||
fi
|
fi
|
||||||
./multinode-demo/drone.sh > drone.log 2>&1 &
|
./multinode-demo/drone.sh > drone.log 2>&1 &
|
||||||
./multinode-demo/bootstrap-leader.sh > bootstrap-leader.log 2>&1 &
|
./multinode-demo/bootstrap-leader.sh $maybeNoLeaderRotation > bootstrap-leader.log 2>&1 &
|
||||||
ln -sTf bootstrap-leader.log fullnode.log
|
ln -sTf bootstrap-leader.log fullnode.log
|
||||||
;;
|
;;
|
||||||
fullnode)
|
fullnode)
|
||||||
|
@ -158,7 +168,7 @@ local|tar)
|
||||||
if [[ $skipSetup != true ]]; then
|
if [[ $skipSetup != true ]]; then
|
||||||
./multinode-demo/setup.sh -t fullnode $setupArgs
|
./multinode-demo/setup.sh -t fullnode $setupArgs
|
||||||
fi
|
fi
|
||||||
./multinode-demo/fullnode.sh "$entrypointIp":~/solana "$entrypointIp:8001" > fullnode.log 2>&1 &
|
./multinode-demo/fullnode.sh $maybeNoLeaderRotation "$entrypointIp":~/solana "$entrypointIp:8001" > fullnode.log 2>&1 &
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: unknown node type: $nodeType"
|
echo "Error: unknown node type: $nodeType"
|
||||||
|
|
|
@ -25,6 +25,7 @@ missing() {
|
||||||
[[ -n $deployMethod ]] || missing deployMethod
|
[[ -n $deployMethod ]] || missing deployMethod
|
||||||
[[ -n $entrypointIp ]] || missing entrypointIp
|
[[ -n $entrypointIp ]] || missing entrypointIp
|
||||||
[[ -n $numNodes ]] || missing numNodes
|
[[ -n $numNodes ]] || missing numNodes
|
||||||
|
[[ -n $leaderRotation ]] || missing leaderRotation
|
||||||
|
|
||||||
ledgerVerify=true
|
ledgerVerify=true
|
||||||
validatorSanity=true
|
validatorSanity=true
|
||||||
|
|
Loading…
Reference in New Issue