fix: add Spring Boot DB/Redis overrides and full nginx routing
- docker-compose.yml: add SPRING_DATASOURCE_* and SPRING_DATA_REDIS_* environment vars for tenant-service and file-service; these override hardcoded production URLs in application.yml at startup. docs-site depends_on marked required:false so nginx starts even when docs-site image is unavailable. - config/nginx/conf.d/xuqm.conf: add routing for /api/ and /actuator/ to tenant-service:9001, /file/ to file-service:8086, /ops to ops-web; add client_max_body_size 100m and proxy headers. Discovered and verified during P5-01 WSL2 acceptance testing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
9eabe0d699
当前提交
20423a0347
@ -2,12 +2,43 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
|
client_max_body_size 100m;
|
||||||
|
|
||||||
location /health {
|
location /health {
|
||||||
return 200 "ok\n";
|
return 200 "ok\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
# tenant-service runs on port 9001
|
||||||
proxy_pass http://tenant-web:80;
|
location /api/ {
|
||||||
}
|
proxy_pass http://tenant-service:9001/api/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /actuator/ {
|
||||||
|
proxy_pass http://tenant-service:9001/actuator/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
# file-service runs on port 8086
|
||||||
|
location /file/ {
|
||||||
|
proxy_pass http://file-service:8086/file/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /ops {
|
||||||
|
proxy_pass http://ops-web:80;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://tenant-web:80;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -6,6 +6,15 @@ services:
|
|||||||
- ./config/xuqm.env
|
- ./config/xuqm.env
|
||||||
- ./config/secrets.env
|
- ./config/secrets.env
|
||||||
- ./config/tenant/bootstrap.env
|
- ./config/tenant/bootstrap.env
|
||||||
|
environment:
|
||||||
|
# Override application.yml hardcoded URLs; these vars take precedence over env_file
|
||||||
|
SPRING_DATASOURCE_URL: "jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-xuqm_private}?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"
|
||||||
|
SPRING_DATASOURCE_USERNAME: "${MYSQL_USERNAME:-xuqm}"
|
||||||
|
SPRING_DATASOURCE_PASSWORD: "${MYSQL_PASSWORD}"
|
||||||
|
SPRING_DATA_REDIS_HOST: "${REDIS_HOST}"
|
||||||
|
SPRING_DATA_REDIS_PORT: "${REDIS_PORT:-6379}"
|
||||||
|
SPRING_DATA_REDIS_PASSWORD: "${REDIS_PASSWORD}"
|
||||||
|
SPRING_DATA_REDIS_DATABASE: "${REDIS_DATABASE:-0}"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
file-service:
|
file-service:
|
||||||
@ -14,6 +23,14 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- ./config/xuqm.env
|
- ./config/xuqm.env
|
||||||
- ./config/secrets.env
|
- ./config/secrets.env
|
||||||
|
environment:
|
||||||
|
SPRING_DATASOURCE_URL: "jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-xuqm_private}?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"
|
||||||
|
SPRING_DATASOURCE_USERNAME: "${MYSQL_USERNAME:-xuqm}"
|
||||||
|
SPRING_DATASOURCE_PASSWORD: "${MYSQL_PASSWORD}"
|
||||||
|
SPRING_DATA_REDIS_HOST: "${REDIS_HOST}"
|
||||||
|
SPRING_DATA_REDIS_PORT: "${REDIS_PORT:-6379}"
|
||||||
|
SPRING_DATA_REDIS_PASSWORD: "${REDIS_PASSWORD}"
|
||||||
|
SPRING_DATA_REDIS_DATABASE: "${REDIS_DATABASE:-0}"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/uploads:/data/uploads
|
- ./data/uploads:/data/uploads
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@ -49,7 +66,9 @@ services:
|
|||||||
- tenant-service
|
- tenant-service
|
||||||
- tenant-web
|
- tenant-web
|
||||||
- ops-web
|
- ops-web
|
||||||
- docs-site
|
docs-site:
|
||||||
|
condition: service_started
|
||||||
|
required: false
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
im-service:
|
im-service:
|
||||||
@ -87,4 +106,3 @@ services:
|
|||||||
- ./config/xuqm.env
|
- ./config/xuqm.env
|
||||||
- ./config/secrets.env
|
- ./config/secrets.env
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户