Skip to content

Commit

Permalink
Optimized start_nodes script to speed up GCE nodes start time
Browse files Browse the repository at this point in the history
- Reduced dependency on local network
- Validators get binaries (solana bins and scripts) from leader node
  • Loading branch information
pgarg66 authored and garious committed Jul 11, 2018
1 parent 2710ff2 commit 45ff142
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions multinode-demo/start_nodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,12 @@ for ip_addr in "${ip_addr_array[@]}"; do
ssh-keygen -R "$ip_addr"
ssh-keyscan "$ip_addr" >>~/.ssh/known_hosts

ssh "$remote_user@$ip_addr" 'mkdir ~/.ssh'
ssh "$remote_user@$ip_addr" 'mkdir -p ~/.ssh ~/solana ~/.cargo/bin'

# Killing sshguard for now. TODO: Find a better solution
# sshguard is blacklisting IP address after ssh-keyscan and ssh login attempts
ssh -n -f "$remote_user@$ip_addr" "sudo service sshguard stop"
ssh -n -f "$remote_user@$ip_addr" 'sudo apt-get --assume-yes install rsync'

if [[ -n $leader ]]; then
echo "Adding known hosts for $ip_addr"
ssh -n -f "$remote_user@$ip_addr" "ssh-keygen -R $leader"
ssh -n -f "$remote_user@$ip_addr" "ssh-keyscan $leader >> ~/.ssh/known_hosts"
fi

# Deploy build and scripts to remote node
ssh "$remote_user@$ip_addr" 'mkdir ~/solana'
rsync -vPrz ~/.cargo/bin "$remote_user"@"$ip_addr":~/.cargo
rsync -vPrz ./multinode-demo "$remote_user"@"$ip_addr":~/solana/
ssh -n -f "$remote_user@$ip_addr" 'sudo apt-get --assume-yes install rsync libssl-dev'

# If provided, deploy SSH keys
if [[ -z $ssh_keys ]]; then
Expand All @@ -75,7 +64,18 @@ for ip_addr in "${ip_addr_array[@]}"; do
ssh "$remote_user@$ip_addr" 'pkill -9 solana-fullnode'
ssh "$remote_user@$ip_addr" 'pkill -9 solana-client-demo'

ssh "$remote_user@$ip_addr" 'sudo apt-get --assume-yes install libssl-dev'
if [[ -n $leader ]]; then
echo "Adding known hosts for $ip_addr"
ssh -n -f "$remote_user@$ip_addr" "ssh-keygen -R $leader"
ssh -n -f "$remote_user@$ip_addr" "ssh-keyscan $leader >> ~/.ssh/known_hosts"

ssh "$remote_user@$ip_addr" "rsync -vPrz ""$remote_user@$leader"":~/.cargo/bin/solana* ~/.cargo/bin/"
ssh "$remote_user@$ip_addr" "rsync -vPrz ""$remote_user@$leader"":~/solana/multinode-demo ~/solana/"
else
# Deploy build and scripts to remote node
rsync -vPrz ~/.cargo/bin/solana* "$remote_user@$ip_addr":~/.cargo/bin/
rsync -vPrz ./multinode-demo "$remote_user@$ip_addr":~/solana/
fi

# Run setup
ssh "$remote_user@$ip_addr" "$ssh_command_prefix"'setup.sh -p "$ip_addr"'
Expand Down

0 comments on commit 45ff142

Please sign in to comment.