Use ssh user from config #2

Merged
dboreham merged 2 commits from dboreham/use-ssh-user into main 2024-07-13 18:51:41 +00:00
6 changed files with 12 additions and 13 deletions
Showing only changes of commit b15ab16adc - Show all commits

View File

@ -20,7 +20,7 @@ do
node_name=${machine_name_prefix}-${i}
node_host_name=${node_name}.${machine_domain}
echo "Running initialize-network ${node_network_dir} on ${node_host_name}"
ssh laconic@${node_host_name} /home/laconic/bin/laconic-so --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --initialize-network --chain-id ${chain_id} --node-moniker ${node_name}
ssh ${ssh_user}@${node_host_name} ${so_command} --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --initialize-network --chain-id ${chain_id} --node-moniker ${node_name}
echo "Running join-network ${node_network_dir} on ${node_host_name}"
ssh laconic@${node_host_name} /home/laconic/bin/laconic-so --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --join-network --key-name ${node_name}
ssh ${ssh_user}@${node_host_name} ${so_command} --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --join-network --key-name ${node_name}
done

View File

@ -14,9 +14,6 @@ else
exit 1
fi
p2p_port="26656"
so_command=/home/laconic/bin/laconic-so
gentx_dir=${node_network_dir}/config/gentx
local_gentx_dir=gentx-${machine_name_prefix}
@ -25,7 +22,7 @@ for (( i=1 ; i<=$node_count ; i++ ));
do
node_name=${machine_name_prefix}-${i}
node_host_name=${node_name}.${machine_domain}
gentx_file_name=$(ssh laconic@${node_host_name} ls /home/laconic/${gentx_dir} | head -1)
gentx_file_name=$(ssh ${ssh_user}@${node_host_name} ls /home/laconic/${gentx_dir} | head -1)
node_id=$(echo ${gentx_file_name} | sed -e 's/^gentx-//' -e 's/.json$//')
node_ip=$(dig +short ${node_host_name})
peer=${node_id}@${node_ip}:${p2p_port}
@ -49,8 +46,8 @@ done
echo "Copying gentx files to node 1"
node_1_host_name=${machine_name_prefix}-1.${machine_domain}
ssh laconic@${node_1_host_name} rm -rf ${local_gentx_dir}
ssh laconic@${node_1_host_name} mkdir ${local_gentx_dir}
ssh ${ssh_user}@${node_1_host_name} rm -rf ${local_gentx_dir}
ssh ${ssh_user}@${node_1_host_name} mkdir ${local_gentx_dir}
scp ${local_gentx_dir}/* laconic@${node_1_host_name}:~/${local_gentx_dir}
gentx_file_list=$(ssh laconic@${node_1_host_name} ls -m ${local_gentx_dir}/*)
@ -59,11 +56,11 @@ echo "Node 1 now has: ${gentx_file_list}"
gentx_files=$(echo ${gentx_file_list} | tr -d ' ' | tr -d '\n')
echo "Generate genesis on node 1"
ssh laconic@${node_1_host_name} ${so_command} --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --create-network --gentx-files ${gentx_files}
ssh ${ssh_user}@${node_1_host_name} ${so_command} --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --create-network --gentx-files ${gentx_files}
echo "Fetching genesis file from node 1"
local_genesis_file=${local_gentx_dir}/genesis.json
scp laconic@${node_1_host_name}:~/${node_network_dir}/config/genesis.json ${local_gentx_dir}
scp ${ssh_user}@${node_1_host_name}:~/${node_network_dir}/config/genesis.json ${local_gentx_dir}
echo "Copying genesis file to other nodes"
# Note: start at node 2 here because we're going to copy to node 1
@ -72,7 +69,7 @@ do
node_name=${machine_name_prefix}-${i}
node_host_name=${node_name}.${machine_domain}
echo "Copying ${local_genesis_file} to ${node_name} to ${node_name}"
scp ${local_genesis_file} laconic@${node_host_name}:~/${node_network_dir}/config
scp ${local_genesis_file} ${ssh_user}@${node_host_name}:~/${node_network_dir}/config
done
echo "Use this for persistent_peers:"

View File

@ -26,6 +26,6 @@ do
node_name=${machine_name_prefix}-${i}
node_host_name=${node_name}.${machine_domain}
echo "Deleting deployment dir on ${node_name}"
ssh laconic@${node_host_name} sudo rm -rf ${deployment_dir}
ssh ${ssh_user}@${node_host_name} sudo rm -rf ${deployment_dir}
done

View File

@ -21,6 +21,6 @@ for (( i=1 ; i<=$node_count ; i++ ));
do
node_name=${machine_name_prefix}-${i}.${machine_domain}
echo "Deleting ${node_network_dir} on ${node_name}"
ssh laconic@${node_name} rm -rf ${node_network_dir} ${local_gentx_dir}
ssh ${ssh_user}@${node_name} rm -rf ${node_network_dir} ${local_gentx_dir}
done

View File

@ -23,6 +23,7 @@ assert_defined "node_count"
assert_defined "ssh_user"
assert_defined "node_network_dir"
assert_defined "chain_id"
assert_defined "p2p_port"
# Hack until we fix PATH for remote sessions
so_command=/home/laconic/bin/laconic-so

View File

@ -3,3 +3,4 @@ node_count=4
ssh_user=laconic
node_network_dir=testnet-dir
chain_id=laconic_81337-6
p2p_port="26656"