Skip to content

Refactor/#3 cors 설정 및 서버 변경에 따른 설정 수정#4

Merged
1winhyun merged 1 commit intodevfrom
refactor/#3
Nov 7, 2025
Merged

Refactor/#3 cors 설정 및 서버 변경에 따른 설정 수정#4
1winhyun merged 1 commit intodevfrom
refactor/#3

Conversation

@1winhyun
Copy link
Member

@1winhyun 1winhyun commented Nov 7, 2025

Related issue 🛠

작업 내용 💻

  • ci의 이미지 빌드시 linux/arm64 환경에 맞게 빌드되도록 설정했습니다.
  • SecurityConfig의 setAllowedOrigins에 배포 서버 주소를 추가했습니다.
  • application-prod.yaml의 defaultZone을 수정했습니다.

스크린샷 📷

같이 얘기해보고 싶은 내용이 있다면 작성 📢

Summary by CodeRabbit

릴리스 노트

  • Chores
    • CI/CD 빌드 플랫폼 아키텍처 업데이트
    • 프로덕션 환경 CORS 설정 확장
    • 프로덕션 서비스 디스커버리 구성 업데이트

@1winhyun 1winhyun self-assigned this Nov 7, 2025
@1winhyun 1winhyun added the refactor refactor label Nov 7, 2025
@1winhyun 1winhyun linked an issue Nov 7, 2025 that may be closed by this pull request
2 tasks
@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

개요

배포 서버 주소 변경에 따라 Eureka 서비스 URL을 고정 IP로 업데이트하고, CORS 허용 출처를 추가하며, CI 워크플로우 Docker 빌드 대상 플랫폼을 ARM64로 변경했습니다.

변경사항

집합 / 파일 요약
배포 서버 설정
src/main/resources/application-prod.yml
Eureka 서비스 URL을 discovery-service-prod 호스트에서 고정 IP 주소 129.154.54.225:8761로 변경. 포트는 8761로 유지
CORS 설정 확장
src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java
CORS 허용 출처에 https://129.154.54.225.nip.io 추가 (기존 http://localhost:3000, http://localhost:5173 유지)
CI 워크플로우 플랫폼 변경
.github/workflows/ci.yaml
Docker 빌드 대상 플랫폼을 linux/amd64에서 linux/arm64로 변경

코드 리뷰 예상 난이도

🎯 2 (단순) | ⏱️ ~10분

  • Docker 플랫폼 변경이 기존 빌드 및 배포 프로세스와 호환되는지 확인 필요
  • IP 주소 변경 시 기존 서비스 디스커버리 메커니즘의 영향도 검토

관련된 가능성 있는 PR

  • Gateway-Service#2: 동일한 파일들(CI 워크플로우, SecurityConfig, application-prod.yml)에 대한 관련 설정 수정

제안 레이블

chore

제안 검토자

  • soyesenna
  • rootTiket
  • huncozyboy

🐰 시 (축하 메시지)

🚀 새로운 서버로의 여정,
CORS와 IP로 길을 열고,
ARM64 플랫폼으로 도약하니,
배포의 나래를 펼쳤도다! 🎉✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 내용을 명확하게 반영하고 있습니다. CORS 설정 수정과 서버 변경에 따른 설정 수정이 제목에 잘 나타나있습니다.
Linked Issues check ✅ Passed 모든 코드 변경사항이 연결된 이슈 #3의 목표를 충족합니다. CORS 설정 수정(SecurityConfig), 배포 서버 변경에 따른 설정 수정(application-prod.yml), 그리고 CI 빌드 환경 변경이 모두 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 이슈 #3의 범위 내에 있습니다. CI 환경 변경, CORS 설정 수정, 배포 서버 주소 변경 모두 연결된 이슈의 목표와 직접적으로 관련되어 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java (1)

17-18: 하드코딩된 IP 주소를 설정으로 외부화하는 것을 권장합니다

CORS 허용 출처에 프로덕션 서버 IP 주소를 직접 하드코딩하면 IP 변경 시 코드 재배포가 필요합니다. 환경 변수나 application.yml을 통해 외부 설정으로 관리하는 것이 더 유연합니다.

다음과 같이 리팩토링을 고려해보세요:

application-prod.yml에 설정 추가:

cors:
  allowed-origins:
    - http://localhost:3000
    - http://localhost:5173
    - https://129.154.54.225.nip.io

SecurityConfig.java 수정:

+import org.springframework.beans.factory.annotation.Value;
+
 @Configuration
 public class SecurityConfig {
+	@Value("${cors.allowed-origins}")
+	private List<String> allowedOrigins;
+
 	@Bean
 	public CorsWebFilter corsWebFilter() {
 		CorsConfiguration config = new CorsConfiguration();
-		config.setAllowedOrigins(
-			List.of("http://localhost:3000", "http://localhost:5173", "https://129.154.54.225.nip.io"));
+		config.setAllowedOrigins(allowedOrigins);
src/main/resources/application-prod.yml (1)

15-15: Eureka 서버 URL에 하드코딩된 IP 대신 환경 변수 사용을 권장합니다

Eureka defaultZone에 IP 주소를 직접 작성하면 서버 IP 변경 시 설정 파일 수정이 필요합니다. 환경 변수를 활용하면 더 유연하게 관리할 수 있습니다.

다음과 같이 수정하는 것을 고려해보세요:

 eureka:
   client:
     fetch-registry: true
     register-with-eureka: true
     service-url:
-      defaultZone: http://129.154.54.225:8761/eureka
+      defaultZone: ${EUREKA_SERVER_URL:http://129.154.54.225:8761/eureka}

이렇게 하면 환경 변수 EUREKA_SERVER_URL로 서버 주소를 오버라이드할 수 있으며, 설정되지 않은 경우 기본값이 사용됩니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e83ddca and 9678426.

📒 Files selected for processing (3)
  • .github/workflows/ci.yaml (1 hunks)
  • src/main/java/com/unionmate/gateway_service/global/SecurityConfig.java (1 hunks)
  • src/main/resources/application-prod.yml (2 hunks)
🔇 Additional comments (2)
src/main/resources/application-prod.yml (1)

24-24: 변경 사항이 정상적으로 적용되었습니다

Swagger UI의 백엔드 서비스 API 문서 URL 설정이 올바르게 유지되고 있습니다.

.github/workflows/ci.yaml (1)

45-45: ARM64 전용 빌드 변경으로 인한 배포 환경 호환성 검증 필수

platforms: linux/amd64에서 linux/arm64로 변경되었습니다. 모든 배포 환경(프로덕션, 스테이징, 개발)이 ARM64 기반임을 확인하고 진행하세요. 혼합된 아키텍처 환경(AMD64 서버 포함)이 있다면 다음 설정으로 다중 플랫폼 지원을 권장합니다:

platforms: linux/amd64,linux/arm64

@1winhyun 1winhyun merged commit e529cee into dev Nov 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] #3 배포 서버 수정 및 CORS 설정 수정

1 participant