From 84a6ab0d83af337ff63dd1013c62c7657d21d3fd Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 17:05:04 +0900 Subject: [PATCH 01/19] =?UTF-8?q?feat:=20Dockerfile=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6532d51 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM openjdk:21-jdk + +COPY build/libs/*SNAPSHOT.jar app.jar + +ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -Dspring.profiles.active=${PROFILE} -jar /app.jar"] From 328c3c59cf3a684bc018e8d1dd6b51999af0b8de Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 17:13:06 +0900 Subject: [PATCH 02/19] =?UTF-8?q?feat:=20ci=20=EB=B0=8F=20ci-dev=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yaml | 28 +++++++++++++++++++++ .github/workflows/ci.yaml | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/cd-dev.yaml create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/cd-dev.yaml b/.github/workflows/cd-dev.yaml new file mode 100644 index 0000000..b942c35 --- /dev/null +++ b/.github/workflows/cd-dev.yaml @@ -0,0 +1,28 @@ +name: gateway-service dev CD 파이프라인 + +on: + workflow_run: + workflows: ["gateway-service CI pipeline"] + types: + - completed + +jobs: + deploy: + runs-on: ubuntu-latest + environment: dev + permissions: + contents: read + + steps: + - name: Docker 이미지 dev 서버 배포 + uses: appleboy/ssh-action@master + with: + host: ${{secrets.DEV_HOST}} + username: ${{secrets.DEV_USERNAME}} + key: ${{secrets.DEV_KEY}} + script: | + cd /home/ubuntu + docker rm -f gateway-service-dev || true + docker compose pull gateway-service-dev + docker compose up -d --no-deps --force-recreate --pull always gateway-service-dev + docker image prune -f diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..fc2b4c0 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,46 @@ +name: gateway-service CI pipeline + +on: + push: + branches: + - dev + pull_request: + branches: + - dev + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + environment: production + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: jdk 설정 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + cache: 'gradle' + + - name: Gradle Wrapper 권한 부여 + run: chmod +x gradlew + + - name: gradle 빌드 + run: ./gradlew clean build + + - name: 도커 로그인 + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: 이미지 빌드 및 푸시 + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + tags: ${{ secrets.DOCKER_USERNAME }}/unionmate-gateway-service:latest + push: true From 065d2a2305e7ae6a9bc64d65fc6683a2437e494e Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 17:52:41 +0900 Subject: [PATCH 03/19] =?UTF-8?q?feat:=20application-local,dev=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-dev.yml | 15 +++++++++++++++ src/main/resources/application-local.yml | 15 +++++++++++++++ src/main/resources/application.properties | 1 - 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/application-dev.yml create mode 100644 src/main/resources/application-local.yml delete mode 100644 src/main/resources/application.properties diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..e9f56b5 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,15 @@ +server: + port: 8000 + +spring: + main: + web-application-type: reactive + application: + name: gateway-service + +eureka: + client: + fetch-registry: true + register-with-eureka: true + service-url: + defaultZone: http://3.34.87.16:8761/eureka diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml new file mode 100644 index 0000000..57ceb6f --- /dev/null +++ b/src/main/resources/application-local.yml @@ -0,0 +1,15 @@ +server: + port: 8000 + +spring: + main: + web-application-type: reactive + application: + name: gateway-service + +eureka: + client: + fetch-registry: true + register-with-eureka: true + service-url: + defaultZone: http://localhost:8761/eureka diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 7ad05e5..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=gateway_service From 025222db3f952678381a194146e8240f2cf6595f Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 18:36:30 +0900 Subject: [PATCH 04/19] =?UTF-8?q?feat:=20=EA=B2=8C=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=EC=9B=A8=EC=9D=B4=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + .../global/gateway/GatewayConfiguration.java | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java diff --git a/build.gradle b/build.gradle index 9cd88d5..d64dc90 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.cloud:spring-cloud-starter-gateway-server-webmvc' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' + implementation 'org.springframework.cloud:spring-cloud-starter-gateway' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java new file mode 100644 index 0000000..c3a285f --- /dev/null +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -0,0 +1,25 @@ +package com.unionmate.gateway_service.global.gateway; + +import org.springframework.cloud.gateway.route.RouteLocator; +import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.http.HttpHeaders; + +@Configuration +@Profile({"local","dev"}) +public class GatewayConfiguration { + + @Bean + public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { + return builder.routes() + // 인증 필요 없는 라우트 + .route("backend_route", r -> r.path("/**") + .filters(f -> f + .removeRequestHeader(HttpHeaders.COOKIE) + ) + .uri("lb://backend")) + .build(); + } +} From 69defe5eaac9468653855e9dc8a3e2f5fbe8557b Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 21:31:28 +0900 Subject: [PATCH 05/19] =?UTF-8?q?feat:=20=EB=8B=A4=EB=A5=B8=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4,=20api=20=ED=98=B8=EC=B6=9C=20=EC=8B=9C=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EB=B9=88=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GatewayServiceApplication.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/unionmate/gateway_service/GatewayServiceApplication.java b/src/main/java/com/unionmate/gateway_service/GatewayServiceApplication.java index 599d998..4180897 100644 --- a/src/main/java/com/unionmate/gateway_service/GatewayServiceApplication.java +++ b/src/main/java/com/unionmate/gateway_service/GatewayServiceApplication.java @@ -2,6 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestClient; +import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication public class GatewayServiceApplication { @@ -10,4 +14,15 @@ public static void main(String[] args) { SpringApplication.run(GatewayServiceApplication.class, args); } + @Bean + @LoadBalanced + public WebClient.Builder loadBalancedWebClientBuilder() { + final WebClient.Builder builder = WebClient.builder(); + return builder; + } + + @Bean + public RestClient.Builder restClientBuilder() { + return RestClient.builder(); + } } From 98bd457249963b4f6736ad766d0e5e21652e4cd4 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 22:20:32 +0900 Subject: [PATCH 06/19] =?UTF-8?q?feat:=20cors=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 3 +- .../global/SecurityConfig.java | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java diff --git a/build.gradle b/build.gradle index d64dc90..9542bc6 100644 --- a/build.gradle +++ b/build.gradle @@ -23,9 +23,8 @@ ext { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.cloud:spring-cloud-starter-gateway-server-webmvc' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' + implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.cloud:spring-cloud-starter-gateway' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' diff --git a/src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java b/src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java new file mode 100644 index 0000000..8ac80b5 --- /dev/null +++ b/src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java @@ -0,0 +1,28 @@ +package com.unionmate.gateway_service.global; + +import java.util.Arrays; +import java.util.List; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.reactive.CorsWebFilter; +import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; + +@Configuration +public class SecurityConfig { + @Bean + public CorsWebFilter corsWebFilter() { + CorsConfiguration config = new CorsConfiguration(); + config.setAllowedOrigins(List.of("http://localhost:3000")); + config.setAllowedMethods(Arrays.asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")); + config.setAllowCredentials(true); + config.setAllowedHeaders(List.of("*")); + config.setExposedHeaders(List.of("Authorization", "Authorization-refresh")); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); + + return new CorsWebFilter(source); + } +} From e841c55d4fc6e24c29485543fa3f17bf2f7f3f04 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 21 Sep 2025 22:58:24 +0900 Subject: [PATCH 07/19] =?UTF-8?q?refactor:=20=EB=9D=BC=EC=9A=B0=ED=8A=B8?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway_service/global/gateway/GatewayConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java index c3a285f..567d248 100644 --- a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -19,7 +19,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { .filters(f -> f .removeRequestHeader(HttpHeaders.COOKIE) ) - .uri("lb://backend")) + .uri("lb://backend-service")) .build(); } } From 7edc4811b43789939f7d82b3847615eaf0c21502 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Tue, 23 Sep 2025 23:42:02 +0900 Subject: [PATCH 08/19] =?UTF-8?q?feat:=20cd-prod=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-prod.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/cd-prod.yaml diff --git a/.github/workflows/cd-prod.yaml b/.github/workflows/cd-prod.yaml new file mode 100644 index 0000000..1285199 --- /dev/null +++ b/.github/workflows/cd-prod.yaml @@ -0,0 +1,28 @@ +name: gateway-service prod CD 파이프라인 + +on: + workflow_run: + workflows: ["gateway-service CI pipeline"] + types: + - completed + +jobs: + deploy: + runs-on: ubuntu-latest + environment: dev + permissions: + contents: read + + steps: + - name: Docker 이미지 dev 서버 배포 + uses: appleboy/ssh-action@master + with: + host: ${{secrets.PROD_HOST}} + username: ${{secrets.PROD_USERNAME}} + key: ${{secrets.PROD_KEY}} + script: | + cd /home/ubuntu + docker rm -f gateway-service-prod || true + docker compose pull gateway-service-prod + docker compose up -d --no-deps --force-recreate --pull always gateway-service-prod + docker image prune -f From 8bdeae599137d09b35c0dc2ba8f9add4020fd200 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Tue, 23 Sep 2025 23:45:53 +0900 Subject: [PATCH 09/19] =?UTF-8?q?fet:=20prod=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EB=A6=AC=EC=86=8C=EC=8A=A4=20=ED=8C=8C=EC=9D=BC=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-prod.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/resources/application-prod.yml diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..77d8797 --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,15 @@ +server: + port: 8000 + +spring: + main: + web-application-type: reactive + application: + name: gateway-service + +eureka: + client: + fetch-registry: true + register-with-eureka: true + service-url: + defaultZone: http://https://43.200.160.0.nip.io:8761/eureka From cba66d1e1c88cdec28c79357b8fdea6bb9747350 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Tue, 23 Sep 2025 23:53:16 +0900 Subject: [PATCH 10/19] =?UTF-8?q?refactor:=20prod=20=EB=A6=AC=EC=86=8C?= =?UTF-8?q?=EC=8A=A4=20=ED=8C=8C=EC=9D=BC=20eureka=20client=20defaultzone?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 77d8797..51c87f7 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -12,4 +12,4 @@ eureka: fetch-registry: true register-with-eureka: true service-url: - defaultZone: http://https://43.200.160.0.nip.io:8761/eureka + defaultZone: https://43.200.160.0.nip.io:8761/eureka From e8ab40e1cebf4aff17b33fee3b8540d0a533d597 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Wed, 24 Sep 2025 01:37:25 +0900 Subject: [PATCH 11/19] =?UTF-8?q?refactor:=20prod=20=EC=84=9C=EB=B2=84=20e?= =?UTF-8?q?ureka=20client=20defaultzone=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 51c87f7..b7e4861 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -12,4 +12,4 @@ eureka: fetch-registry: true register-with-eureka: true service-url: - defaultZone: https://43.200.160.0.nip.io:8761/eureka + defaultZone: http://discovery-service-prod:8761/eureka From d5ee78532689a9980f910134a3ae7f183d14bf41 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Wed, 24 Sep 2025 01:38:14 +0900 Subject: [PATCH 12/19] =?UTF-8?q?refactor:=20=EA=B2=8C=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=EC=9B=A8=EC=9D=B4=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20prod=EC=97=90=20=EC=A0=81=EC=9A=A9=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway_service/global/gateway/GatewayConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java index 567d248..2274f85 100644 --- a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.http.HttpHeaders; @Configuration -@Profile({"local","dev"}) +@Profile({"local","dev","prod"}) public class GatewayConfiguration { @Bean From f1fadb2e5ae664a152f13d5893d5705c305c5dec Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Wed, 24 Sep 2025 20:20:21 +0900 Subject: [PATCH 13/19] =?UTF-8?q?refactor:=20=EC=8A=A4=EC=9B=A8=EA=B1=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 3 +++ .../global/gateway/GatewayConfiguration.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index 9542bc6..f9f4e65 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,9 @@ dependencies { implementation 'org.springframework.cloud:spring-cloud-starter-gateway' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + //swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8' } dependencyManagement { diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java index 2274f85..f85cd48 100644 --- a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -20,6 +20,13 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { .removeRequestHeader(HttpHeaders.COOKIE) ) .uri("lb://backend-service")) + + //스웨거를 위한 라우트 설정 + .route("backend-service_api_docs", r -> r.path("/api-docs/backend/**") + .filters(f -> f + .rewritePath("/api-docs/bakcend/(?.*)", "/${rem}") + ) + .uri("lb://backend-service")) .build(); } } From 1e18f6b2505fc901285261b4021ef028c932c110 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Wed, 24 Sep 2025 20:25:16 +0900 Subject: [PATCH 14/19] =?UTF-8?q?refactor:=20=EC=8A=A4=EC=9B=A8=EA=B1=B0?= =?UTF-8?q?=20urls=20=EB=93=B1=EB=A1=9D=EC=9D=84=20=EC=9C=84=ED=95=9C=20de?= =?UTF-8?q?v=20=EB=A6=AC=EC=86=8C=EC=8A=A4=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-dev.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index e9f56b5..e072e90 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -13,3 +13,12 @@ eureka: register-with-eureka: true service-url: defaultZone: http://3.34.87.16:8761/eureka + +springdoc: + api-docs: + enabled: true + swagger-ui: + path: /swagger-ui.html + urls: + - name: backend-service + url: /api-docs/backend/v3/api-docs \ No newline at end of file From cde3e4b90436530e43d954a5ccbfe6838e734401 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Wed, 24 Sep 2025 20:25:44 +0900 Subject: [PATCH 15/19] =?UTF-8?q?refactor:=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway_service/global/gateway/GatewayConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java index f85cd48..8023968 100644 --- a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -24,7 +24,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { //스웨거를 위한 라우트 설정 .route("backend-service_api_docs", r -> r.path("/api-docs/backend/**") .filters(f -> f - .rewritePath("/api-docs/bakcend/(?.*)", "/${rem}") + .rewritePath("/api-docs/backend/(?.*)", "/${rem}") ) .uri("lb://backend-service")) .build(); From ee57b7eb78d663fbc45a690551de71348da2c7f8 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Wed, 24 Sep 2025 20:39:29 +0900 Subject: [PATCH 16/19] =?UTF-8?q?refactor:=20local,=20prod=20=EB=A6=AC?= =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=ED=8C=8C=EC=9D=BC=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EA=B2=BD=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/gateway/GatewayConfiguration.java | 2 +- src/main/resources/application-local.yml | 9 +++++++++ src/main/resources/application-prod.yml | 10 ++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java index 8023968..00367f7 100644 --- a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -21,7 +21,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { ) .uri("lb://backend-service")) - //스웨거를 위한 라우트 설정 + //스웨거를 위한 라우트 설정(각 서비스마다 등록해줘야 합니다.) .route("backend-service_api_docs", r -> r.path("/api-docs/backend/**") .filters(f -> f .rewritePath("/api-docs/backend/(?.*)", "/${rem}") diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 57ceb6f..3a35d3e 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -13,3 +13,12 @@ eureka: register-with-eureka: true service-url: defaultZone: http://localhost:8761/eureka + +springdoc: + api-docs: + enabled: true + swagger-ui: + path: /swagger-ui.html + urls: + - name: backend-service + url: /api-docs/backend/v3/api-docs diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index b7e4861..a76ab54 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -13,3 +13,13 @@ eureka: register-with-eureka: true service-url: defaultZone: http://discovery-service-prod:8761/eureka + +springdoc: + api-docs: + enabled: true + swagger-ui: + path: /swagger-ui.html + urls: + - name: backend-service + url: /api-docs/backend/v3/api-docs + From 98548ce65e3fd22572163feab271040a55670df9 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 28 Sep 2025 22:23:21 +0900 Subject: [PATCH 17/19] =?UTF-8?q?refactor:=20cd-prod=20environment=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-prod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-prod.yaml b/.github/workflows/cd-prod.yaml index 1285199..f742bde 100644 --- a/.github/workflows/cd-prod.yaml +++ b/.github/workflows/cd-prod.yaml @@ -9,7 +9,7 @@ on: jobs: deploy: runs-on: ubuntu-latest - environment: dev + environment: prod permissions: contents: read From 0bc45ebcb5fe3c4a3b6f7bcd25ce508a07027baf Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 28 Sep 2025 22:24:09 +0900 Subject: [PATCH 18/19] =?UTF-8?q?refactor:=20ci=20=EC=84=B1=EA=B3=B5?= =?UTF-8?q?=EC=8B=9C=EC=97=90=EB=A7=8C=20cd=20=EB=8F=99=EC=9E=91=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yaml | 1 + .github/workflows/cd-prod.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/cd-dev.yaml b/.github/workflows/cd-dev.yaml index b942c35..5668f09 100644 --- a/.github/workflows/cd-dev.yaml +++ b/.github/workflows/cd-dev.yaml @@ -8,6 +8,7 @@ on: jobs: deploy: + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest environment: dev permissions: diff --git a/.github/workflows/cd-prod.yaml b/.github/workflows/cd-prod.yaml index f742bde..d1b345f 100644 --- a/.github/workflows/cd-prod.yaml +++ b/.github/workflows/cd-prod.yaml @@ -8,6 +8,7 @@ on: jobs: deploy: + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest environment: prod permissions: From b92874b3ca7bfbdef803836ae268e2b1a9398904 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Sun, 28 Sep 2025 23:32:14 +0900 Subject: [PATCH 19/19] =?UTF-8?q?refactor:=20GatewayConfiguration=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=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 +- .../gateway_service/global/gateway/GatewayConfiguration.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f9f4e65..6e011c3 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' //swagger - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8' + implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.8.8' } dependencyManagement { diff --git a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java index 00367f7..2115612 100644 --- a/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java +++ b/src/main/java/com/unionmate/gateway_service/global/gateway/GatewayConfiguration.java @@ -15,7 +15,8 @@ public class GatewayConfiguration { public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { return builder.routes() // 인증 필요 없는 라우트 - .route("backend_route", r -> r.path("/**") + // path 경로는 추후 개발에 진행되며 수정될 예정 + .route("backend_route", r -> r.path("/back") .filters(f -> f .removeRequestHeader(HttpHeaders.COOKIE) )