From 422952d318520dcfd45931a8a2c42f8a7c759e50 Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:24:48 +0900 Subject: [PATCH 1/8] add : cd workflow --- .github/workflows/cd.yaml | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/cd.yaml diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 00000000..4cd4c5ff --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,56 @@ +name: CD +on: + push: + branches: + - test/** + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: 소스 코드 다운로드 + uses: actions/checkout@v3 + + - name: JDK 다운로드 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 21 + + - name: 빌드 캐싱 + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: 현재 시간 가져오기 + uses: 1466587594/get-current-time@v2 + id: current-time + with: + format: YYYY-MM-DDTHH-mm-ss + utcOffset: "+09:00" + + - name: 빌드 + run: chmod +x gradlew && ./gradlew bootJar + + - name: 배포 압축 파일 생성 + run: | + sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_SECRET }}/' ./deploy/Procfile + cp ./Dojo-Spring/build/libs/application.jar ./deploy + cd deploy && zip -r deploy.zip . + + - name: 배포 + uses: einaregilsson/beanstalk-deploy@v22 + with: + aws_access_key: ${{ secrets.AWS_ACCESS_KEY }} + aws_secret_key: ${{ secrets.AWS_SECRET_KEY }} + application_name: dojo-backend-eb-app + environment_name: dojo-backend-eb-env + version_label: sulsul-${{ vars.GITHUB_SHA }}-${{steps.current-time.outputs.formattedTime}} + region: ap-northeast-2 + deployment_package: ./deploy/deploy.zip + wait_for_deployment: false From 2e8b6e15fa33c2d85221effc9d2a355e848d9528 Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:30:39 +0900 Subject: [PATCH 2/8] mod: cd pipeline --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 4cd4c5ff..2bb66b48 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -39,7 +39,7 @@ jobs: - name: 배포 압축 파일 생성 run: | - sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_SECRET }}/' ./deploy/Procfile + sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}/' ./deploy/Procfile cp ./Dojo-Spring/build/libs/application.jar ./deploy cd deploy && zip -r deploy.zip . From 29b779119b51466677ab8d1b2499db4aaca3c2e8 Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:53:04 +0900 Subject: [PATCH 3/8] add: create procfile for elasticbeanstalk --- deploy/Procfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 deploy/Procfile diff --git a/deploy/Procfile b/deploy/Procfile new file mode 100644 index 00000000..3de88838 --- /dev/null +++ b/deploy/Procfile @@ -0,0 +1 @@ +web: java -jar -Duser.timezone=Asia/Seoul -Dspring.profiles.active=prod -Dserver.port=8080 -Djasypt.encryptor.password={JASYPT_SECRET} ./application.jar From 9cb33106f68ca0cc299afe7d4cfcef47bcd4515a Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:44:21 +0900 Subject: [PATCH 4/8] mod: cd pipeline --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 2bb66b48..645e2d6d 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -40,7 +40,7 @@ jobs: - name: 배포 압축 파일 생성 run: | sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}/' ./deploy/Procfile - cp ./Dojo-Spring/build/libs/application.jar ./deploy + cp ./build/libs/application.jar ./deploy cd deploy && zip -r deploy.zip . - name: 배포 From 2c2d472c886a7cc986da283d1b8fc7297d4dc4ec Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:47:19 +0900 Subject: [PATCH 5/8] mod: cd pipeline --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 645e2d6d..2957bf6d 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -2,7 +2,7 @@ name: CD on: push: branches: - - test/** + - sewon/** jobs: build: From c19d30c26da3c9dcc41142b25c39b4fb892f637c Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:02:21 +0900 Subject: [PATCH 6/8] mod: cd pipeline --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 2957bf6d..7c0df639 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -40,7 +40,7 @@ jobs: - name: 배포 압축 파일 생성 run: | sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}/' ./deploy/Procfile - cp ./build/libs/application.jar ./deploy + cp ./api/build/libs/application.jar ./deploy cd deploy && zip -r deploy.zip . - name: 배포 From 367ca179262d65e7c8a6bb4a3af32ec7882d9269 Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:07:46 +0900 Subject: [PATCH 7/8] mod: cd pipeline --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 7c0df639..6c59e3f7 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -40,7 +40,7 @@ jobs: - name: 배포 압축 파일 생성 run: | sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}/' ./deploy/Procfile - cp ./api/build/libs/application.jar ./deploy + cp ./api/build/libs/api-1.0.0.jar ./deploy/application.jar cd deploy && zip -r deploy.zip . - name: 배포 From 3186ff170ba69a733b26a3ab46aec185f07bcabf Mon Sep 17 00:00:00 2001 From: Sewon Park <69254943+wonlog-g@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:18:31 +0900 Subject: [PATCH 8/8] mod: cd pipeline --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 6c59e3f7..feabd369 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -50,7 +50,7 @@ jobs: aws_secret_key: ${{ secrets.AWS_SECRET_KEY }} application_name: dojo-backend-eb-app environment_name: dojo-backend-eb-env - version_label: sulsul-${{ vars.GITHUB_SHA }}-${{steps.current-time.outputs.formattedTime}} + version_label: dojo-${{ vars.GITHUB_SHA }}-${{steps.current-time.outputs.formattedTime}} region: ap-northeast-2 deployment_package: ./deploy/deploy.zip wait_for_deployment: false