configmap.yaml
3.49 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
apiVersion: v1
kind: ConfigMap
metadata:
  name: inventory-service-config
  namespace: ecommerce
  labels:
    app: inventory-service
data:
  application.yml: |
    server:
      port: 8080
      servlet:
        context-path: /api/inventory
    
    spring:
      application:
        name: inventory-service
      profiles:
        active: production
      
      # PostgreSQL 数据库配置
      datasource:
        url: jdbc:postgresql://postgresql-service:5432/ecommerce
        username: admin
        password: ${POSTGRES_PASSWORD}
        driver-class-name: org.postgresql.Driver
        hikari:
          maximum-pool-size: 10
          minimum-idle: 2
          connection-timeout: 30000
          idle-timeout: 600000
          max-lifetime: 1800000
      
      # JPA 配置 - 修改为 update 来自动创建表
      jpa:
        hibernate:
          ddl-auto: update
          naming:
            physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
        show-sql: false
        properties:
          hibernate:
            dialect: org.hibernate.dialect.PostgreSQLDialect
            format_sql: true
            jdbc:
              batch_size: 20
              order_inserts: true
              order_updates: true
      
      # MongoDB 配置
      data:
        mongodb:
          uri: mongodb://admin:${MONGO_PASSWORD}@mongodb-service:27017/ecommerce?authSource=admin
          database: ecommerce
          auto-index-creation: true
      
      # Redis 配置
      redis:
        host: redis-service
        port: 6379
        password: ${REDIS_PASSWORD}
        timeout: 2000
        lettuce:
          pool:
            max-active: 10
            max-idle: 5
            min-idle: 2
            max-wait: 1000
      
      # RabbitMQ 配置 - 使用 admin 用户
      rabbitmq:
        host: rabbitmq-service
        port: 5672
        username: admin
        password: ${RABBITMQ_PASSWORD}
        virtual-host: /
        # 连接池配置
        connection-timeout: 5000
        template:
          retry:
            enabled: true
            initial-interval: 1000
            max-attempts: 3
            max-interval: 10000
            multiplier: 2.0
        listener:
          simple:
            retry:
              enabled: true
              initial-interval: 1000
              max-attempts: 3
              max-interval: 10000
              multiplier: 2.0
            auto-startup: true
            acknowledge-mode: auto
            prefetch: 1
            default-requeue-rejected: false
    
    # 禁用 Eureka 服务发现
    eureka:
      client:
        enabled: false
        register-with-eureka: false
        fetch-registry: false
      instance:
        enabled: false
    
    # 缓存配置
    cache:
      type: redis
      redis:
        time-to-live: 1800000
        cache-null-values: false
    
    # 外部服务配置
    service:
      product:
        url: http://product-service:8080
      order:
        url: http://order-service:8080
    
    # 日志配置
    logging:
      level:
        com.ecommerce.inventoryservice: DEBUG
        org.hibernate.SQL: WARN
        org.hibernate.type.descriptor.sql.BasicBinder: WARN
        org.springframework.data.mongodb.core: WARN
        org.springframework.amqp: WARN
    
    # Actuator 配置
    management:
      endpoints:
        web:
          exposure:
            include: health,info,metrics,prometheus
      endpoint:
        health:
          show-details: always
          probes:
            enabled: true