From 4a4b70c5479922105664edbcd201d017b4a40010 Mon Sep 17 00:00:00 2001 From: rlaxxwls13 Date: Tue, 12 May 2026 14:36:58 +0900 Subject: [PATCH 1/6] =?UTF-8?q?chore:=20ecr=20=ED=91=B8=EC=8B=9C=20?= =?UTF-8?q?=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20+=20ci=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #12 --- .github/workflows/ci.yml | 44 --------------- .github/workflows/deploy.yml | 103 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 6cd8c62..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: CI - -on: - pull_request: - branches: - - main - - dev - push: - branches: - - main - - dev - -jobs: - build-and-test: - runs-on: ubuntu-latest - env: - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Set up Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Grant execute permission to gradlew - run: chmod +x gradlew - - - name: Build & Test - run: ./gradlew build --no-daemon - - - name: Upload test report (on failure) - if: failure() - uses: actions/upload-artifact@v4 - with: - name: test-report - path: build/reports/tests/ - retention-days: 7 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..df18bd5 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,103 @@ +name: CI/CD - Build, Test, and Deploy + +on: + pull_request: + branches: + - main + - dev + push: + branches: + - main + - dev + - chore/12-ecr-workflow + workflow_dispatch: + +permissions: + id-token: write + contents: read + +env: + AWS_REGION: ap-northeast-2 + ECR_REPOSITORY: first-ticket/config-server + +jobs: + # 1) 빌드 + 테스트 (모든 PR/push에서 실행) + build-and-test: + runs-on: ubuntu-latest + env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Grant execute permission to gradlew + run: chmod +x gradlew + + - name: Build & Test + run: ./gradlew build --no-daemon + + - name: Upload test report (on failure) + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-report + path: build/reports/tests/ + retention-days: 7 + + # 2) ECR 푸시 (main 브랜치 push 시에만!) + push-to-ecr: + needs: build-and-test + if: | + github.event_name == 'push' && + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/chore/12-ecr-workflow') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew clean build -x test + + - name: Configure AWS credentials (OIDC) + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: ecr-login + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push image to ECR + env: + REGISTRY: ${{ steps.ecr-login.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build --platform linux/amd64 \ + -t $REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ + -t $REGISTRY/$ECR_REPOSITORY:latest . + docker push $REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker push $REGISTRY/$ECR_REPOSITORY:latest + + - name: Show pushed image + run: | + echo "✅ Pushed: $ECR_REPOSITORY:${{ github.sha }}" + echo "✅ Pushed: $ECR_REPOSITORY:latest" From 95584152958381379ac85963b4a0a5da2474c876 Mon Sep 17 00:00:00 2001 From: rlaxxwls13 Date: Tue, 12 May 2026 14:45:08 +0900 Subject: [PATCH 2/6] =?UTF-8?q?chore:=20action=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EB=B2=84=EC=A0=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #12 --- .github/workflows/deploy.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index df18bd5..dd6d603 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,21 +24,19 @@ jobs: # 1) 빌드 + 테스트 (모든 PR/push에서 실행) build-and-test: runs-on: ubuntu-latest - env: - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up JDK 21 - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: '21' distribution: 'temurin' - name: Set up Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v4 - name: Grant execute permission to gradlew run: chmod +x gradlew @@ -48,13 +46,13 @@ jobs: - name: Upload test report (on failure) if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: test-report path: build/reports/tests/ retention-days: 7 - # 2) ECR 푸시 (main 브랜치 push 시에만!) + # 2) ECR 푸시 (main 또는 chore/12-ecr-workflow 브랜치 push 시) push-to-ecr: needs: build-and-test if: | @@ -63,9 +61,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: java-version: '21' distribution: 'temurin' @@ -77,7 +75,7 @@ jobs: run: ./gradlew clean build -x test - name: Configure AWS credentials (OIDC) - uses: aws-actions/configure-aws-credentials@v4 + uses: aws-actions/configure-aws-credentials@v5 with: role-to-assume: ${{ secrets.AWS_ROLE_ARN }} aws-region: ${{ env.AWS_REGION }} From 38246deea87305c606ecd60a33c91f355e624227 Mon Sep 17 00:00:00 2001 From: rlaxxwls13 Date: Tue, 12 May 2026 14:51:16 +0900 Subject: [PATCH 3/6] =?UTF-8?q?chore:=20action=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EB=B2=84=EC=A0=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #12 --- .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 dd6d603..691c3c3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Set up JDK 21 uses: actions/setup-java@v5 @@ -36,7 +36,7 @@ jobs: distribution: 'temurin' - name: Set up Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v6 - name: Grant execute permission to gradlew run: chmod +x gradlew @@ -61,7 +61,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions/setup-java@v5 with: @@ -75,7 +75,7 @@ jobs: run: ./gradlew clean build -x test - name: Configure AWS credentials (OIDC) - uses: aws-actions/configure-aws-credentials@v5 + uses: aws-actions/configure-aws-credentials@v6 with: role-to-assume: ${{ secrets.AWS_ROLE_ARN }} aws-region: ${{ env.AWS_REGION }} From d1a64ca6a274d711ca332cb5d7cf3c022262de2c Mon Sep 17 00:00:00 2001 From: rlaxxwls13 Date: Wed, 13 May 2026 05:16:25 +0900 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20=EC=9C=A0=EB=A0=88=EC=B9=B4=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80=20dquote>=20-=20prefer-?= =?UTF-8?q?ip-address:=20true=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #12 --- src/main/resources/application-prod.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 3731969..77369e5 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -6,7 +6,9 @@ eureka: enabled: true service-url: defaultZone: ${EUREKA_URL:http://eureka-server:8761/eureka/} + instance: + prefer-ip-address: true logging: level: - org.springframework.cloud.config: INFO \ No newline at end of file + org.springframework.cloud.config: INFO From 49fe6b3a4dcad748ab84f5c2870ae957e1972a64 Mon Sep 17 00:00:00 2001 From: rlaxxwls13 Date: Wed, 13 May 2026 06:00:24 +0900 Subject: [PATCH 5/6] =?UTF-8?q?chore:=20pplication-prod.yml=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #12 --- src/main/resources/application-prod.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 77369e5..ca42f27 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,6 +1,14 @@ server: port: 8080 +spring: + cloud: + inetutils: + preferred-networks: + - 10\. + - 172\. + - 192\.168\. + eureka: client: enabled: true From 27041fcff2088ffc2d878eb39a469e421ffa6d28 Mon Sep 17 00:00:00 2001 From: rlaxxwls13 Date: Sun, 17 May 2026 23:19:37 +0900 Subject: [PATCH 6/6] =?UTF-8?q?chore:=20=EB=AA=A8=EB=8B=88=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to: #12 --- .github/workflows/deploy.yml | 6 ++---- build.gradle | 11 +++++++++++ src/main/resources/application.yml | 9 +++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 691c3c3..9e24a64 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,6 @@ on: branches: - main - dev - - chore/12-ecr-workflow workflow_dispatch: permissions: @@ -52,12 +51,11 @@ jobs: path: build/reports/tests/ retention-days: 7 - # 2) ECR 푸시 (main 또는 chore/12-ecr-workflow 브랜치 push 시) + # 2) ECR 푸시 (main 브랜치 push 시) push-to-ecr: needs: build-and-test if: | - github.event_name == 'push' && - (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/chore/12-ecr-workflow') + github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: diff --git a/build.gradle b/build.gradle index 5050b68..920c22e 100644 --- a/build.gradle +++ b/build.gradle @@ -22,13 +22,24 @@ ext { } dependencies { + // Spring Boot implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' + + // Spring Cloud implementation 'org.springframework.cloud:spring-cloud-config-server' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' + + // 모니터링 + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'io.micrometer:micrometer-registry-prometheus' + + // Lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + + // Test testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' testCompileOnly 'org.projectlombok:lombok' diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3db03ef..d4fee04 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -19,6 +19,15 @@ spring: search-paths: - '{application}' +management: + endpoints: + web: + exposure: + include: prometheus, health, info + endpoint: + prometheus: + access: read-only + logging: level: org.springframework.cloud.config: INFO