Skip to content

Commit

Permalink
#7 hotfix: appspec.yml 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yo0oni committed Jan 22, 2024
1 parent 1f0461e commit 2aeab47
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
mysql user: ${DB_USERNAME}
mysql password: ${DB_PASSWORD}

- name: Make zip file
working-directory: ./backend
run: zip -qq -r ./$GITHUB_SHA.zip .
shell: bash

- name: Configure AWS credential
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
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.

16 changes: 4 additions & 12 deletions appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ version: 0.0
os: linux

files:
- source: /
destination: /home/ubuntu/spring-github-action
overwrite: yes

permissions:
- object: /
owner: ubuntu
group: ubuntu
- source: /
destination: /home/ubuntu/app # 인스턴스에서 파일이 저장될 위치

hooks:
AfterInstall:
- location: scripts/stop.sh
- location: scripts/deploy.sh
timeout: 60
ApplicationStart:
- location: scripts/start.sh
timeout: 60
runas: ubuntu
22 changes: 22 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 -f $APP_NAME)

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

echo "> $JAR_PATH 배포" #3
nohup java -jar \
-Dspring.profiles.active=dev \
backend/build/libs/$JAR_NAME > $REPOSITORY/nohup.out 2>&1 &
19 changes: 0 additions & 19 deletions scripts/start.sh

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/stop.sh

This file was deleted.

0 comments on commit 2aeab47

Please sign in to comment.