Add SOLANA_NET_NAME, rename SOLANA_NET_URL to SOLANA_NET_ENTRYPOINT

This commit is contained in:
Michael Vines 2018-08-08 08:49:30 -07:00
parent 89f17ceecf
commit cca240c279
No known key found for this signature in database
GPG Key ID: 33F4FDEC4E0E88BD
1 changed files with 25 additions and 18 deletions

View File

@ -23,15 +23,17 @@ if [[ -z $SOLANA_SNAP_CHANNEL ]]; then
SOLANA_SNAP_CHANNEL=edge SOLANA_SNAP_CHANNEL=edge
fi fi
# Select default network URL based on SOLANA_SNAP_CHANNEL if SOLANA_NET_URL is # Select default network URL based on SOLANA_SNAP_CHANNEL if SOLANA_NET_ENTRYPOINT is
# unspecified # unspecified
if [[ -z $SOLANA_NET_URL ]]; then if [[ -z $SOLANA_NET_ENTRYPOINT ]]; then
case $SOLANA_SNAP_CHANNEL in case $SOLANA_SNAP_CHANNEL in
edge) edge)
SOLANA_NET_URL=master.testnet.solana.com SOLANA_NET_ENTRYPOINT=master.testnet.solana.com
unset SOLANA_NET_NAME
;; ;;
beta) beta)
SOLANA_NET_URL=testnet.solana.com SOLANA_NET_ENTRYPOINT=testnet.solana.com
unset SOLANA_NET_NAME
;; ;;
*) *)
echo Error: Unknown SOLANA_SNAP_CHANNEL=$SOLANA_SNAP_CHANNEL echo Error: Unknown SOLANA_SNAP_CHANNEL=$SOLANA_SNAP_CHANNEL
@ -40,6 +42,13 @@ if [[ -z $SOLANA_NET_URL ]]; then
esac esac
fi fi
if [[ -z $SOLANA_NET_NAME ]]; then
SOLANA_NET_NAME=${SOLANA_NET_ENTRYPOINT//./-}
fi
: ${SOLANA_NET_NAME:?$SOLANA_NET_ENTRYPOINT}
netBasename=${SOLANA_NET_NAME/-*/}
# Figure installation command # Figure installation command
SNAP_INSTALL_CMD="sudo snap install solana --$SOLANA_SNAP_CHANNEL --devmode" SNAP_INSTALL_CMD="sudo snap install solana --$SOLANA_SNAP_CHANNEL --devmode"
LOCAL_SNAP=$1 LOCAL_SNAP=$1
@ -63,22 +72,21 @@ if [[ -n $SKIP_INSTALL ]]; then
SNAP_INSTALL_CMD="echo Install skipped" SNAP_INSTALL_CMD="echo Install skipped"
fi fi
echo "+++ Configuration" echo "+++ Configuration for $netBasename"
publicUrl="$SOLANA_NET_URL" publicUrl="$SOLANA_NET_ENTRYPOINT"
if [[ $publicUrl = testnet.solana.com ]]; then if [[ $publicUrl = testnet.solana.com ]]; then
publicIp="" # Use default value publicIp="" # Use default value
else else
publicIp=$(dig +short $publicUrl | head -n1) publicIp=$(dig +short $publicUrl | head -n1)
fi fi
echo "Network name: $SOLANA_NET_NAME"
echo "Network entry point URL: $publicUrl ($publicIp)" echo "Network entry point URL: $publicUrl ($publicIp)"
echo "Snap channel: $SOLANA_SNAP_CHANNEL" echo "Snap channel: $SOLANA_SNAP_CHANNEL"
echo "Install command: $SNAP_INSTALL_CMD" echo "Install command: $SNAP_INSTALL_CMD"
echo "Setup args: $SOLANA_SETUP_ARGS" echo "Setup args: $SOLANA_SETUP_ARGS"
[[ -z $LOCAL_SNAP ]] || echo "Local snap: $LOCAL_SNAP" [[ -z $LOCAL_SNAP ]] || echo "Local snap: $LOCAL_SNAP"
leaderName=${publicUrl//./-}
vmlist=() # Each array element is formatted as "class:vmName:vmZone:vmPublicIp" vmlist=() # Each array element is formatted as "class:vmName:vmZone:vmPublicIp"
vm_exec() { vm_exec() {
@ -213,24 +221,24 @@ delete_unreachable_validators() {
echo "Validator nodes (unverified):" echo "Validator nodes (unverified):"
findVms validator "name~^$leaderName-validator-" findVms validator "name~^$SOLANA_NET_NAME-validator-"
pids=() pids=()
vm_foreach_in_class validator delete_unreachable_validators vm_foreach_in_class validator delete_unreachable_validators
wait_for_pids validator sanity check wait_for_pids validator sanity check
vmlist=() vmlist=()
echo "Leader node:" echo "Leader node:"
findVms leader "name=$leaderName" findVms leader "name=$SOLANA_NET_NAME"
[[ ${#vmlist[@]} = 1 ]] || { [[ ${#vmlist[@]} = 1 ]] || {
echo "Unable to find $leaderName" echo "Unable to find $SOLANA_NET_NAME"
exit 1 exit 1
} }
echo "Client node(s):" echo "Client node(s):"
findVms client "name~^$leaderName-client" findVms client "name~^$SOLANA_NET_NAME-client"
echo "Validator nodes:" echo "Validator nodes:"
findVms validator "name~^$leaderName-validator-" findVms validator "name~^$SOLANA_NET_NAME-validator-"
fullnode_count=0 fullnode_count=0
inc_fullnode_count() { inc_fullnode_count() {
@ -240,8 +248,7 @@ vm_foreach_in_class leader inc_fullnode_count
vm_foreach_in_class validator inc_fullnode_count vm_foreach_in_class validator inc_fullnode_count
# Add "network stopping" datapoint # Add "network stopping" datapoint
netName=${SOLANA_NET_URL/.*/} $metrics_write_datapoint "testnet-deploy,name=$netBasename stop=1"
$metrics_write_datapoint "testnet-deploy,name=$netName stop=1"
client_start() { client_start() {
declare vmName=$1 declare vmName=$1
@ -261,9 +268,9 @@ client_start() {
tmux new -s solana -d \" \ tmux new -s solana -d \" \
set -x; \ set -x; \
sudo rm /tmp/solana.log; \ sudo rm /tmp/solana.log; \
/snap/bin/solana.bench-tps $SOLANA_NET_URL $fullnode_count --loop -s 600 --sustained -t \$threadCount 2>&1 | tee /tmp/solana.log; \ /snap/bin/solana.bench-tps $SOLANA_NET_ENTRYPOINT $fullnode_count --loop -s 600 --sustained -t \$threadCount 2>&1 | tee /tmp/solana.log; \
echo 'https://metrics.solana.com:8086/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}' \ echo 'https://metrics.solana.com:8086/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}' \
| xargs curl --max-time 5 -XPOST --data-binary 'testnet-deploy,name=$netName clientexit=1'; \ | xargs curl --max-time 5 -XPOST --data-binary 'testnet-deploy,name=$netBasename clientexit=1'; \
echo Error: bench-tps should never exit | tee -a /tmp/solana.log; \ echo Error: bench-tps should never exit | tee -a /tmp/solana.log; \
bash \ bash \
\"; \ \"; \
@ -446,6 +453,6 @@ wait_for_pids client shutdown
vm_foreach_in_class client client_start vm_foreach_in_class client client_start
# Add "network started" datapoint # Add "network started" datapoint
$metrics_write_datapoint "testnet-deploy,name=$netName start=1" $metrics_write_datapoint "testnet-deploy,name=$netBasename start=1"
exit 0 exit 0