Analytics 서비스 Swagger 및 보안 설정 개선
- Redis read-only replica 에러 처리 추가 (SampleDataLoader) - MVP 환경에서 샘플 데이터 로딩 시 Redis 삭제 실패해도 계속 진행 - Swagger UI context-path 설정 수정 (SwaggerConfig) - 서버 URL에 /api/v1/analytics context-path 포함하여 올바른 curl 명령 생성 - Spring Security 경로 매칭 수정 (SecurityConfig) - context-path 제거된 실제 경로 (/events/**, /users/**) 매칭 - 403 Forbidden 에러 해결 - Dockerfile 빌드 경로 수정 - 멀티 모듈 프로젝트 구조에 맞게 JAR 복사 경로 수정 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
97f50fd751
commit
349b644617
@ -1,7 +1,7 @@
|
|||||||
# Multi-stage build for Spring Boot application
|
# Multi-stage build for Spring Boot application
|
||||||
FROM eclipse-temurin:21-jre-alpine AS builder
|
FROM eclipse-temurin:21-jre-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY build/libs/*.jar app.jar
|
COPY analytics-service/build/libs/*.jar app.jar
|
||||||
RUN java -Djarmode=layertools -jar app.jar extract
|
RUN java -Djarmode=layertools -jar app.jar extract
|
||||||
|
|
||||||
FROM eclipse-temurin:21-jre-alpine
|
FROM eclipse-temurin:21-jre-alpine
|
||||||
|
|||||||
@ -93,10 +93,15 @@ public class SampleDataLoader implements ApplicationRunner {
|
|||||||
|
|
||||||
// Redis 멱등성 키 삭제 (새로운 이벤트 처리를 위해)
|
// Redis 멱등성 키 삭제 (새로운 이벤트 처리를 위해)
|
||||||
log.info("Redis 멱등성 키 삭제 중...");
|
log.info("Redis 멱등성 키 삭제 중...");
|
||||||
redisTemplate.delete("processed_events_v2");
|
try {
|
||||||
redisTemplate.delete("distribution_completed_v2");
|
redisTemplate.delete("processed_events_v2");
|
||||||
redisTemplate.delete("processed_participants_v2");
|
redisTemplate.delete("distribution_completed_v2");
|
||||||
log.info("✅ Redis 멱등성 키 삭제 완료");
|
redisTemplate.delete("processed_participants_v2");
|
||||||
|
log.info("✅ Redis 멱등성 키 삭제 완료");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("⚠️ Redis 삭제 실패 (read-only replica일 수 있음): {}", e.getMessage());
|
||||||
|
log.info("→ Redis 삭제 건너뛰고 계속 진행...");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 1. EventCreated 이벤트 발행 (3개 이벤트)
|
// 1. EventCreated 이벤트 발행 (3개 이벤트)
|
||||||
@ -440,7 +445,7 @@ public class SampleDataLoader implements ApplicationRunner {
|
|||||||
private void createTimelineData() {
|
private void createTimelineData() {
|
||||||
log.info("📊 TimelineData 생성 시작...");
|
log.info("📊 TimelineData 생성 시작...");
|
||||||
|
|
||||||
String[] eventIds = {"1", "2", "3"};
|
String[] eventIds = {"evt_2025012301", "evt_2025012302", "evt_2025012303"};
|
||||||
|
|
||||||
// 각 이벤트별 시간당 기준 참여자 수 (이벤트 성과에 따라 다름)
|
// 각 이벤트별 시간당 기준 참여자 수 (이벤트 성과에 따라 다름)
|
||||||
int[] baseParticipantsPerHour = {4, 2, 1}; // 이벤트1(높음), 이벤트2(중간), 이벤트3(낮음)
|
int[] baseParticipantsPerHour = {4, 2, 1}; // 이벤트1(높음), 이벤트2(중간), 이벤트3(낮음)
|
||||||
|
|||||||
@ -45,8 +45,8 @@ public class SecurityConfig {
|
|||||||
.requestMatchers("/swagger-ui/**", "/swagger-ui.html", "/v3/api-docs/**", "/swagger-resources/**", "/webjars/**").permitAll()
|
.requestMatchers("/swagger-ui/**", "/swagger-ui.html", "/v3/api-docs/**", "/swagger-resources/**", "/webjars/**").permitAll()
|
||||||
// Health check
|
// Health check
|
||||||
.requestMatchers("/health").permitAll()
|
.requestMatchers("/health").permitAll()
|
||||||
// Analytics API endpoints (테스트 및 개발 용도로 공개)
|
// Analytics API endpoints (context-path 제거된 실제 경로)
|
||||||
.requestMatchers("/api/**").permitAll()
|
.requestMatchers("/events/**", "/users/**").permitAll()
|
||||||
// All other requests require authentication
|
// All other requests require authentication
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
)
|
)
|
||||||
|
|||||||
@ -22,10 +22,10 @@ public class SwaggerConfig {
|
|||||||
return new OpenAPI()
|
return new OpenAPI()
|
||||||
.info(apiInfo())
|
.info(apiInfo())
|
||||||
.addServersItem(new Server()
|
.addServersItem(new Server()
|
||||||
.url("http://localhost:8086")
|
.url("http://localhost:8086/api/v1/analytics")
|
||||||
.description("Local Development"))
|
.description("Local Development"))
|
||||||
.addServersItem(new Server()
|
.addServersItem(new Server()
|
||||||
.url("http://kt-event-marketing-api.20.214.196.128.nip.io")
|
.url("http://kt-event-marketing-api.20.214.196.128.nip.io/api/v1/analytics")
|
||||||
.description("AKS Development"))
|
.description("AKS Development"))
|
||||||
.addServersItem(new Server()
|
.addServersItem(new Server()
|
||||||
.url("{protocol}://{host}:{port}")
|
.url("{protocol}://{host}:{port}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user