From 9c1c5d5cada77a55f3af1323f815a29f6a0ecf23 Mon Sep 17 00:00:00 2001 From: Yechan Kim Date: Thu, 25 Mar 2021 13:15:26 +0900 Subject: [PATCH 1/5] 'hollaex pull' on every 'hollaex cloud' command operations --- hollaex | 10 ++++++++++ version | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hollaex b/hollaex index 0176b08..3d0451a 100755 --- a/hollaex +++ b/hollaex @@ -1617,11 +1617,15 @@ elif [[ "$1" == "pull" ]]; then --request GET \ https://$ENVIRONMENT_HOLLAEX_NETWORK_TARGET_SERVER/v2/exchange) + echo $BITHOLLA_ACCOUNT_TOKEN + BITHOLLA_USER_EXCHANGE_LIST=$(curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BITHOLLA_ACCOUNT_TOKEN"\ --request GET \ https://$ENVIRONMENT_HOLLAEX_NETWORK_TARGET_SERVER/v2/exchange \ | jq '.') + echo $BITHOLLA_USER_EXCHANGE_LIST + if [[ ! "$BITHOLLA_USER_TOKEN_EXPIRY_CHECK" ]] || [[ ! "$BITHOLLA_USER_TOKEN_EXPIRY_CHECK" == "200" ]]; then printf "\033[91mFailed to pull the exchange data from bitHolla.\033[39m\n\n" @@ -6210,6 +6214,12 @@ elif [[ "$1" == "cloud" ]]; then # # # END # # # + BITHOLLA_USER_EXCHANGE_LIST=$(echo $HOLLAEX_CLOUD_GET_EXCHANGE_INFO_REQUEST | jq '.') + + BITHOLLA_USER_EXCHANGE_ORDER=EXCHANGE_ARRAY_ORDER + + hollaex_pull_and_apply_exchange_data; + if [[ "$HOLLAEX_CLOUD_START" ]]; then echo -e "\nSending a request to start the stopped exchange on the HollaCloud..." diff --git a/version b/version index ed35d09..fee3c92 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.9 \ No newline at end of file +2.0.10 \ No newline at end of file From 6babc5d61852a6cc1ef265e0f2d61de8f657b73f Mon Sep 17 00:00:00 2001 From: Yechan Kim Date: Thu, 25 Mar 2021 13:23:13 +0900 Subject: [PATCH 2/5] Update hollaex --- hollaex | 2 -- 1 file changed, 2 deletions(-) diff --git a/hollaex b/hollaex index 3d0451a..29d14c9 100755 --- a/hollaex +++ b/hollaex @@ -1617,14 +1617,12 @@ elif [[ "$1" == "pull" ]]; then --request GET \ https://$ENVIRONMENT_HOLLAEX_NETWORK_TARGET_SERVER/v2/exchange) - echo $BITHOLLA_ACCOUNT_TOKEN BITHOLLA_USER_EXCHANGE_LIST=$(curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BITHOLLA_ACCOUNT_TOKEN"\ --request GET \ https://$ENVIRONMENT_HOLLAEX_NETWORK_TARGET_SERVER/v2/exchange \ | jq '.') - echo $BITHOLLA_USER_EXCHANGE_LIST if [[ ! "$BITHOLLA_USER_TOKEN_EXPIRY_CHECK" ]] || [[ ! "$BITHOLLA_USER_TOKEN_EXPIRY_CHECK" == "200" ]]; then From c1cad2f56b978baedcc37eb4e5bcd2a21571f55f Mon Sep 17 00:00:00 2001 From: Yechan Kim Date: Tue, 30 Mar 2021 11:52:09 +0900 Subject: [PATCH 3/5] Minor version update for the database backup cronjob psql --- .../templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/helm-chart/bitholla-hollaex-postgres-s3-backup-cronjob/templates/deployment.yaml b/kubernetes/helm-chart/bitholla-hollaex-postgres-s3-backup-cronjob/templates/deployment.yaml index 95dd78b..54552b7 100644 --- a/kubernetes/helm-chart/bitholla-hollaex-postgres-s3-backup-cronjob/templates/deployment.yaml +++ b/kubernetes/helm-chart/bitholla-hollaex-postgres-s3-backup-cronjob/templates/deployment.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: postgres-backup-to-s3 - image: bitholla/postgres-s3-backup-cronjob:psql12.4-awscli + image: bitholla/postgres-s3-backup-cronjob:psql12.6-awscli env: - name: AWS_BUCKET value: {{.Values.awsBucket}} From 65a1b992bdb2e11e918763c88959062ea479d9e6 Mon Sep 17 00:00:00 2001 From: Yechan Kim Date: Tue, 30 Mar 2021 12:36:41 +0900 Subject: [PATCH 4/5] Added a logic to drop old ingress rules if it exists on the kubernetes --- hollaex | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/hollaex b/hollaex index 29d14c9..7f448d9 100755 --- a/hollaex +++ b/hollaex @@ -3356,6 +3356,16 @@ elif [[ "$1" == "apply" ]]; then kubectl delete -f $TEMPLATE_GENERATE_PATH/kubernetes/config/$ENVIRONMENT_EXCHANGE_NAME-ingress.yaml fi + + # DROP OLD INGRESS RULES IF IT EXISTS ON THE CLUSTER + if command kubectl get ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-order -n $ENVIRONMENT_EXCHANGE_NAME > /dev/null; then + + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-order + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-admin + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-explorer + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-docs + + fi run_and_upgrade_hollaex_on_kubernetes; @@ -3684,6 +3694,16 @@ elif [[ "$1" == "terminate" ]]; then fi + # DROP OLD INGRESS RULES IF IT EXISTS ON THE CLUSTER + if command kubectl get ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-order -n $ENVIRONMENT_EXCHANGE_NAME > /dev/null; then + + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-order + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-admin + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-explorer + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-docs + + fi + echo "Running a final backup for the exchange database." if ! command hollaex toolbox --backup --kube; then @@ -5112,6 +5132,16 @@ elif [[ "$1" == "toolbox" ]]; then echo "Deleting Ingress rules for the exchange..." kubectl delete -f $TEMPLATE_GENERATE_PATH/kubernetes/config/$ENVIRONMENT_EXCHANGE_NAME-ingress.yaml + # DROP OLD INGRESS RULES IF IT EXISTS ON THE CLUSTER + if command kubectl get ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-order -n $ENVIRONMENT_EXCHANGE_NAME > /dev/null; then + + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-order + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-admin + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-api-explorer + kubectl delete -n $ENVIRONMENT_EXCHANGE_NAME ingress/$ENVIRONMENT_EXCHANGE_NAME-ingress-docs + + fi + if [[ "$ENVIRONMENT_KUBERNETES_RUN_POSTGRESQL_DB" ]]; then From 64291a1bc4d8ae03fdcf449b66e1106adc572f70 Mon Sep 17 00:00:00 2001 From: Yechan Kim Date: Tue, 30 Mar 2021 15:30:21 +0900 Subject: [PATCH 5/5] Set 'hollaex cloud' command to run 'hollaex pull' before doing any cloud operations --- hollaex | 6 +----- tools_generator.sh | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hollaex b/hollaex index 7f448d9..9b727b5 100755 --- a/hollaex +++ b/hollaex @@ -6242,11 +6242,7 @@ elif [[ "$1" == "cloud" ]]; then # # # END # # # - BITHOLLA_USER_EXCHANGE_LIST=$(echo $HOLLAEX_CLOUD_GET_EXCHANGE_INFO_REQUEST | jq '.') - - BITHOLLA_USER_EXCHANGE_ORDER=EXCHANGE_ARRAY_ORDER - - hollaex_pull_and_apply_exchange_data; + hollaex pull --skip if [[ "$HOLLAEX_CLOUD_START" ]]; then diff --git a/tools_generator.sh b/tools_generator.sh index e8805c7..79e4b80 100644 --- a/tools_generator.sh +++ b/tools_generator.sh @@ -2794,12 +2794,11 @@ function hollaex_pull_and_apply_exchange_data() { #LOGO PATH ESCAPING local ORIGINAL_CHARACTER_FOR_LOGO_IMAGE=$(echo $BITHOLLA_USER_EXCHANGE_LIST | jq -r ".data[$BITHOLLA_USER_EXCHANGE_ORDER].info.biz.LOGO_IMAGE";) - local HOLLAEX_CONFIGMAP_LOGO_IMAGE_OVERRIDE="${ORIGINAL_CHARACTER_FOR_LOGO_PATH//\//\\/}" + local HOLLAEX_CONFIGMAP_LOGO_IMAGE_OVERRIDE="${ORIGINAL_CHARACTER_FOR_LOGO_IMAGE//\//\\/}" # Set the default HollaEx Server version as the maximum compatible version of the current release of CLI. local ENVIRONMENT_DOCKER_IMAGE_VERSION_OVERRIDE="$(cat $HOLLAEX_CLI_INIT_PATH/server/package.json | jq -r '.version')" - # CONFIGMAP sed -i.bak "s/ENVIRONMENT_EXCHANGE_NAME=.*/ENVIRONMENT_EXCHANGE_NAME=$ENVIRONMENT_EXCHANGE_NAME_OVERRIDE/" $CONFIGMAP_FILE_PATH