Skip to content

Commit

Permalink
- Improved 'hollaex restart' to remove orphaned containers.
Browse files Browse the repository at this point in the history
- Removed '--wait' flag for helm api upgrade.
- Add safety to avoid user remove coins less than 2, pairs less than 1.
- Add logo path env for web client env generation.
- Fix coin name displaying issue at remove coin.
  • Loading branch information
kycfeel committed Dec 18, 2019
1 parent bb4152a commit 12d2fa0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
4 changes: 2 additions & 2 deletions hollaex
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ elif [[ "$1" == "restart" ]]; then

if command docker-compose -f $TEMPLATE_GENERATE_PATH/local/$ENVIRONMENT_EXCHANGE_NAME-docker-compose.yaml stop; then

if command docker-compose -f $TEMPLATE_GENERATE_PATH/local/$ENVIRONMENT_EXCHANGE_NAME-docker-compose.yaml up -d; then
if command docker-compose -f $TEMPLATE_GENERATE_PATH/local/$ENVIRONMENT_EXCHANGE_NAME-docker-compose.yaml up -d --remove-orphans; then

hollaex_ascii_exchange_is_up;

Expand Down Expand Up @@ -1937,7 +1937,7 @@ elif [[ "$1" == "upgrade" ]]; then
generate_nodeselector_values $ENVIRONMENT_KUBERNETES_EXCHANGE_NODESELECTOR hollaex

echo "Upgrading $HOLLAEX_CONFIGMAP_API_NAME Pods on Kubernetes."
helm upgrade --install $ENVIRONMENT_EXCHANGE_NAME-server-api --namespace $ENVIRONMENT_EXCHANGE_NAME --wait --recreate-pods --set DEPLOYMENT_MODE="api" --set imageRegistry="$ENVIRONMENT_USER_HOLLAEX_CORE_IMAGE_REGISTRY" --set dockerTag="$ENVIRONMENT_USER_HOLLAEX_CORE_IMAGE_VERSION" --set stable.replicaCount="2" --set autoScaling.hpa.enable="false" --set envName="$ENVIRONMENT_EXCHANGE_NAME-env" --set secretName="$ENVIRONMENT_EXCHANGE_NAME-secret" --set podRestart_webhook_url="$ENVIRONMENT_KUBERNETES_RESTART_NOTIFICATION_WEBHOOK_URL" -f $TEMPLATE_GENERATE_PATH/kubernetes/config/nodeSelector-hollaex.yaml -f $SCRIPTPATH/kubernetes/helm-chart/bitholla-hollaex-server/values.yaml $SCRIPTPATH/kubernetes/helm-chart/bitholla-hollaex-server
helm upgrade --install $ENVIRONMENT_EXCHANGE_NAME-server-api --namespace $ENVIRONMENT_EXCHANGE_NAME --recreate-pods --set DEPLOYMENT_MODE="api" --set imageRegistry="$ENVIRONMENT_USER_HOLLAEX_CORE_IMAGE_REGISTRY" --set dockerTag="$ENVIRONMENT_USER_HOLLAEX_CORE_IMAGE_VERSION" --set stable.replicaCount="2" --set autoScaling.hpa.enable="false" --set envName="$ENVIRONMENT_EXCHANGE_NAME-env" --set secretName="$ENVIRONMENT_EXCHANGE_NAME-secret" --set podRestart_webhook_url="$ENVIRONMENT_KUBERNETES_RESTART_NOTIFICATION_WEBHOOK_URL" -f $TEMPLATE_GENERATE_PATH/kubernetes/config/nodeSelector-hollaex.yaml -f $SCRIPTPATH/kubernetes/helm-chart/bitholla-hollaex-server/values.yaml $SCRIPTPATH/kubernetes/helm-chart/bitholla-hollaex-server

helm upgrade --install $ENVIRONMENT_EXCHANGE_NAME-server-stream --namespace $ENVIRONMENT_EXCHANGE_NAME --recreate-pods --set DEPLOYMENT_MODE="stream" --set imageRegistry="$ENVIRONMENT_USER_HOLLAEX_CORE_IMAGE_REGISTRY" --set dockerTag="$ENVIRONMENT_USER_HOLLAEX_CORE_IMAGE_VERSION" --set envName="$ENVIRONMENT_EXCHANGE_NAME-env" --set secretName="$ENVIRONMENT_EXCHANGE_NAME-secret" --set podRestart_webhook_url="$ENVIRONMENT_KUBERNETES_RESTART_NOTIFICATION_WEBHOOK_URL" -f $TEMPLATE_GENERATE_PATH/kubernetes/config/nodeSelector-hollaex.yaml -f $SCRIPTPATH/kubernetes/helm-chart/bitholla-hollaex-server/values.yaml $SCRIPTPATH/kubernetes/helm-chart/bitholla-hollaex-server

Expand Down
29 changes: 28 additions & 1 deletion tools_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,18 @@ function remove_coin_input() {

function remove_coin_exec() {

IFS=',' read -ra CURRENT_CURRENCIES <<< "${HOLLAEX_CONFIGMAP_CURRENCIES}"

if (( "${#CURRENT_CURRENCIES[@]}" <= "2" )); then

printf "\n\033[91mError: You should have at least 2 currencies on your exchange.\033[39m\n"
echo "Current Currencies : ${HOLLAEX_CONFIGMAP_CURRENCIES}."
printf "Exiting...\n\n"

exit 1;

fi

if [[ "$USE_KUBERNETES" ]]; then

# Only tries to attempt remove ingress rules from Kubernetes if it exists.
Expand Down Expand Up @@ -1972,7 +1984,7 @@ function remove_coin_exec() {
# Running database triggers
docker exec --env="CURRENCIES=${HOLLAEX_CONFIGMAP_CURRENCIES}" ${DOCKER_COMPOSE_NAME_PREFIX}_${ENVIRONMENT_EXCHANGE_NAME}-server${CONTAINER_PREFIX[0]}_1 node tools/dbs/runTriggers.js > /dev/null

echo "Coin $COIN_SYMBLE has been successfully removed."
echo "Coin $COIN_SYMBOL has been successfully removed."
echo "Please run 'hollaex restart' to apply it."

else
Expand Down Expand Up @@ -2617,6 +2629,18 @@ function remove_pair_input() {

function remove_pair_exec() {

IFS=',' read -ra CURRENT_PAIRS <<< "${HOLLAEX_CONFIGMAP_PAIRS}"

if (( "${#CURRENT_PAIRS[@]}" <= "1" )); then

printf "\n\033[91mError: You should have at least 1 trading pair on your exchange.\033[39m\n"
echo "Current Trading Pair(s) : ${HOLLAEX_CONFIGMAP_PAIRS}."
printf "Exiting...\n\n"

exit 1;

fi

if [[ "$USE_KUBERNETES" ]]; then

# # Only tries to attempt remove ingress rules from Kubernetes if it exists.
Expand Down Expand Up @@ -2837,6 +2861,9 @@ REACT_APP_CAPTCHA_SITE_KEY=${ENVIRONMENT_WEB_CAPTCHA_SITE_KEY}
REACT_APP_DEFAULT_LANGUAGE=${ENVIRONMENT_WEB_DEFAULT_LANGUAGE}
REACT_APP_DEFAULT_COUNTRY=${ENVIRONMENT_WEB_DEFAULT_COUNTRY}
REACT_APP_LOGO_PATH=${HOLLAEX_CONFIGMAP_LOGO_PATH}
REACT_APP_LOGO_BLACK_PATH=${HOLLAEX_CONFIGMAP_LOGO_BLACK_PATH}
EOL
}

Expand Down

0 comments on commit 12d2fa0

Please sign in to comment.