diff --git a/nodes/deploy/deploy.bash b/nodes/deploy/deploy.bash index 865b33b3..fb70d9e3 100755 --- a/nodes/deploy/deploy.bash +++ b/nodes/deploy/deploy.bash @@ -24,6 +24,8 @@ PARAMETERS_ENV_PATH="${SECRETS_DIR}/app.env" AWS_SSM_PARAMETER_PATH="${AWS_SSM_PARAMETER_PATH:-/moonstream/prod}" SCRIPT_DIR="$(realpath $(dirname $0))" PARAMETERS_SCRIPT="${SCRIPT_DIR}/parameters.py" +NODE_BALANCER_CONFIG_PATH="${NODE_BALANCER_CONFIG_PATH:-/home/ubuntu/.nodebalancer/config.txt}" +NODE_BALANCER_CONFIG_SOURCE_FILE="node-balancer-config.txt" # Service file NODE_BALANCER_SERVICE_FILE="node-balancer.service" @@ -59,6 +61,11 @@ cd "${APP_NODES_DIR}/node_balancer" HOME=/root /usr/local/go/bin/go build -o "${APP_NODES_DIR}/node_balancer/nodebalancer" "${APP_NODES_DIR}/node_balancer/main.go" cd "${EXEC_DIR}" +echo +echo +echo -e "${PREFIX_INFO} Update nodebalancer configuration file" +cp "${SCRIPT_DIR}/${NODE_BALANCER_CONFIG_SOURCE_FILE}" "${NODE_BALANCER_CONFIG_PATH}" + echo echo echo -e "${PREFIX_INFO} Replacing existing load balancer for nodes service definition with ${NODE_BALANCER_SERVICE_FILE}" diff --git a/nodes/deploy/node-balancer-config.txt b/nodes/deploy/node-balancer-config.txt new file mode 100644 index 00000000..cc203e88 --- /dev/null +++ b/nodes/deploy/node-balancer-config.txt @@ -0,0 +1,5 @@ +ethereum,a.ethereum.moonstream.internal,8545 +ethereum,b.ethereum.moonstream.internal,8545 +polygon,a.polygon.moonstream.internal,8545 +polygon,b.polygon.moonstream.internal,8545 +xdai,a.xdai.moonstream.internal,8545 \ No newline at end of file diff --git a/nodes/deploy/node-balancer.service b/nodes/deploy/node-balancer.service index 908fc99f..173f23ca 100644 --- a/nodes/deploy/node-balancer.service +++ b/nodes/deploy/node-balancer.service @@ -11,7 +11,11 @@ WorkingDirectory=/home/ubuntu/moonstream/nodes/node_balancer EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env Restart=on-failure RestartSec=15s -ExecStart=/home/ubuntu/moonstream/nodes/node_balancer/nodebalancer -host "${AWS_LOCAL_IPV4}" -port 8544 -healthcheck +ExecStart=/home/ubuntu/moonstream/nodes/node_balancer/nodebalancer \ + -host "${AWS_LOCAL_IPV4}" \ + -port 8544 \ + -healthcheck \ + -config /home/ubuntu/.nodebalancer/config.txt SyslogIdentifier=node-balancer [Install] diff --git a/nodes/node_balancer/configs/version.go b/nodes/node_balancer/configs/version.go index 3232a22a..50b18240 100644 --- a/nodes/node_balancer/configs/version.go +++ b/nodes/node_balancer/configs/version.go @@ -1,3 +1,3 @@ package configs -var NB_VERSION = "0.0.1" +var NB_VERSION = "0.0.2"