Files
getDomain/docs/05_domainCheck_Linux部署清单.md
Your Name 32efff1670 dev
2026-04-16 13:05:07 +08:00

143 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 05 domainCheck Linux 部署清单
## 一、目标形态
- `domain-web`:提供运营管理后台
- `domain-api`:提供接口、日志、运行中心、导入导出能力
- `domainCheck`:继续承载检测核心与 Worker
- `PostgreSQL + Redis`:建议同机或同内网部署
## 二、服务器准备
- 操作系统Ubuntu 22.04 / Debian 12 / Rocky Linux 9 均可
- Python`3.11`
- Node仅构建前端时需要运行静态文件不强依赖
- PostgreSQL建议 `14+`
- Redis建议 `6+`
## 三、目录建议
```text
/opt/domaincheck
├── domain-api
├── domain-web
└── domainCheck
```
## 四、上线前核对
### 1. 数据库
- `domains`
- `detect_tasks`
- `domain_detections`
- `domain_blacklist`
- `sensitive_words`
确认这几张核心表已经存在。
### 2. Redis
确认可以正常读写:
- `domain_tool:detect_options`
- `domain_tool:proxy_config`
- `domain_tool:thread_count`
### 3. Worker 配置
确认 `domainCheck/.env` 已配置:
- `DB_HOST`
- `DB_PORT`
- `DB_DATABASE`
- `DB_USER`
- `DB_PASSWORD`
- `REDIS_HOST`
- `REDIS_PORT`
- `REDIS_PASSWORD`
### 4. Web/API 配置
确认 `domain-api` 使用:
- `WORKER_MODE=linux-systemd`
- `WORKER_SERVICE_NAME=domaincheck-worker`
- `API_SERVICE_NAME=domaincheck-api`
## 五、部署顺序
1. 上传 `domainCheck`
2. 上传 `domain-api`
3. 上传 `domain-web`
4. 创建 Python 虚拟环境并安装依赖
5. 初始化或连接 PostgreSQL/Redis
6. 安装 `systemd` 服务
7. 启动 `domaincheck-api`
8. 启动 `domaincheck-worker`
9. 验证 Web 后台与运行中心
### 前端补充
`domain-web` 建议:
1. 复制 `.env.production.example``.env.production`
2. 修改 `VITE_API_BASE_URL`
3. 执行 `deploy/linux/publish.sh`
4. 使用 `deploy/nginx/domain-web.conf` 配置 Nginx
## 六、上线后验证
### 1. API
访问:
```text
http://服务器IP:8100/health
```
### 2. Web 后台
确认能正常完成:
- 登录
- 系统设置读取
- 域名筛选查询
- 导出列表查看
- 日志诊断查看
### 3. Worker
确认:
- 运行中心显示 Worker 在线
- 检测控制可读到当前进程数
- `detect_worker.log` 正常写入
## 七、切换策略
建议按下面顺序平滑切换:
1. `Web 后台` 先接管配置、筛选、导出、日志
2. `Linux Worker` 再逐步接管检测主任务
3. `Windows 桌面端` 暂时保留为备用入口
4. 运行稳定后,再考虑淡出桌面检测端
## 八、当前完成度
截至当前版本,已完成:
- Web 后台主页面
- API 接口主链路
- 运行中心
- Windows 本地 Worker 控制
- Linux systemd 控制模式支持
- systemd 模板文件
仍建议上线前重点复测:
- Linux systemd 实机启停
- Linux 下日志路径与权限
- 真实代理池在国内服务器上的表现
- 大批量导入与导出任务表现