Skip to content

MSA 아키텍처 분석 및 전환 가이드 문서화#62

Closed
Copilot wants to merge 5 commits intomainfrom
copilot/explore-msa-architecture
Closed

MSA 아키텍처 분석 및 전환 가이드 문서화#62
Copilot wants to merge 5 commits intomainfrom
copilot/explore-msa-architecture

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 2, 2025

연관된 이슈

현재 모놀리스 아키텍처의 MSA 확장 가능성 분석 요청

API endpoint 사항

N/A (문서화 작업)

작업 내용

현재 상태 분석

  • 도메인 주도 설계(DDD) 구조 확인: 이미 auth/, house/, lh/, ChatBot/ 등 도메인별 패키지 분리 완료
  • MSA 준비 요소: RESTful API 설계, JWT Stateless 인증, 외부 API 통합(RestTemplate), 스케줄러 도메인별 분리
  • 현재 제약: 단일 MySQL DB, 단일 배포 단위(WAR), 동기 통신만 지원

제안된 MSA 구조 (8개 서비스)

API Gateway (:8080) → JWT 검증, 라우팅, Rate Limiting
├── Auth Service (:8081) → auth/, member/ 
├── Housing Service (:8082) → lh/, applyHome/, house/
├── AI Service (:8083) → ChatBot/, summary/
├── Notification Service (:8084) → email/
├── User Preference (:8085) → selfCheck/, bookmark/, calendar/
├── Community (:8086) → comment/
└── Analytics (:8087) → statics/

인프라: Eureka, Config Server, RabbitMQ, Zipkin, ELK

마이그레이션 전략 (Strangler Fig Pattern)

  1. Phase 1 (1-2개월): API Gateway, Eureka, Docker 환경 구축
  2. Phase 2 (2-3개월): 독립 서비스 분리 (AI, Notification) - 의존성 없음
  3. Phase 3 (3-4개월): 핵심 서비스 분리 (Auth, Housing) - DB 스키마 분리
  4. Phase 4 (2-3개월): 부가 서비스 분리 - 이벤트 기반 통신 적용
  5. Phase 5 (1-2개월): 모놀리스 제거 및 최적화

생성된 문서

  • MSA_SUMMARY.md (11KB): 현재 상태, 필요 인프라, 우선순위 요약
  • MSA_ARCHITECTURE.md (31KB): 전체 전환 가이드, 인프라 구성, DB 전략, 5단계 로드맵
  • MSA_QUICK_START.md (14KB): API Gateway/Eureka 구축 코드, AI Service 분리 예제
  • MSA_DIAGRAMS.md (38KB): 현재/목표 아키텍처, 의존성 맵, Kubernetes 배포 구조
  • README.md: MSA 문서 링크 추가

핵심 구현 예제

API Gateway JWT 검증:

@Component
public class JwtAuthenticationFilter implements GlobalFilter, Ordered {
    private boolean isValidToken(String token) {
        SecretKey key = Keys.hmacShaKeyFor(SECRET_KEY.getBytes(StandardCharsets.UTF_8));
        Jwts.parserBuilder()
            .setSigningKey(key)
            .build()
            .parseClaimsJws(token);
        return true;
    }
}

서비스 간 통신:

// 동기 (WebClient - Reactive)
public Mono<UserInfo> getUserInfo(Long userId) {
    return webClient.get()
        .uri("http://AUTH-SERVICE/api/members/{id}", userId)
        .retrieve()
        .bodyToMono(UserInfo.class);
}

// 비동기 (RabbitMQ)
@RabbitListener(queues = "user-deleted-queue")
public void handleUserDeleted(UserDeletedEvent event) {
    bookmarkRepository.deleteByUserId(event.getUserId());
}

Database per Service 전략:

-- FK 제거, 애플리케이션 레벨 검증
ALTER TABLE preference_db.bookmarks DROP FOREIGN KEY fk_user_id;

-- API 호출로 참조 무결성 관리
UserInfo user = authClient.getUser(bookmark.getUserId());
if (user == null) throw new UserNotFoundException();

💬리뷰 요구사항

  • 제안된 서비스 분해 전략이 현재 도메인 경계와 일치하는지 검토
  • Phase 1 우선순위(API Gateway, Eureka) 적절성 확인
  • Database per Service 전환 시 데이터 마이그레이션 리스크 검토
Original prompt

지금 아키텍처가 MSA 로 확장하기 위해서, 어디까지 구현되어있고, 어떤 부분을 이용하면 확장할 수 있는지 시스템 아키텍처, 방향성 관점에서 설명해줘


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 2, 2025 04:14
Co-authored-by: Ahranah <150007915+Ahranah@users.noreply.github.com>
Co-authored-by: Ahranah <150007915+Ahranah@users.noreply.github.com>
…ements

Co-authored-by: Ahranah <150007915+Ahranah@users.noreply.github.com>
Co-authored-by: Ahranah <150007915+Ahranah@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze current system for MSA expansion MSA 아키텍처 분석 및 전환 가이드 문서화 Dec 2, 2025
Copilot AI requested a review from Ahranah December 2, 2025 04:28
@Ahranah Ahranah closed this Dec 2, 2025
@Ahranah Ahranah deleted the copilot/explore-msa-architecture branch December 2, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants