Skip to content

Commit

Permalink
#7 fix: 자동화를 위한 deploy.sh 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yo0oni committed Jan 28, 2024
1 parent c648979 commit e244d53
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
Empty file.
4 changes: 3 additions & 1 deletion .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
4 changes: 3 additions & 1 deletion .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions backend/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
REPOSITORY=/home/ubuntu/app
cd $REPOSITORY

APP_NAME=demo
JAR_NAME=$(ls $REPOSITORY/backend/build/libs/ | grep '.jar' | tail -n 1)
JAR_PATH=$REPOSITORY/backend/build/libs/$JAR_NAME
CURRENT_PID=$(pgrep -fl action | grep java | awk '{print $1}')

CURRENT_PID=$(pgrep -f $APP_NAME)
echo "현재 구동 중인 애플리케이션 pid: $CURRENT_PID"

if [ -z $CURRENT_PID ] #2
if [ -z "$CURRENT_PID" ]; then
then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다."
else
Expand All @@ -16,7 +14,15 @@ else
sleep 5
fi

echo "> $JAR_PATH 배포" #3
nohup java -jar \
-Dspring.profiles.active=dev \
backend/build/libs/$JAR_NAME > $REPOSITORY/nohup.out 2>&1 &
echo "> 새 애플리케이션 배포"
JAR_NAME=$(ls -tr $REPOSITORY/build/libs/*.jar | tail -n 1)

echo "> JAR NAME: $JAR_NAME"

echo "> $JAR_NAME 에 실행권한 추가"

chmod +x $JAR_NAME

echo "> $JAR_NAME 실행"
source ~/.bashrc
nohup java -jar $JAR_NAME > $REPOSITORY/build/libs/nohup.out 2>&1 &

0 comments on commit e244d53

Please sign in to comment.