application-prod.yml
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
spring:
config:
activate:
on-profile: prod
# 生产环境数据库配置
datasource:
url: jdbc:postgresql://postgresql-service:5432/ecommerce
username: ${DB_USERNAME:admin}
password: ${DB_PASSWORD}
hikari:
maximum-pool-size: 10
minimum-idle: 2
connection-timeout: 30000
idle-timeout: 600000
max-lifetime: 1800000
# 生产环境 Flyway 配置
flyway:
validate-on-migrate: true
out-of-order: false
repair-on-migrate: true
ignore-missing-migrations: true
ignore-future-migrations: true
# 生产环境 JPA 配置
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
show_sql: false
format_sql: false
jdbc:
batch_size: 20
order_inserts: true
order_updates: true
# 生产环境 Redis 配置
redis:
host: redis-service
port: 6379
timeout: 5000
lettuce:
pool:
max-active: 1
max-idle: 1
min-idle: 1
max-wait: 5000ms
# 生产环境服务器配置
server:
port: 8080
servlet:
context-path: /api
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
min-response-size: 1024
# 生产环境管理端点
management:
endpoints:
web:
exposure:
include: health,info,metrics
base-path: /management
endpoint:
health:
show-details: when_authorized
show-components: when_authorized
metrics:
enabled: true
# 生产环境日志配置
logging:
level:
com.ecommerce.product: INFO
org.hibernate: WARN
org.springframework: INFO
org.flywaydb: INFO
file:
name: /var/log/product-service/application.log
pattern:
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
# 生产环境缓存配置
app:
cache:
product-ttl: 3600 # 1小时
category-ttl: 7200 # 2小时