Skip to content

Commit

Permalink
fix: Changing a Nondisruptive Deployment Script (#108)
Browse files Browse the repository at this point in the history
* fix: fix script

* fix: script

* fix: script
  • Loading branch information
jinsu4755 authored Jul 31, 2023
1 parent 1635102 commit cf90a56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions scripts/health_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DEFAULT_PATH=/home/ubuntu/uni-sparkle-deploy/uni-sparkle

CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1)
TARGET_PORT=8081
TARGET_PORT=0

if [ ${CURRENT_PORT} -eq "8081" ]; then
TARGET_PORT=8082
Expand All @@ -18,13 +18,14 @@ echo ">> http://localhost:${TARGET_PORT} 의 상태를 체크합니다"

for RETRY_COUNT in 1 2 3 4 5 6 7 8 9 10; do
echo ">> ${RETRY_COUNT} trying ..."
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:${CURRENT_PORT}/status/uni/health)
RESPONSE=$(curl -s http://127.0.0.1:${TARGET_PORT}/status/uni/health)
UP_COUNT=$(echo $RESPONSE | grep 'UP' | wc -l)

if [ ${RESPONSE_CODE} -eq 200 ]; then
if [ ${UP_COUNT} -ge 1 ]; then
echo ">> 서비스가 성공적으로 작동 중 입니다"
break
else
echo ">> ${RESPONSE_CODE}"
echo ">> ${RESPONSE}"
fi
if [ ${RETRY_COUNT} -eq 10 ]; then
echo ">> 서비스가 작동중이지 않습니다"
Expand Down
2 changes: 1 addition & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ JAR_NAME=$(ls ${DEFAULT_PATH}/build/libs/ | grep '.jar' | tail -n 1)
JAR_PATH=${DEFAULT_PATH}/build/libs/${JAR_NAME}

CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1)
TARGET_PORT=8081
TARGET_PORT=0

echo ">> 현재 nginx의 port = ${CURRENT_PORT}"

Expand Down
2 changes: 1 addition & 1 deletion scripts/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DEFAULT_PATH=/home/ubuntu/uni-sparkle-deploy/uni-sparkle

CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1)
TARGET_PORT=8081
TARGET_PORT=0

echo ">> 현재 nginx의 port = ${CURRENT_PORT}"

Expand Down

0 comments on commit cf90a56

Please sign in to comment.