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 947a58d commit ecc7bff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/deploy-blue-green.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# jasypt 암호키 설정
source /home/ubuntu/action/scripts/properties.sh
source /home/ubuntu/action/scripts/properties.sh # jasypt 암호키 설정

PROJECT_NAME=space-club-backend
REPOSITORY=/home/ubuntu
Expand All @@ -10,6 +9,12 @@ JAR_NAME=$(ls -tr $PACKAGE | grep 'SNAPSHOT.jar' | tail -n 1)
JAR_PATH=$PACKAGE$JAR_NAME
echo "> build 파일명: $JAR_NAME"

# 금칙어 리스트 복사 (최신화)
PROFANITY_LIST_LOCATION_TO_STORE=$REPOSITORY/bad_word_list.txt
PROFANITY_LIST_LOCATION=$REPOSITORY/action/src/main/resources/secrets/bad_word_list.txt
echo "> 금칙어 list 복사"
cp $PROFANITY_LIST_LOCATION $PROFANITY_LIST_LOCATION_TO_STORE

echo "> build 파일 복사"
DEPLOY_PATH=$REPOSITORY/jar/
cp $JAR_PATH $DEPLOY_PATH
Expand All @@ -18,7 +23,7 @@ echo "> 현재 구동중인 SET 확인"
CURRENT_PROFILE=$(curl -s http://localhost/api/profile)
echo "> $CURRENT_PROFILE"

# 쉬고 있는 set 찾기: set1이 사용중이면 set2가 쉬고 있고, 반대면 set1이 쉬고 있음
# 쉬고 있는 set 찾기: blue가 사용중이면 green이 쉬고 있고, 반대면 blue가 쉬고 있음
if [ $CURRENT_PROFILE == blue ]
then
IDLE_PROFILE=green
Expand Down Expand Up @@ -53,7 +58,7 @@ else
fi

echo "> $IDLE_PROFILE 배포"
sudo nohup java -jar $IDLE_APPLICATION_PATH --spring.profiles.active=develop,$IDLE_PROFILE --jasypt.encryptor.password=${encrypt} > /home/ubuntu/log/nohup_log.out 2> /home/ubuntu/log/nohup_error.out &
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 "> $IDLE_PROFILE 10초 후 Health check 시작"
echo "> curl -s http://localhost:$IDLE_PORT/actuator/health "
Expand Down

0 comments on commit ecc7bff

Please sign in to comment.