- Gradle 빌드 캐시 파일 제외 (.gitignore 업데이트) - Kafka 통합 테스트 구현 (AIJobConsumerIntegrationTest) - 단위 테스트 추가 (Controller, Service 레이어) - IntelliJ 실행 프로파일 자동 생성 도구 추가 - Kafka 테스트 배치 스크립트 추가 - Redis 캐시 설정 개선 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
175 lines
4.9 KiB
YAML
175 lines
4.9 KiB
YAML
spring:
|
|
application:
|
|
name: ai-service
|
|
|
|
# Redis Configuration
|
|
data:
|
|
redis:
|
|
host: ${REDIS_HOST:redis-external} # Production: redis-external, Local: 20.214.210.71
|
|
port: ${REDIS_PORT:6379}
|
|
password: ${REDIS_PASSWORD:}
|
|
database: ${REDIS_DATABASE:0} # AI Service uses database 3
|
|
timeout: ${REDIS_TIMEOUT:3000}
|
|
lettuce:
|
|
pool:
|
|
max-active: 8
|
|
max-idle: 8
|
|
min-idle: 2
|
|
max-wait: -1ms
|
|
|
|
# Kafka Consumer Configuration
|
|
kafka:
|
|
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:localhost:9092}
|
|
consumer:
|
|
group-id: ai-service-consumers
|
|
auto-offset-reset: earliest
|
|
enable-auto-commit: false
|
|
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
|
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
|
|
properties:
|
|
spring.json.trusted.packages: "*"
|
|
max.poll.records: ${KAFKA_MAX_POLL_RECORDS:10}
|
|
session.timeout.ms: ${KAFKA_SESSION_TIMEOUT:30000}
|
|
listener:
|
|
ack-mode: manual
|
|
|
|
# Server Configuration
|
|
server:
|
|
port: ${SERVER_PORT:8083}
|
|
servlet:
|
|
context-path: /
|
|
encoding:
|
|
charset: UTF-8
|
|
enabled: true
|
|
force: true
|
|
|
|
# JWT Configuration
|
|
jwt:
|
|
secret: ${JWT_SECRET:}
|
|
access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY:1800}
|
|
refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY:86400}
|
|
|
|
# CORS Configuration
|
|
cors:
|
|
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,http://localhost:8080}
|
|
allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS,PATCH}
|
|
allowed-headers: ${CORS_ALLOWED_HEADERS:*}
|
|
allow-credentials: ${CORS_ALLOW_CREDENTIALS:true}
|
|
max-age: ${CORS_MAX_AGE:3600}
|
|
|
|
# Actuator Configuration
|
|
management:
|
|
endpoints:
|
|
web:
|
|
exposure:
|
|
include: health,info,metrics,prometheus
|
|
endpoint:
|
|
health:
|
|
show-details: always
|
|
health:
|
|
redis:
|
|
enabled: true
|
|
kafka:
|
|
enabled: true
|
|
|
|
# OpenAPI Documentation Configuration
|
|
springdoc:
|
|
api-docs:
|
|
path: /v3/api-docs
|
|
enabled: true
|
|
swagger-ui:
|
|
path: /swagger-ui.html
|
|
enabled: true
|
|
operations-sorter: method
|
|
tags-sorter: alpha
|
|
display-request-duration: true
|
|
doc-expansion: none
|
|
show-actuator: false
|
|
default-consumes-media-type: application/json
|
|
default-produces-media-type: application/json
|
|
|
|
# Logging Configuration
|
|
logging:
|
|
level:
|
|
root: INFO
|
|
com.kt.ai: DEBUG
|
|
org.springframework.kafka: INFO
|
|
org.springframework.data.redis: INFO
|
|
io.github.resilience4j: DEBUG
|
|
pattern:
|
|
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
|
|
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
|
|
file:
|
|
name: ${LOG_FILE:logs/ai-service.log}
|
|
logback:
|
|
rollingpolicy:
|
|
max-file-size: 10MB
|
|
max-history: 7
|
|
total-size-cap: 100MB
|
|
|
|
# Kafka Topics Configuration
|
|
kafka:
|
|
topics:
|
|
ai-job: ${KAFKA_TOPIC_AI_JOB:ai-event-generation-job}
|
|
ai-job-dlq: ${KAFKA_TOPIC_AI_JOB_DLQ:ai-event-generation-job-dlq}
|
|
|
|
# AI External API Configuration
|
|
ai:
|
|
claude:
|
|
api-url: ${CLAUDE_API_URL:https://api.anthropic.com/v1/messages}
|
|
api-key: ${CLAUDE_API_KEY:}
|
|
anthropic-version: ${CLAUDE_ANTHROPIC_VERSION:2023-06-01}
|
|
model: ${CLAUDE_MODEL:claude-3-5-sonnet-20241022}
|
|
max-tokens: ${CLAUDE_MAX_TOKENS:4096}
|
|
temperature: ${CLAUDE_TEMPERATURE:0.7}
|
|
timeout: ${CLAUDE_TIMEOUT:300000} # 5 minutes
|
|
gpt4:
|
|
api-url: ${GPT4_API_URL:https://api.openai.com/v1/chat/completions}
|
|
api-key: ${GPT4_API_KEY:}
|
|
model: ${GPT4_MODEL:gpt-4-turbo-preview}
|
|
max-tokens: ${GPT4_MAX_TOKENS:4096}
|
|
timeout: ${GPT4_TIMEOUT:300000} # 5 minutes
|
|
provider: ${AI_PROVIDER:CLAUDE} # CLAUDE or GPT4
|
|
|
|
# Circuit Breaker Configuration
|
|
resilience4j:
|
|
circuitbreaker:
|
|
configs:
|
|
default:
|
|
failure-rate-threshold: 50
|
|
slow-call-rate-threshold: 50
|
|
slow-call-duration-threshold: 60s
|
|
permitted-number-of-calls-in-half-open-state: 3
|
|
max-wait-duration-in-half-open-state: 0
|
|
sliding-window-type: COUNT_BASED
|
|
sliding-window-size: 10
|
|
minimum-number-of-calls: 5
|
|
wait-duration-in-open-state: 60s
|
|
automatic-transition-from-open-to-half-open-enabled: true
|
|
instances:
|
|
claudeApi:
|
|
base-config: default
|
|
failure-rate-threshold: 50
|
|
wait-duration-in-open-state: 60s
|
|
gpt4Api:
|
|
base-config: default
|
|
failure-rate-threshold: 50
|
|
wait-duration-in-open-state: 60s
|
|
timelimiter:
|
|
configs:
|
|
default:
|
|
timeout-duration: 300s # 5 minutes
|
|
instances:
|
|
claudeApi:
|
|
timeout-duration: 300s
|
|
gpt4Api:
|
|
timeout-duration: 300s
|
|
|
|
# Redis Cache TTL Configuration (seconds)
|
|
cache:
|
|
ttl:
|
|
recommendation: ${CACHE_TTL_RECOMMENDATION:86400} # 24 hours
|
|
job-status: ${CACHE_TTL_JOB_STATUS:86400} # 24 hours
|
|
trend: ${CACHE_TTL_TREND:3600} # 1 hour
|
|
fallback: ${CACHE_TTL_FALLBACK:604800} # 7 days
|