From f53c27bafa16061e9c76c25b58f2c3c8cf367b86 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:29:55 +0900 Subject: [PATCH 01/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appspec.yml | 23 +++++++++++++++++++++++ build.gradle | 3 +++ scripts/start.sh | 21 +++++++++++++++++++++ scripts/stop.sh | 19 +++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 appspec.yml create mode 100644 scripts/start.sh create mode 100644 scripts/stop.sh diff --git a/appspec.yml b/appspec.yml new file mode 100644 index 0000000..9882a4f --- /dev/null +++ b/appspec.yml @@ -0,0 +1,23 @@ +version: 0.0 +os: linux + +files: + - source: / + destination: /home/ubuntu/app + overwrite: yes + +permissions: + - object: / + pattern: "**" + owner: ubuntu + group: ubuntu + +hooks: + AfterInstall: + - location: scripts/stop.sh + timeout: 60 + runas: ubuntu + ApplicationStart: + - location: scripts/start.sh + timeout: 60 + runas: ubuntu \ No newline at end of file diff --git a/build.gradle b/build.gradle index b43eea0..d9e70f4 100644 --- a/build.gradle +++ b/build.gradle @@ -42,3 +42,6 @@ dependencies { tasks.named('test') { useJUnitPlatform() } +jar { + enabled = false +} \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 0000000..126c2a2 --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +PROJECT_ROOT="/home/ubuntu/app" +JAR_FILE="$PROJECT_ROOT/spring-webapp.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 > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG \ No newline at end of file diff --git a/scripts/stop.sh b/scripts/stop.sh new file mode 100644 index 0000000..755d347 --- /dev/null +++ b/scripts/stop.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +PROJECT_ROOT="/home/ubuntu/app" +JAR_FILE="$PROJECT_ROOT/spring-webapp.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 \ No newline at end of file From b4a17012d4e395737e34f5437715589cc6b99d1a Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:37:43 +0900 Subject: [PATCH 02/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflow/deploy.yml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflow/deploy.yml diff --git a/.github/workflow/deploy.yml b/.github/workflow/deploy.yml new file mode 100644 index 0000000..f3e284f --- /dev/null +++ b/.github/workflow/deploy.yml @@ -0,0 +1,67 @@ +name: Deploy to Amazon EC2 + +on: + push: + branches: + - main + +# 본인이 설정한 값을 여기서 채워넣습니다. +# 리전, 버킷 이름, CodeDeploy 앱 이름, CodeDeploy 배포 그룹 이름 +env: + AWS_REGION: ap-northeast-2 + S3_BUCKET_NAME: growme-github-actions-s3-bucket + CODE_DEPLOY_APPLICATION_NAME: growme-codedeploy-app + CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: growme-codedeploy-app-group + +permissions: + contents: read + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + environment: production + + steps: + # (1) 기본 체크아웃 + - name: Checkout + uses: actions/checkout@v3 + + # (2) JDK 11 세팅 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + # (3) Gradle build (Test 제외) + - name: Build with Gradle + uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee + with: + arguments: clean build -x test + + # (4) AWS 인증 (IAM 사용자 Access Key, Secret Key 활용) + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + # (5) 빌드 결과물을 S3 버킷에 업로드 + - name: Upload to AWS S3 + run: | + aws deploy push \ + --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ + --ignore-hidden-files \ + --s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \ + --source . + + # (6) S3 버킷에 있는 파일을 대상으로 CodeDeploy 실행 + - name: Deploy to AWS EC2 from S3 + run: | + aws deploy create-deployment \ + --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ + --deployment-config-name CodeDeployDefault.AllAtOnce \ + --deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ + --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip \ No newline at end of file From 8a8538d42a183ea3731a94e396aff4d5625b5366 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:40:19 +0900 Subject: [PATCH 03/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/{workflow => workflows}/deploy.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflow => workflows}/deploy.yml (100%) diff --git a/.github/workflow/deploy.yml b/.github/workflows/deploy.yml similarity index 100% rename from .github/workflow/deploy.yml rename to .github/workflows/deploy.yml From 6afaba663ade2f240cc909a7ec7767a632286043 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:41:28 +0900 Subject: [PATCH 04/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f3e284f..a6f716a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: Deploy to Amazon EC2 on: push: branches: - - main + - testbaepo # 본인이 설정한 값을 여기서 채워넣습니다. # 리전, 버킷 이름, CodeDeploy 앱 이름, CodeDeploy 배포 그룹 이름 From bb6081286135d3666cc45948a1123525b1268eb1 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:15:20 +0900 Subject: [PATCH 05/23] Update deploy.yml --- .github/workflows/deploy.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a6f716a..426b889 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -64,4 +64,11 @@ jobs: --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ --deployment-config-name CodeDeployDefault.AllAtOnce \ --deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ - --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip \ No newline at end of file + --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip + + # ignore 값들 가져오기 + - name: make application.yml + run: | + touch ./src/main/resources/application.yml + echo "${{ secrets.APPLICATION }}" > /src/main/resources/application.yml + From bbf058ef47084f29c79e476a7ef9518811b7d93f Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:18:46 +0900 Subject: [PATCH 06/23] Update deploy.yml --- .github/workflows/deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 426b889..dffec2e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -69,6 +69,8 @@ jobs: # ignore 값들 가져오기 - name: make application.yml run: | - touch ./src/main/resources/application.yml - echo "${{ secrets.APPLICATION }}" > /src/main/resources/application.yml + mkdir -p ./src/main/resources + cd ./src/main/resources + touch ./application.yml + echo "${{ secrets.APPLICATION }}" > ./application.yml From 59f61cac28f43a226f0fea71a3050b688a6224c8 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:36:31 +0900 Subject: [PATCH 07/23] Update deploy.yml --- .github/workflows/deploy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dffec2e..fe46bc1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -70,7 +70,6 @@ jobs: - name: make application.yml run: | mkdir -p ./src/main/resources - cd ./src/main/resources touch ./application.yml - echo "${{ secrets.APPLICATION }}" > ./application.yml + echo "${{ secrets.APPLICATION }}" | base64 --decode > ./src/main/resources/application.yml From 15afa0c3575506864a75c16ad20a829d18ca0344 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:46:20 +0900 Subject: [PATCH 08/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/start.sh b/scripts/start.sh index 126c2a2..b0bf249 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -9,6 +9,10 @@ DEPLOY_LOG="$PROJECT_ROOT/deploy.log" TIME_NOW=$(date +%c) +# application.yml 내용 확인 (디버깅용) +echo "$TIME_NOW > application.yml 내용 확인" >> $DEPLOY_LOG +cat $PROJECT_ROOT/src/main/resources/application.yml >> $DEPLOY_LOG + # build 파일 복사 echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE From 8e7a331993d9d2e9dfecf0820b07db16f03f494c Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:53:09 +0900 Subject: [PATCH 09/23] Update deploy.yml --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fe46bc1..c4706a5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -72,4 +72,5 @@ jobs: mkdir -p ./src/main/resources touch ./application.yml echo "${{ secrets.APPLICATION }}" | base64 --decode > ./src/main/resources/application.yml + cat ./src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 From 83e1ca5ee94008538698263b53c7eaf72ff33a7f Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:03:07 +0900 Subject: [PATCH 10/23] Update deploy.yml --- .github/workflows/deploy.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c4706a5..878e06e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -69,8 +69,6 @@ jobs: # ignore 값들 가져오기 - name: make application.yml run: | - mkdir -p ./src/main/resources - touch ./application.yml - echo "${{ secrets.APPLICATION }}" | base64 --decode > ./src/main/resources/application.yml - cat ./src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 + touch ./src/main/resources/application.yml + echo "${{ secrets.APPLICATION }}" | base64 --decode > src/main/resources/application.yml From 90795ccc3fab602b6dd2271e90406fc033794783 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:07:36 +0900 Subject: [PATCH 11/23] Update deploy.yml --- .github/workflows/deploy.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 878e06e..c76b7ab 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,8 +5,6 @@ on: branches: - testbaepo -# 본인이 설정한 값을 여기서 채워넣습니다. -# 리전, 버킷 이름, CodeDeploy 앱 이름, CodeDeploy 배포 그룹 이름 env: AWS_REGION: ap-northeast-2 S3_BUCKET_NAME: growme-github-actions-s3-bucket @@ -23,24 +21,20 @@ jobs: environment: production steps: - # (1) 기본 체크아웃 - name: Checkout uses: actions/checkout@v3 - # (2) JDK 11 세팅 - name: Set up JDK 17 uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '17' - # (3) Gradle build (Test 제외) - name: Build with Gradle - uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee + uses: gradle/gradle-build-action@v3 with: arguments: clean build -x test - # (4) AWS 인증 (IAM 사용자 Access Key, Secret Key 활용) - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -48,7 +42,6 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} - # (5) 빌드 결과물을 S3 버킷에 업로드 - name: Upload to AWS S3 run: | aws deploy push \ @@ -57,7 +50,6 @@ jobs: --s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \ --source . - # (6) S3 버킷에 있는 파일을 대상으로 CodeDeploy 실행 - name: Deploy to AWS EC2 from S3 run: | aws deploy create-deployment \ @@ -66,9 +58,9 @@ jobs: --deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip - # ignore 값들 가져오기 - - name: make application.yml + - name: Generate application.yml run: | + mkdir -p ./src/main/resources touch ./src/main/resources/application.yml - echo "${{ secrets.APPLICATION }}" | base64 --decode > src/main/resources/application.yml - + echo "${{ secrets.APPLICATION }}" | base64 --decode > ./src/main/resources/application.yml + cat ./src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 From c4a8a7f6948f7bb848760e9c428cbefe3131ac87 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 21:20:57 +0900 Subject: [PATCH 12/23] Update deploy.yml --- .github/workflows/deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c76b7ab..a1d0ae6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -60,7 +60,7 @@ jobs: - name: Generate application.yml run: | - mkdir -p ./src/main/resources - touch ./src/main/resources/application.yml - echo "${{ secrets.APPLICATION }}" | base64 --decode > ./src/main/resources/application.yml - cat ./src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 + mkdir -p src/main/resources + touch src/main/resources/application.yml + echo "${{ secrets.APPLICATION }}" | base64 --decode > src/main/resources/application.yml + cat src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 From 7befc269cf5f6482f9f00999382cc6be2962a744 Mon Sep 17 00:00:00 2001 From: lsn5963 Date: Thu, 1 Aug 2024 21:51:05 +0900 Subject: [PATCH 13/23] =?UTF-8?q?build.gradle=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d9e70f4..4a20a65 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' compileOnly 'org.projectlombok:lombok' - runtimeOnly 'com.mysql:mysql-connector-j' + implementation 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' From e61267c0eabc86768e206fe6970bad9a34238f58 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 22:02:32 +0900 Subject: [PATCH 14/23] Update deploy.yml --- .github/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a1d0ae6..5017cff 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,6 +35,9 @@ jobs: with: arguments: clean build -x test + - name: Clean and Build with Gradle + run: ./gradlew clean build --refresh-dependencies + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: From eff517102a521f7eead0ba49d7d5d45fc9573573 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Thu, 1 Aug 2024 23:58:15 +0900 Subject: [PATCH 15/23] Update deploy.yml --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5017cff..e559019 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,8 +35,8 @@ jobs: with: arguments: clean build -x test - - name: Clean and Build with Gradle - run: ./gradlew clean build --refresh-dependencies + # - name: Clean and Build with Gradle + # run: ./gradlew clean build --refresh-dependencies - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 From fbacde9306ce9b633b8ed34aa2fa903f05e4f321 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 00:22:02 +0900 Subject: [PATCH 16/23] Update deploy.yml --- .github/workflows/deploy.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e559019..d60c13c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,5 @@ jobs: - name: Generate application.yml run: | - mkdir -p src/main/resources - touch src/main/resources/application.yml - echo "${{ secrets.APPLICATION }}" | base64 --decode > src/main/resources/application.yml - cat src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 + touch ./src/main/resources/application.yml + echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml From 145f9f11a38dbd31f75d479d170166e6e25ffdf2 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 00:26:05 +0900 Subject: [PATCH 17/23] Update deploy.yml --- .github/workflows/deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d60c13c..7b70ede 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,5 +63,7 @@ jobs: - name: Generate application.yml run: | - touch ./src/main/resources/application.yml + mkdir -p src/main/resources + touch src/main/resources/application.yml echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml + cat src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 From c7ed860c62a1595bf79af6ec2372f36910b9291e Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 00:46:01 +0900 Subject: [PATCH 18/23] Update deploy.yml --- .github/workflows/deploy.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7b70ede..20ba650 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,8 @@ jobs: - name: Generate application.yml run: | - mkdir -p src/main/resources - touch src/main/resources/application.yml - echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml - cat src/main/resources/application.yml # 디버깅용, 생성된 파일 내용 확인 + mkdir -p ./src/main/resources + cd ./src/main/resources + touch ./application.yml + echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > ./application.yml + cat ./application.yml # 디버깅용, 생성된 파일 내용 확인 From 9c28fe640c110cd48be53df0b39f981103083019 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 00:50:26 +0900 Subject: [PATCH 19/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index b0bf249..126c2a2 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -9,10 +9,6 @@ DEPLOY_LOG="$PROJECT_ROOT/deploy.log" TIME_NOW=$(date +%c) -# application.yml 내용 확인 (디버깅용) -echo "$TIME_NOW > application.yml 내용 확인" >> $DEPLOY_LOG -cat $PROJECT_ROOT/src/main/resources/application.yml >> $DEPLOY_LOG - # build 파일 복사 echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE From 9fb959dd288f3f36f992f3e46b76c1328c15c0ab Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 00:53:13 +0900 Subject: [PATCH 20/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 4a20a65..97a9465 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,7 @@ dependencies { implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' compileOnly 'org.projectlombok:lombok' implementation 'com.mysql:mysql-connector-j' + runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' From bcb9afd9a41e4da192a46ad330dfbb082e12b05d Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 01:06:45 +0900 Subject: [PATCH 21/23] Update deploy.yml --- .github/workflows/deploy.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 20ba650..7e84b08 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,6 +34,15 @@ jobs: uses: gradle/gradle-build-action@v3 with: arguments: clean build -x test + + - name: Generate application.yml + run: | + mkdir -p ./src/main/resources + cd ./src/main/resources + touch ./application.yml + echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > ./application.yml + cat ./application.yml # 디버깅용, 생성된 파일 내용 확인 + # - name: Clean and Build with Gradle # run: ./gradlew clean build --refresh-dependencies @@ -61,10 +70,4 @@ jobs: --deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip - - name: Generate application.yml - run: | - mkdir -p ./src/main/resources - cd ./src/main/resources - touch ./application.yml - echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > ./application.yml - cat ./application.yml # 디버깅용, 생성된 파일 내용 확인 + From ce6b16f0b8cff4f165a21326bc2ebd980d71afe7 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 01:14:24 +0900 Subject: [PATCH 22/23] Update deploy.yml --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7e84b08..33f0dc3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: Deploy to Amazon EC2 on: push: branches: - - testbaepo + - develop env: AWS_REGION: ap-northeast-2 From f8c0f373d2c0435c56e45f39e3ab76e37eca7701 Mon Sep 17 00:00:00 2001 From: lsn5963 <77337977+lsn5963@users.noreply.github.com> Date: Fri, 2 Aug 2024 01:16:47 +0900 Subject: [PATCH 23/23] =?UTF-8?q?[Test]=20Test=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 97a9465..4a20a65 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,6 @@ dependencies { implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' compileOnly 'org.projectlombok:lombok' implementation 'com.mysql:mysql-connector-j' - runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test'