#!/usr/bin/env bash set -e if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source ${SCRIPT_DIR}/lib.sh usage="Usage: $0 " 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" 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} echo "Creating deployment dir on ${node_name}" 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} done