Skip to content

Commit

Permalink
chore: 배포 스크립트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
pushedrumex committed Feb 1, 2024
1 parent bd4faca commit 1ea4f20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/app
destination: /home/ubuntu/app/indp-server
overwrite: true

permissions:
Expand Down
16 changes: 8 additions & 8 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
PROJECT_ROOT=/app
PROJECT_ROOT=/home/ubuntu/app
PROJECT_NAME=indp-server
APPLICATION_NAME=indp

DEPLOY_PATH=$PROJECT_ROOT/deploy
DEPLOY_LOG=$DEPLOY_PATH/deploy.log

echo "✅ Build 파일 복사"
echo "✅ Build 파일 복사" >> $DEPLOY_LOG
cp $PROJECT_ROOT/$PROJECT_NAME/build/libs/*.jar $DEPLOY_PATH/

echo "✅ 현재 구동 중인 애플리케이션 pid 확인"
echo "✅ 현재 구동 중인 애플리케이션 pid 확인" >> $DEPLOY_LOG
CURRENT_PID=$(pgrep -f $APPLICATION_NAME.*.jar)

echo "✅ 현재 구동 중인 애플리케이션 pid: $CURRENT_PID"
echo "✅ 현재 구동 중인 애플리케이션 pid: $CURRENT_PID" >> $DEPLOY_LOG
if [ -z "$CURRENT_PID" ]; then
echo "✅ 현재 구동 중인 애플리케이션이 없으므로 종료하지 않습니다."
echo "✅ 현재 구동 중인 애플리케이션이 없으므로 종료하지 않습니다." >> $DEPLOY_LOG
else
echo "✅ kill -15 $CURRENT_PID"
echo "✅ kill -15 $CURRENT_PID" >> $DEPLOY_LOG
kill -15 "$CURRENT_PID"
sleep 5
fi

echo "✅ 새 어플리케이션 배포"
echo "✅ 새 어플리케이션 배포" >> $DEPLOY_LOG
JAR_NAME=$(ls -tr "$DEPLOY_PATH" | grep jar | tail -n 1)

echo "✅ JAR Name: $JAR_NAME"
echo "✅ JAR Name: $JAR_NAME" >> $DEPLOY_LOG
nohup java -jar $DEPLOY_PATH/$JAR_NAME --spring.profiles.active=dev > $DEPLOY_LOG 2>&1 &

0 comments on commit 1ea4f20

Please sign in to comment.