From 1dd2dcc2a3825d4d88852b8ee082cf8c2cbcc6d7 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Fri, 3 Mar 2023 14:29:49 -0300 Subject: [PATCH] (feat) improve gateway script --- bash_scripts/gateway-copy-certs.sh | 0 bash_scripts/gateway-create.sh | 33 ++++++++++++++++++++++-------- bash_scripts/hummingbot-create.sh | 0 bash_scripts/hummingbot-start.sh | 0 bash_scripts/hummingbot-update.sh | 0 5 files changed, 24 insertions(+), 9 deletions(-) mode change 100644 => 100755 bash_scripts/gateway-copy-certs.sh mode change 100644 => 100755 bash_scripts/gateway-create.sh mode change 100644 => 100755 bash_scripts/hummingbot-create.sh mode change 100644 => 100755 bash_scripts/hummingbot-start.sh mode change 100644 => 100755 bash_scripts/hummingbot-update.sh diff --git a/bash_scripts/gateway-copy-certs.sh b/bash_scripts/gateway-copy-certs.sh old mode 100644 new mode 100755 diff --git a/bash_scripts/gateway-create.sh b/bash_scripts/gateway-create.sh old mode 100644 new mode 100755 index a8f3b67..931a819 --- a/bash_scripts/gateway-create.sh +++ b/bash_scripts/gateway-create.sh @@ -57,13 +57,26 @@ prompt_passphrase GMT_OFFSET=$(date +%z) # Check available open port for Gateway -PORT=15888 -LIMIT=$((PORT+1000)) -while [[ $PORT -le LIMIT ]] +GATEWAY_PORT=15888 +LIMIT=$((GATEWAY_PORT+1000)) +while [[ $GATEWAY_PORT -le LIMIT ]] do - if [[ $(netstat -nat | grep "$PORT") ]]; then + if [[ $(netstat -nat | grep "$GATEWAY_PORT") ]]; then # check another port - ((PORT = PORT + 1)) + ((GATEWAY_PORT = GATEWAY_PORT + 1)) + else + break + fi +done + +# Check available open port for Gateway docs +DOCS_PORT=8080 +LIMIT=$((DOCS_PORT+1000)) +while [[ $DOCS_PORT -le LIMIT ]] + do + if [[ $(netstat -nat | grep "$DOCS_PORT") ]]; then + # check another port + ((DOCS_PORT = DOCS_PORT + 1)) else break fi @@ -80,7 +93,8 @@ printf "%30s %5s\n" "Hummingbot instance ID:" "$HUMMINGBOT_INSTANCE_ID" printf "%30s %5s\n" "Gateway conf path:" "$CONF_FOLDER" printf "%30s %5s\n" "Gateway log path:" "$LOGS_FOLDER" printf "%30s %5s\n" "Gateway certs path:" "$CERTS_FOLDER" -printf "%30s %5s\n" "Gateway port:" "$PORT" +printf "%30s %5s\n" "Gateway port:" "$GATEWAY_PORT" +printf "%30s %5s\n" "Gateway docs port:" "$DOCS_PORT" echo prompt_existing_certs_path () { @@ -140,7 +154,8 @@ create_instance () { # Launch a new instance of gateway docker run \ --name $INSTANCE_NAME \ - -p $PORT:$PORT \ + -p $GATEWAY_PORT:15888 \ + -p $DOCS_PORT:8080 \ -v $CONF_FOLDER:/usr/src/app/conf \ -v $LOGS_FOLDER:/usr/src/app/logs \ -v $CERTS_FOLDER:/usr/src/app/certs \ @@ -152,6 +167,6 @@ if [[ "$PROCEED" == "Y" || "$PROCEED" == "y" ]] then create_instance else - echo " Aborted" + echo "Aborted" echo -fi +fi \ No newline at end of file diff --git a/bash_scripts/hummingbot-create.sh b/bash_scripts/hummingbot-create.sh old mode 100644 new mode 100755 diff --git a/bash_scripts/hummingbot-start.sh b/bash_scripts/hummingbot-start.sh old mode 100644 new mode 100755 diff --git a/bash_scripts/hummingbot-update.sh b/bash_scripts/hummingbot-update.sh old mode 100644 new mode 100755