From 303d0a093483153bf84c13783dc9738efda176cb Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Tue, 3 Jul 2018 06:28:12 -0700 Subject: [PATCH] Optimized start_nodes script to speed up GCE nodes start time - Reduced dependency on local network - Validators get binaries (solana bins and scripts) from leader node --- multinode-demo/start_nodes.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/multinode-demo/start_nodes.sh b/multinode-demo/start_nodes.sh index 5014633a2709dd..1d3bb07d81c3b4 100755 --- a/multinode-demo/start_nodes.sh +++ b/multinode-demo/start_nodes.sh @@ -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 @@ -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"'