【重要】traefik 配置

This commit is contained in:
编码猿
2025-09-30 10:01:58 +08:00
parent a3ba6c2944
commit 3c66faf9a7
3 changed files with 120 additions and 75 deletions

View File

@@ -1,68 +1,107 @@
http:
routers:
app-product-router:
rule: PathPrefix(`/app-product`)
service: app-product-service
entryPoints:
- web
middlewares:
- compress
- ipWhiteList
- rateLimit
- retries
main-app-router:
rule: PathPrefix(`/main-app`)
service: main-app-service
entryPoints:
- web
middlewares:
- compress
- ipWhiteList
- rateLimit
- retries
app-shared-router:
rule: PathPrefix(`/app-shared`)
rule: Host(`nacos.ddd.com`) && PathPrefix(`/app-shared`)
service: app-shared-service
observability:
metrics: true
accessLogs: true
tracing: true
traceVerbosity: detailed
entryPoints:
- web
middlewares:
- compress
- ipWhiteList
- rateLimit
- retries
app-product-router:
rule: Host(`nacos.ddd.com`) && PathPrefix(`/app-product`)
service: app-product-service
observability:
metrics: true
accessLogs: true
tracing: true
traceVerbosity: detailed
entryPoints:
- web
# 使用域名访问前端main-app
main-ddd-router:
rule: Host(`main.ddd.com`)
service: main-ddd-service
observability:
metrics: true
accessLogs: true
tracing: true
traceVerbosity: detailed
entryPoints:
- web
# Nacos 集群 管理后台的统一访问域名
nacosui-ddd-router:
rule: Host(`nacosui.ddd.com`)
service: nacosui-ddd-service
observability:
metrics: true
accessLogs: true
tracing: true
traceVerbosity: detailed
entryPoints:
- web
# trafik 网关 代理 内网 nacos 集群 的地址
nacos-ddd-router:
rule: Host(`nacos.ddd.com`)
service: nacos-ddd-service
observability:
metrics: true
accessLogs: true
tracing: true
traceVerbosity: detailed
entryPoints:
- web
# trafik 网关的管理后台的域名
trafikui-ddd-router:
rule: Host(`trafikui.ddd.com`)
service: trafikui-ddd-service
observability:
metrics: true
accessLogs: true
tracing: true
traceVerbosity: detailed
entryPoints:
- web
services:
app-product-service:
loadBalancer:
servers:
- url: http://192.168.31.101:1301
main-app-service:
loadBalancer:
servers:
- url: http://192.168.31.101:1300
app-shared-service:
loadBalancer:
servers:
- url: http://192.168.31.101:1333
middlewares:
rateLimit:
rateLimit:
average: 100
burst: 200
period: 1s
sourceCriterion:
ipStrategy:
depth: 2
compress:
compress:
excludedContentTypes:
- text/event-stream
minResponseBodyBytes: 1024
ipWhiteList:
ipWhiteList:
sourceRange:
- 127.0.0.1/32
- 192.168.107.0/24
retries:
retry:
attempts: 3
initialInterval: 200ms
app-product-service:
loadBalancer:
servers:
- url: http://192.168.31.101:1301
main-ddd-service:
loadBalancer:
servers:
- url: http://192.168.31.101:1300
nacosui-ddd-service:
loadBalancer:
servers:
- url: http://192.168.139.84:8080
- url: http://192.168.139.15:8080
- url: http://192.168.139.178:8080
nacos-ddd-service:
loadBalancer:
servers:
- url: http://192.168.139.84:8848
- url: http://192.168.139.15:8848
- url: http://192.168.139.178:8848
trafikui-ddd-service:
loadBalancer:
servers:
- url: http://192.168.139.80:8080