laconic-network-bootstrap/scripts/04-create-deployments.sh

45 lines
1.6 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
usage="Usage: $0 <machine-name-prefix> <peers>"
if [[ -n "$1" ]]; then
machine_name_prefix=$1
else
echo ${usage}
exit 1
fi
if [[ -n "$2" ]]; then
peers=$2
else
echo ${usage}
exit 1
fi
echo "Run deploy init on all nodes"
spec_file_name=${machine_name_prefix}-spec.yml
deployment_dir=${machine_name_prefix}-deployment
echo "Creating deployments on all nodes"
for (( i=1 ; i<=$node_count ; i++ ));
do
node_name=${machine_name_prefix}-${i}
node_host_name=${node_name}.${machine_domain}
laconic_console_config="LACONIC_HOSTED_ENDPOINT=http://${node_host_name}:9473"
2024-07-15 02:58:07 +00:00
explorer_api_config="LACONIC_LACONICD_API_URL=http://${node_host_name}:1317"
explorer_rpc_config="LACONIC_LACONICD_RPC_URL=http://${node_host_name}:26657"
explorer_chain_id_config="LACONIC_LACONICD_CHAIN_ID=${chain_id}"
deployment_config=${laconic_console_config},${explorer_api_config},${explorer_rpc_config},${explorer_chain_id_config}
2024-07-08 12:22:16 +00:00
echo "Creating deployment dir on ${node_name}"
2024-07-15 02:58:07 +00:00
ssh ${ssh_user}@${node_host_name} ${so_command} --stack mainnet-laconic deploy init --map-ports-to-host any-same --output ${spec_file_name} --config ${deployment_config}
ssh ${ssh_user}@${node_host_name} ${so_command} --stack mainnet-laconic deploy create --deployment-dir ${deployment_dir} --spec-file ${spec_file_name} --network-dir ${node_network_dir} --initial-peers ${peers}
2024-07-08 12:22:16 +00:00
done