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>
这个提交包含在:
徐勤民 2026-05-19 00:13:09 +08:00
父节点 9eabe0d699
当前提交 20423a0347
共有 2 个文件被更改,包括 52 次插入3 次删除

查看文件

@ -2,12 +2,43 @@ server {
listen 80;
server_name _;
client_max_body_size 100m;
location /health {
return 200 "ok\n";
}
location / {
proxy_pass http://tenant-web:80;
}
# tenant-service runs on port 9001
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/secrets.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
file-service:
@ -14,6 +23,14 @@ services:
env_file:
- ./config/xuqm.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:
- ./data/uploads:/data/uploads
restart: unless-stopped
@ -49,7 +66,9 @@ services:
- tenant-service
- tenant-web
- ops-web
- docs-site
docs-site:
condition: service_started
required: false
restart: unless-stopped
im-service:
@ -87,4 +106,3 @@ services:
- ./config/xuqm.env
- ./config/secrets.env
restart: unless-stopped