-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add script to refresh testnet nodes #600
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
# | ||
# Refreshes the Solana software running on the Testnet full nodes | ||
# | ||
# This script must be run by a user/machine that has successfully authenticated | ||
# with GCP and has sufficient permission. | ||
# | ||
|
||
if [[ -z $SOLANA_METRICS_CONFIG ]]; then | ||
echo Error: SOLANA_METRICS_CONFIG environment variable is unset | ||
exit 1 | ||
fi | ||
|
||
# Default to --edge channel. To select the beta channel: | ||
# export SOLANA_METRICS_CONFIG=--beta | ||
if [[ -z $SOLANA_SNAP_CHANNEL ]]; then | ||
SOLANA_SNAP_CHANNEL=--edge | ||
fi | ||
|
||
vmlist=(testnet-solana-com:us-west1-b) # Leader is hard coded as the first entry | ||
|
||
echo "--- Available validators" | ||
gcloud compute instances list --filter="labels.testnet-mode=validator" | ||
while read -r vmName vmZone status; do | ||
if [[ $status != RUNNING ]]; then | ||
echo "Warning: $vmName is not RUNNING, ignoring it." | ||
continue | ||
fi | ||
vmlist+=("$vmName:$vmZone") | ||
done < <(gcloud compute instances list --filter="labels.testnet-mode=validator" --format 'value(name,zone,status)') | ||
|
||
|
||
echo "--- Refreshing" | ||
mode=leader+drone | ||
for info in "${vmlist[@]}"; do | ||
vmName=${info%:*} | ||
vmZone=${info#*:} | ||
echo "Starting refresh for $vmName" | ||
|
||
( | ||
echo "--- Processing $vmName in zone $vmZone as $mode" | ||
cat > "autogen-refresh-$vmName.sh" <<EOF | ||
set -x | ||
sudo snap remove solana | ||
sudo snap install solana $SOLANA_SNAP_CHANNEL --devmode | ||
sudo snap set solana mode=$mode metrics-config=$SOLANA_METRICS_CONFIG | ||
snap info solana | ||
sudo snap logs solana -n200 | ||
EOF | ||
set -x | ||
gcloud compute scp --zone "$vmZone" "autogen-refresh-$vmName.sh" "$vmName": | ||
gcloud compute ssh "$vmName" --zone "$vmZone" \ | ||
--ssh-flag="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -t" \ | ||
--command="bash ./autogen-refresh-$vmName.sh" | ||
) > "log-$vmName.txt" 2>&1 & | ||
mode=validator | ||
done | ||
|
||
echo "Waiting..." | ||
wait | ||
|
||
for info in "${vmlist[@]}"; do | ||
vmName=${info%:*} | ||
cat "log-$vmName.txt" | ||
done | ||
|
||
echo "--- done" | ||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we're ready to flip to a tagged release,
SOLANA_METRICS_CONFIG=--beta
gets defined in the buildkite pipeline configuration