laconic-network-bootstrap/scripts/02-init-network-dirs.sh

30 lines
1.2 KiB
Bash
Raw Normal View History

2024-07-08 12:22:16 +00:00
#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
2024-07-12 15:38:36 +00:00
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/lib.sh
2024-07-08 12:22:16 +00:00
if [[ -n "$1" ]]; then
machine_name_prefix=$1
else
echo "Usage: $0 <machine-name-prefix>"
exit 1
fi
echo "Initializing network dirs on all nodes"
for (( i=1 ; i<=$node_count ; i++ ));
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 ${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}
2024-07-31 17:34:16 +00:00
# Change file ownership in the network dir to work around root-only container issue
change_dir_ownership ${node_host_name} ${node_network_dir}
2024-07-08 12:22:16 +00:00
echo "Running join-network ${node_network_dir} on ${node_host_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}
2024-07-31 17:34:16 +00:00
change_dir_ownership ${node_host_name} ${node_network_dir}
2024-07-08 12:22:16 +00:00
done