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 16, 2024
1 parent ecc7bff commit 48845a2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/deploy-blue-green.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ DEPLOY_PATH=$REPOSITORY/jar/
cp $JAR_PATH $DEPLOY_PATH

echo "> 현재 구동중인 SET 확인"
CURRENT_PROFILE=$(curl -s http://localhost/api/profile)
echo "> $CURRENT_PROFILE"
PROFILE_BLUE=$(curl -s http://localhost:8081/api/profile)
PROFILE_GREEN=$(curl -s http://localhost:8082/api/profile)
echo "> BLUE : $PROFILE_BLUE GREEN : $PROFILE_GREEN"

# 쉬고 있는 set 찾기: blue가 사용중이면 green이 쉬고 있고, 반대면 blue가 쉬고 있음
if [ $CURRENT_PROFILE == blue ]
if [ $PROFILE_BLUE == blue ]
then
IDLE_PROFILE=green
IDLE_PORT=8082
elif [ $CURRENT_PROFILE == green ]
elif [ $PROFILE_GREEN == green ]
then
IDLE_PROFILE=blue
IDLE_PORT=8081
else
echo "> 일치하는 Profile이 없습니다. Profile: $CURRENT_PROFILE"
echo "> 일치하는 Profile이 없습니다. Profile: $PROFILE_BLUE $PROFILE_GREEN"
echo "> BLUE를 할당합니다. IDLE_PROFILE: blue"
IDLE_PROFILE=blue
IDLE_PORT=8081
Expand Down Expand Up @@ -90,5 +91,6 @@ do
done

echo "> 스위칭"
sudo chmod +x /home/ubuntu/action/scripts/switch.sh
sleep 10
$REPOSITORY/scripts/switch.sh
$REPOSITORY/action/scripts/switch.sh

0 comments on commit 48845a2

Please sign in to comment.