Skip to content

Commit

Permalink
Update deploy-blue-green.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
juno-junho authored Apr 18, 2024
1 parent 54706fa commit 5f5bb1b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/deploy-blue-green.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,25 @@ IDLE_APPLICATION_PATH=$DEPLOY_PATH$IDLE_APPLICATION
# jar 파일과 blue/green-SpaceClub.jar와 심볼릭 링크 생성
ln -Tfs $DEPLOY_PATH$JAR_NAME $IDLE_APPLICATION_PATH

echo "> $IDLE_PROFILE 에서 구동중인 애플리케이션 pid 확인"
IDLE_PID=$(pgrep -f $IDLE_APPLICATION)
if [ -z $IDLE_PID ]
then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다."
else
echo "> kill -15 $IDLE_PID"
kill -15 $IDLE_PID
sleep 5
fi

echo "> $IDLE_PROFILE 배포"
sudo nohup java -jar $IDLE_APPLICATION_PATH --spring.profiles.active=develop,$IDLE_PROFILE --jasypt.encryptor.password=${encrypt} ----bad-word.path=$PROFANITY_LIST_LOCATION_TO_STORE > /home/ubuntu/log/nohup_log.out 2> /home/ubuntu/log/nohup_error.out &

echo "> 배포 후 기존 실행하던 애플리케이션을 종료합니다."
echo "> $PROFILE_BLUE, $PROFILE_GREEN 중에서 에서 구동중인 애플리케이션 pid 확인합니다."
if [ $IDLE_PROFILE = blue ] # idle profile이 blue이면 green을 종료
then
APPLICATION_TO_KILL = green-SpaceClub.jar
APPLICATION_TO_KILL = "green-SpaceClub.jar"
IDLE_PID=$(pgrep -f $APPLICATION_TO_KILL)
if [ -z $IDLE_PID ]
then
Expand All @@ -66,7 +77,7 @@ then
fi
elif [ $IDLE_PROFILE == green ] # idle profile이 green이면 blue를 종료
then
APPLICATION_TO_KILL = blue-SpaceClub.jar
APPLICATION_TO_KILL = "blue-SpaceClub.jar"
IDLE_PID=$(pgrep -f $APPLICATION_TO_KILL)
if [ -z $IDLE_PID ]
then
Expand Down

0 comments on commit 5f5bb1b

Please sign in to comment.