feat(web): 移除 Docker 与反代部署,改为 Linux 业务服务并自带管理端托管
需求变更:Web 端只保留业务需求,反向代理交由另外的服务处理, 本项目仅提供 IIS / nginx 反代说明文档,不部署反代。 主要改动: - web-server: 新增管理端静态托管(ADMIN_DIR、SPA 深链接回退), 反代因此只需一条全匹配转发规则;新增 adminDir 配置项 - deploy/install.sh: 删除 nginx 安装与站点配置逻辑,改为原生 Linux 服务部署(systemd → OpenRC → SysVinit → 后台进程四级降级), 打印反代交接指引 - deploy/ctl.sh: 启停/状态/日志脚本 - deploy/proxy/: 新增反代说明文档(README.md、nginx.conf.example、 web.config.example),标注上传上限与超时必须同步调整 - 删除 deploy/nginx/、web-server/admin/nginx.conf、Dockerfile、 docker-compose.yml、.dockerignore - scripts/package-release.sh: 锚定排除规则 + 产物完整性校验 - 文档同步:README.txt、DSH.md、project.yaml、tasks/008、tasks/010
This commit is contained in:
+10
-13
@@ -61,24 +61,21 @@ npm run build # 产物在 dist/
|
||||
|
||||
`vite.config.ts` 使用 `base: './'`,产物使用相对路径引用,可挂在任意子路径下。
|
||||
|
||||
**生产部署(Linux 原生站点,不使用 Docker)**
|
||||
**生产部署(业务服务自带管理端,不需要反代托管静态文件)**
|
||||
|
||||
构建产物 `dist/` 由同一站点的 nginx 直接托管,API 由 nginx 反向代理到本机 Node 进程。
|
||||
整个过程由仓库根目录的 `deploy/install.sh` 一键完成:
|
||||
构建产物 `dist/` 会被安装到 `$APP_DIR/admin`,并由 **NestJS 服务自身**托管
|
||||
(含 SPA 深链接回退)。因此反向代理只需要把请求**整体转发**到后端端口即可,
|
||||
不需要在代理层再配置静态站点或 `try_files`。
|
||||
|
||||
```bash
|
||||
# 仓库根目录
|
||||
sudo bash deploy/install.sh
|
||||
# 仓库根目录,一键部署后端(含管理端)
|
||||
bash deploy/install.sh
|
||||
```
|
||||
|
||||
对应的 nginx 站点配置见 `deploy/nginx/opendance.conf`:
|
||||
|
||||
- `root` 指向安装后的 `admin/` 目录,`try_files $uri $uri/ /index.html` 支持 SPA 路由;
|
||||
- `/api/`、`/health`、`/static/` 反向代理到 `127.0.0.1:3000`(Node 只监听回环);
|
||||
- `client_max_body_size 512m` 与后端 `UPLOAD_MAX_BYTES` 保持一致。
|
||||
|
||||
本目录下的 `nginx.conf` 仅用于「把管理端单独托管到另一个 nginx 实例」的场景,
|
||||
其中的 `proxy_pass http://api:3000` 需要按实际情况改成后端地址。
|
||||
- 后端通过 `ADMIN_DIR` 定位管理端产物,默认 `../admin`
|
||||
- 反代配置样例:`deploy/proxy/nginx.conf.example`(nginx)、
|
||||
`deploy/proxy/web.config.example`(IIS)
|
||||
- 完整说明:`deploy/proxy/README.md`
|
||||
|
||||
## 目录结构
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||
gzip_min_length 1024;
|
||||
|
||||
# SPA 路由回退
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 上传大文件(模型 / 动作)时不要过早断开
|
||||
client_max_body_size 512m;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://api:3000;
|
||||
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;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
|
||||
location /health {
|
||||
proxy_pass http://api:3000;
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user