-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#1 Feat: CI 구축
- Loading branch information
Showing
5 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,5 +37,4 @@ out/ | |
.vscode/ | ||
|
||
### DB ### | ||
application-*.yml | ||
**/.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 0.0 | ||
os: linux | ||
|
||
files: | ||
- source: / # 인스턴스에 복사할 디렉터리 경로 | ||
destination: /home/ec2-user/mapddang-back # 인스턴스에서 파일이 복사되는 위치 | ||
overwrite: yes # 복사할 위치에 파일이 있는 경우 대체 | ||
|
||
permissions: | ||
- object: / # 권한이 지정되는 파일 or 디렉터리 | ||
owner: ec2-user # object의 소유자 | ||
group: ec2-user # object의 그룹 이름 | ||
|
||
hooks: | ||
AfterInstall: # CodeDeploy의 AfterInstall 단계에서 실행 | ||
- location: scripts/stop.sh # hooks에서 실행할 스크립트의 위치 | ||
timeout: 60 # 스크립트 실행에 허용되는 최대 시간, 넘으면 배포 실패 | ||
|
||
ApplicationStart: # CodeDeploy의 ApplicationStart 단계에서 실행 | ||
- location: scripts/start.sh | ||
timeout: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PROJECT_ROOT="/home/ec2-user/mapddang-back" | ||
JAR_FILE="$PROJECT_ROOT/dnd-travel.jar" | ||
|
||
APP_LOG="$PROJECT_ROOT/application.log" | ||
ERROR_LOG="$PROJECT_ROOT/error.log" | ||
DEPLOY_LOG="$PROJECT_ROOT/deploy.log" | ||
|
||
TIME_NOW=$(date +%c) | ||
|
||
# build 파일 복사 | ||
echo "$TIME_NOW > $JAR_FILE 복사" >> $DEPLOY_LOG | ||
cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE | ||
|
||
# jar 파일 실행 | ||
echo "$TIME_NOW > $JAR_FILE 실행" >> $DEPLOY_LOG | ||
nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG & | ||
|
||
CURRENT_PID=$(pgrep -f $JAR_FILE) | ||
echo "$TIME_NOW > 서비스 PID: $CURRENT_PID " >> $DEPLOY_LOG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
PROJECT_ROOT="/home/ec2-user/mapddang-back" | ||
JAR_FILE="$PROJECT_ROOT/dnd-travel.jar" | ||
|
||
DEPLOY_LOG="$PROJECT_ROOT/deploy.log" | ||
|
||
TIME_NOW=$(date +%c) | ||
|
||
# 현재 구동 중인 애플리케이션 pid 확인 | ||
CURRENT_PID=$(pgrep -f $JAR_FILE) | ||
|
||
# 프로세스가 켜져 있으면 종료 | ||
if [ -z $CURRENT_PID ]; then | ||
echo "$TIME_NOW > 현재 실행 중인 애플리케이션이 없음" >> $DEPLOY_LOG | ||
else | ||
echo "$TIME_NOW > 실행 중인 $CURRENT_PID 애플리케이션 종료 " >> $DEPLOY_LOG | ||
kill -15 $CURRENT_PID | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
spring: | ||
datasource: | ||
url: ${{ secrets.MYSQL_URL }} | ||
username: ${{ secrets.MYSQL_USERNAME }} | ||
password: ${{ secrets.MYSQL_PASSWORD }} |