修改
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
services:
|
||||
# ====================== Nginx 反向代理 ======================
|
||||
nginx:
|
||||
image: urban-lifeline-web:${IMAGE_VERSION:-latest}
|
||||
image: nginx:alpine
|
||||
container_name: urban-lifeline-nginx
|
||||
restart: unless-stopped
|
||||
profiles: ["infra", "all"]
|
||||
@@ -23,6 +23,9 @@ services:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
||||
# SSL 证书(可选)
|
||||
# - ./nginx/ssl:/etc/nginx/ssl:ro
|
||||
depends_on:
|
||||
- urban-lifeline-serv
|
||||
- urban-lifeline-web
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/health"]
|
||||
interval: 30s
|
||||
@@ -30,6 +33,73 @@ services:
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# ====================== 后端服务 All-in-One ======================
|
||||
urban-lifeline-serv:
|
||||
image: urban-lifeline-serv:${IMAGE_VERSION:-latest}
|
||||
container_name: urban-lifeline-serv
|
||||
restart: unless-stopped
|
||||
profiles: ["infra", "serv", "all"]
|
||||
networks:
|
||||
- urban-lifeline
|
||||
expose:
|
||||
- "8080"
|
||||
- "8081"
|
||||
- "8082"
|
||||
- "8083"
|
||||
- "8084"
|
||||
- "8085"
|
||||
- "8086"
|
||||
- "8087"
|
||||
- "8088"
|
||||
- "8089"
|
||||
- "8090"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-prod}
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
NACOS_NAMESPACE: ${NACOS_NAMESPACE:-}
|
||||
volumes:
|
||||
- ${DATA_ROOT:-../volumes}/logs/serv:/app/logs
|
||||
depends_on:
|
||||
nacos:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 180s
|
||||
|
||||
# ====================== 前端服务 All-in-One ======================
|
||||
urban-lifeline-web:
|
||||
image: urban-lifeline-web:${IMAGE_VERSION:-latest}
|
||||
container_name: urban-lifeline-web
|
||||
restart: unless-stopped
|
||||
profiles: ["infra", "web", "all"]
|
||||
networks:
|
||||
- urban-lifeline
|
||||
expose:
|
||||
- "8000"
|
||||
- "8001"
|
||||
- "8002"
|
||||
- "8003"
|
||||
- "8004"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
SHARED_PORT: 8000
|
||||
PLATFORM_PORT: 8001
|
||||
WORKCASE_PORT: 8002
|
||||
BIDDING_PORT: 8003
|
||||
WORKCASE_WECHAT_PORT: 8004
|
||||
volumes:
|
||||
- ${DATA_ROOT:-../volumes}/logs/web:/app/logs
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# ====================== Nacos 注册中心 ======================
|
||||
nacos:
|
||||
image: nacos/nacos-server:v3.1.0
|
||||
|
||||
@@ -1,19 +1,32 @@
|
||||
# ================================================
|
||||
# Urban Lifeline - 站点配置
|
||||
# Urban Lifeline - 站点配置 (All-in-One 模式)
|
||||
# ================================================
|
||||
|
||||
# 上游服务定义
|
||||
# 上游服务定义 - 后端 All-in-One 容器
|
||||
upstream gateway {
|
||||
server gateway:8080;
|
||||
server urban-lifeline-serv:8080;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
# 上游服务定义 - 前端 All-in-One 容器
|
||||
upstream shared {
|
||||
server urban-lifeline-web:8000;
|
||||
}
|
||||
|
||||
upstream platform {
|
||||
server platform:80;
|
||||
server urban-lifeline-web:8001;
|
||||
}
|
||||
|
||||
upstream workcase-web {
|
||||
server workcase-web:80;
|
||||
server urban-lifeline-web:8002;
|
||||
}
|
||||
|
||||
upstream bidding-web {
|
||||
server urban-lifeline-web:8003;
|
||||
}
|
||||
|
||||
upstream workcase-wechat {
|
||||
server urban-lifeline-web:8004;
|
||||
}
|
||||
|
||||
server {
|
||||
@@ -29,6 +42,21 @@ server {
|
||||
|
||||
# ====================== 前端应用代理 ======================
|
||||
|
||||
# Shared 公共模块 (Module Federation 远程模块)
|
||||
location /shared/ {
|
||||
proxy_pass http://shared/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# 允许跨域 (Module Federation 需要)
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
||||
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept";
|
||||
}
|
||||
|
||||
# Platform 管理平台
|
||||
location /platform/ {
|
||||
proxy_pass http://platform/;
|
||||
@@ -39,7 +67,7 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Workcase 工单系统
|
||||
# Workcase 工单系统 PC端
|
||||
location /workcase/ {
|
||||
proxy_pass http://workcase-web/;
|
||||
proxy_http_version 1.1;
|
||||
@@ -49,6 +77,26 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Bidding 招标系统
|
||||
location /bidding/ {
|
||||
proxy_pass http://bidding-web/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Workcase 工单系统微信端
|
||||
location /workcase-wechat/ {
|
||||
proxy_pass http://workcase-wechat/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# 默认首页(重定向到 platform)
|
||||
location = / {
|
||||
return 302 /platform/;
|
||||
|
||||
Reference in New Issue
Block a user