From 96838c66f0772df829e364f70775a03603a4f15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=84=B8=ED=9D=AC?= <109964874+Sehi55@users.noreply.github.com> Date: Sun, 17 May 2026 04:11:14 +0900 Subject: [PATCH] Feat/14 prod settings (#15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: actuator 의존성 추가 * feat: ci-prod 구현 --- .github/workflows/ci-prod.yml | 59 +++++++++++++++++++++++++ build.gradle | 3 ++ src/main/resources/application-prod.yml | 30 +++++++++++++ src/main/resources/application.yml | 20 ++++----- 4 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci-prod.yml create mode 100644 src/main/resources/application-prod.yml diff --git a/.github/workflows/ci-prod.yml b/.github/workflows/ci-prod.yml new file mode 100644 index 0000000..7495af5 --- /dev/null +++ b/.github/workflows/ci-prod.yml @@ -0,0 +1,59 @@ +# .github/workflows/ci-prod.yml +name: CI-PROD + +on: + pull_request: + branches: [main] + push: + branches: [main] + +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "21" + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Run tests + run: ./gradlew test --no-daemon + + - name: Generate image tag + if: github.event_name == 'push' + run: echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Configure AWS credentials (OIDC) + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Login to Amazon ECR + if: github.event_name == 'push' + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build Docker image + if: github.event_name == 'push' + run: | + docker build -t ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} . + + - name: Push Docker image to ECR + if: github.event_name == 'push' + run: | + docker push ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 096a4ae..2276c72 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,9 @@ dependencies { testImplementation 'io.projectreactor:reactor-test' testImplementation 'org.springframework.security:spring-security-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + implementation 'org.springframework.boot:spring-boot-starter-actuator' + } dependencyManagement { diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..163d7eb --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,30 @@ +server: + port: ${SERVER_PORT:19000} + +eureka: + client: + enabled: ${EUREKA_ENABLED:true} + service-url: + defaultZone: http://${EUREKA_HOST}:${EUREKA_PORT}/eureka/ + instance: + prefer-ip-address: true + +spring: + cloud: + inetutils: + ignored-interfaces: + - "lo" + - "docker.*" + - "veth.*" + preferred-networks: + - "10.0" + use-only-site-local-interfaces: true + +management: + endpoints: + web: + exposure: + include: health,info,prometheus + endpoint: + health: + show-details: always diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1aa7568..447df5d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -9,54 +9,54 @@ spring: webflux: routes: - id: user-service - uri: lb://USER-SERVICE + uri: lb://user-service predicates: - Path=/api/v1/users/**,/api/v1/admin/users/**,/api/v1/auth/**,/api/v1/admin/auth/** - id: timeslot-service - uri: lb://TIMESLOT-SERVICE + uri: lb://timeslot-service predicates: - Path=/api/v1/restaurants/*/time-slots/**,/api/v1/admin/restaurants/*/time-slots/** - id: restaurant-service - uri: lb://RESTAURANT-SERVICE + uri: lb://restaurant-service predicates: - Path=/api/v1/restaurants/**,/api/v1/admin/restaurants/** - id: reservation-service - uri: lb://RESERVATION-SERVICE + uri: lb://reservation-service predicates: - Path=/api/v1/reservations/**,/api/v1/admin/reservations/** - id: catalog-service - uri: lb://CATALOG-SERVICE + uri: lb://catalog-service predicates: - Path=/api/v1/products/** - Method=GET - id: inventory-service - uri: lb://INVENTORY-SERVICE + uri: lb://inventory-service predicates: - Path=/api/v1/products/**,/api/v1/admin/products/** - Method=POST,PUT,PATCH,DELETE - id: order-service - uri: lb://ORDER-SERVICE + uri: lb://order-service predicates: - Path=/api/v1/orders/**,/api/v1/admin/orders/** - id: waiting-service - uri: lb://WAITING-SERVICE + uri: lb://waiting-service predicates: - Path=/api/v1/waitings/**,/api/v1/admin/waitings/** - id: notification-service - uri: lb://NOTIFICATION-SERVICE + uri: lb://notification-service predicates: - Path=/api/v1/notifications/**,/api/v1/admin/notifications/** - id: payment-service - uri: lb://PAYMENT-SERVICE + uri: lb://payment-service predicates: - Path=/api/v1/payments/**,/api/v1/admin/payments/**