2025-06-13 14:51:00 +09:00

226 lines
5.4 KiB
YAML

# recommend/src/main/resources/application.yml
server:
port: ${RECOMMEND_SERVICE_PORT:8085}
spring:
cloud:
compatibility-verifier:
enabled: false
application:
name: recommend-service
# 프로필 설정
profiles:
active: ${SPRING_PROFILES_ACTIVE:local}
# 데이터베이스 설정
datasource:
url: ${RECOMMEND_DB_URL:jdbc:postgresql://20.249.162.245:5432/hiorder_recommend}
username: ${RECOMMEND_DB_USERNAME:hiorder_user}
password: ${RECOMMEND_DB_PASSWORD:hiorder_pass}
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: ${DB_POOL_SIZE:20}
minimum-idle: ${DB_POOL_MIN_IDLE:5}
connection-timeout: ${DB_CONNECTION_TIMEOUT:30000}
idle-timeout: ${DB_IDLE_TIMEOUT:600000}
max-lifetime: ${DB_MAX_LIFETIME:1800000}
pool-name: RecommendHikariCP
# JPA 설정
jpa:
hibernate:
ddl-auto: ${JPA_DDL_AUTO:update}
show-sql: ${JPA_SHOW_SQL:false}
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: ${JPA_FORMAT_SQL:true}
show_sql: ${JPA_SHOW_SQL:false}
use_sql_comments: ${JPA_USE_SQL_COMMENTS:true}
jdbc:
batch_size: 20
order_inserts: true
order_updates: true
open-in-view: false
# Redis 설정 (올바른 구조)
data:
redis:
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:}
timeout: 2000ms
database: ${REDIS_DATABASE:0}
lettuce:
pool:
max-active: ${REDIS_POOL_MAX_ACTIVE:8}
max-idle: ${REDIS_POOL_MAX_IDLE:8}
min-idle: ${REDIS_POOL_MIN_IDLE:2}
max-wait: -1ms
shutdown-timeout: 100ms
# 외부 서비스 URL 설정
services:
store:
url: ${STORE_SERVICE_URL:http://store-service:8082}
review:
url: ${REVIEW_SERVICE_URL:http://review-service:8083}
member:
url: ${MEMBER_SERVICE_URL:http://member-service:8081}
# Feign 설정
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 10000
loggerLevel: basic
store-service:
connectTimeout: 3000
readTimeout: 8000
review-service:
connectTimeout: 3000
readTimeout: 8000
circuitbreaker:
enabled: true
compression:
request:
enabled: true
response:
enabled: true
# Circuit Breaker 설정
resilience4j:
circuitbreaker:
instances:
store-service:
failure-rate-threshold: 50
wait-duration-in-open-state: 30000
sliding-window-size: 10
minimum-number-of-calls: 5
review-service:
failure-rate-threshold: 50
wait-duration-in-open-state: 30000
sliding-window-size: 10
minimum-number-of-calls: 5
retry:
instances:
store-service:
max-attempts: 3
wait-duration: 1000
review-service:
max-attempts: 3
wait-duration: 1000
# Actuator 설정
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus
endpoint:
health:
show-details: always
metrics:
export:
prometheus:
# Swagger/OpenAPI 설정
springdoc:
api-docs:
path: /api-docs
swagger-ui:
path: /swagger-ui.html
tags-sorter: alpha
operations-sorter: alpha
display-request-duration: true
display-operation-id: true
show-actuator: false
# 로깅 설정
logging:
level:
root: ${LOG_LEVEL_ROOT:INFO}
com.ktds.hi.recommend: ${LOG_LEVEL:INFO}
org.springframework.cloud.openfeign: ${LOG_LEVEL_FEIGN:DEBUG}
org.springframework.web: ${LOG_LEVEL_WEB:INFO}
org.springframework.data.redis: ${LOG_LEVEL_REDIS:INFO}
org.hibernate.SQL: ${LOG_LEVEL_SQL:INFO}
org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_LEVEL_SQL_PARAM:INFO}
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{traceId},%X{spanId}] %logger{36} - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{traceId},%X{spanId}] %logger{36} - %msg%n"
file:
name: ${LOG_FILE_PATH:./logs/recommend-service.log}
max-size: 100MB
max-history: 30
# Security 설정
security:
jwt:
secret: ${JWT_SECRET:hiorder-recommend-secret-key-2024}
expiration: ${JWT_EXPIRATION:86400000} # 24시간
cors:
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,http://localhost:8080}
allowed-methods: GET,POST,PUT,DELETE,OPTIONS
allowed-headers: "*"
allow-credentials: true
recommend:
cache:
recommendation-ttl: ${RECOMMENDATION_CACHE_TTL:1800}
user-preference-ttl: ${USER_PREFERENCE_CACHE_TTL:3600}
algorithm:
max-recommendations: ${MAX_RECOMMENDATIONS:20}
default-radius: ${DEFAULT_SEARCH_RADIUS:5000}
max-radius: ${MAX_SEARCH_RADIUS:10000}
---
# Local 환경 설정
spring:
config:
activate:
on-profile: local
jpa:
show-sql: true
hibernate:
ddl-auto: create-drop
logging:
level:
com.ktds.hi.recommend: DEBUG
org.springframework.web: DEBUG
---
# Development 환경 설정
spring:
config:
activate:
on-profile: dev
jpa:
show-sql: true
hibernate:
ddl-auto: update
logging:
level:
com.ktds.hi.recommend: DEBUG
---
# Production 환경 설정
spring:
config:
activate:
on-profile: prod
jpa:
show-sql: false
hibernate:
ddl-auto: validate
logging:
level:
root: WARN
com.ktds.hi.recommend: INFO
org.springframework.cloud.openfeign: INFO