From c8d8bd28c2fd2039a00d738c1215dd7d4e8d7051 Mon Sep 17 00:00:00 2001 From: seminchoi Date: Tue, 27 Aug 2024 20:24:51 +0900 Subject: [PATCH 1/3] =?UTF-8?q?setting:=20CD=20=ED=8C=8C=EC=9D=B4=ED=94=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B8=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..22663029 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,79 @@ +name: Deploy + +on: + push: + branches: [ "main", "setting/deploy" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + token: ${{secrets.PRIVATE_TOKEN}} + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Make directory for deliver + run: mkdir deploy + + - name: Build with Gradle + run: ./gradlew clean build + + - name: Deploy Prod use SCP + uses: appleboy/scp-action@master + with: + username: ubuntu + host: ${{ secrets.TICKETING_HOST }} + key: ${{ secrets.PRIVATE_KEY }} + source: "./build/libs/*.jar" + target: "/home/ubuntu/deploy" + strip_components: 2 + + - name: Run jar on EC2 using SSH + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.TICKETING_HOST }} + username: ubuntu + key: ${{ secrets.PRIVATE_KEY }} + script: | + PID=$(pgrep -f 'java -jar /home/ubuntu/deploy/*.jar') + if [ -n "$PID" ]; then + echo "Stopping existing application with PID $PID" + kill -9 $PID + fi + nohup java -jar /home/ubuntu/deploy/*.jar & + + - name: Deploy Prod use SCP + uses: appleboy/scp-action@master + with: + username: ubuntu + host: ${{ secrets.WAITING_HOST }} + key: ${{ secrets.PRIVATE_KEY }} + source: "./build/libs/*.jar" + target: "/home/ubuntu/deploy" + strip_components: 2 + + - name: Run jar on EC2 using SSH + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.WAITING_HOST }} + username: ubuntu + key: ${{ secrets.PRIVATE_KEY }} + script: | + PID=$(pgrep -f 'java -jar /home/ubuntu/deploy/*.jar') + if [ -n "$PID" ]; then + echo "Stopping existing application with PID $PID" + kill -9 $PID + fi + nohup java -jar /home/ubuntu/deploy/*.jar & \ No newline at end of file From f7099f62368bf9db1ae7d56be8a360f4bcf2e381 Mon Sep 17 00:00:00 2001 From: seminchoi Date: Tue, 27 Aug 2024 20:32:34 +0900 Subject: [PATCH 2/3] =?UTF-8?q?setting:=20CD=20=ED=8C=8C=EC=9D=B4=ED=94=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B8=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- build.gradle | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 22663029..67db93f9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Deploy on: push: - branches: [ "main", "setting/deploy" ] + branches: [ "main" ] jobs: build: diff --git a/build.gradle b/build.gradle index 455af41a..670f6115 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ java { } } +jar { + enabled = false +} + configurations { asciidoctorExt compileOnly { From 490083a2ae714bb9400f1ed3cb85224631531cfe Mon Sep 17 00:00:00 2001 From: seminchoi Date: Wed, 28 Aug 2024 12:29:24 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20ALB=20health=20check=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/infra/ALBHealthCheckController.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/com/thirdparty/ticketing/global/infra/ALBHealthCheckController.java diff --git a/src/main/java/com/thirdparty/ticketing/global/infra/ALBHealthCheckController.java b/src/main/java/com/thirdparty/ticketing/global/infra/ALBHealthCheckController.java new file mode 100644 index 00000000..7f9dd002 --- /dev/null +++ b/src/main/java/com/thirdparty/ticketing/global/infra/ALBHealthCheckController.java @@ -0,0 +1,13 @@ +package com.thirdparty.ticketing.global.infra; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class ALBHealthCheckController { + @GetMapping("/health-check") + public ResponseEntity healthCheck() { + return ResponseEntity.ok().build(); + } +}