laconic-network-bootstrap/scripts/04-create-deployments.sh
2024-07-08 06:22:16 -06:00

44 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
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
machine_domain=borgboxes.network
node_count=4
node_network_dir=testnet-dir
so_command=/home/laconic/bin/laconic-so
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"
echo "Creating deployment dir on ${node_name}"
ssh laconic@${node_host_name} ${so_command} --stack mainnet-laconic deploy init --map-ports-to-host any-same --output ${spec_file_name} --config ${laconic_console_config}
ssh laconic@${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}
done