From 1ce457358bd41093b6e090f66369b3285fdff8c4 Mon Sep 17 00:00:00 2001 From: "konu (Jin Geonwoo)" Date: Sat, 25 May 2024 16:55:20 +0900 Subject: [PATCH] =?UTF-8?q?[Setting]=20=EB=B0=B0=ED=8F=AC=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- planfit/scripts/deploy.sh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/planfit/scripts/deploy.sh b/planfit/scripts/deploy.sh index a2d87bd..ab5dbfa 100644 --- a/planfit/scripts/deploy.sh +++ b/planfit/scripts/deploy.sh @@ -1,4 +1,5 @@ #!/bin/bash + BUILD_PATH=$(ls /home/ubuntu/app/planfit-0.0.1-SNAPSHOT.jar) JAR_NAME=$(basename $BUILD_PATH) echo "> build 파일명: $JAR_NAME" @@ -12,12 +13,10 @@ BLUE_PROFILE=$(curl -s http://localhost/profile) echo "> $BLUE_PROFILE" # 쉬고 있는 set 찾기: set1이 사용중이면 set2가 쉬고 있고, 반대면 set1이 쉬고 있음 -if [ $BLUE_PROFILE == set1 ] -then +if [ "$BLUE_PROFILE" = "set1" ]; then GREEN_PROFILE=set2 GREEN_PORT=8082 -elif [ $BLUE_PROFILE == set2 ] -then +elif [ "$BLUE_PROFILE" = "set2" ]; then GREEN_PROFILE=set1 GREEN_PORT=8081 else @@ -52,18 +51,15 @@ do response=$(curl -s http://localhost:$GREEN_PORT/actuator/health) up_count=$(echo $response | grep 'UP' | wc -l) - if [ $up_count -ge 1 ] - then + if [ $up_count -ge 1 ]; then echo "> Health check 성공" - break else echo "> Health check의 응답을 알 수 없거나 혹은 status가 UP이 아닙니다." echo "> Health check: ${response}" fi - if [ $retry_count -eq 10 ] - then + if [ $retry_count -eq 10 ]; then echo "> Health check 실패. " echo "> Nginx에 연결하지 않고 배포를 종료합니다." exit 1 @@ -74,10 +70,9 @@ do done echo "> $BLUE_PROFILE 에서 구동중인 애플리케이션 pid 확인" -BLUE_PID=$(pgrep -f $BLUE_PROFILE-nowsopt.jar) +BLUE_PID=$(pgrep -f $BLUE_PROFILE-planfit.jar) -if [ -z $BLUE_PID ] -then +if [ -z "$BLUE_PID" ]; then echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." else echo "> 기존 ${BLUE_PROFILE} 서버 중단"