Files
nanocode/it_automation/docs/DEPLOYMENT_GUIDE.md
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

132 lines
3.2 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.
# IT资讯自动化系统部署指南
## 📋 系统概述
IT资讯自动化系统是一个集成了网页抓取、内容处理、邮件发送和小红书发布的自动化系统。
## 🗂️ 目录结构
```
it_automation/
├── scripts/ # 脚本文件
│ ├── main_scheduler_template.sh # 主调度脚本模板
│ ├── enhanced_crawler_template.py # 网页抓取模板
│ ├── content_converter_fixed.py # 内容转换器
│ └── humanizer_cn.py # 中文去AI化工具
├── config_templates/ # 配置模板
│ └── config_template.json # 配置文件模板
├── docs/ # 文档
│ └── DEPLOYMENT_GUIDE.md # 本文件
└── .gitignore # Git忽略规则
```
## 🔧 部署步骤
### 1. 环境准备
```bash
# 安装Python依赖
pip3 install requests beautifulsoup4 sqlite3
# 安装小红书CLI(如果需要)
# 参考: https://github.com/your-repo/xiaohongshu-cli
```
### 2. 配置文件设置
1. 复制配置模板:
```bash
cp config_templates/config_template.json config.json
```
2. 编辑 `config.json`,替换以下变量:
- `{{WORK_DIR}}` - 工作目录路径
- `{{DATABASE_PATH}}` - SQLite数据库路径
- `{{COOKIE_FILE_PATH}}` - 小红书Cookie文件路径
- `{{EMAIL_USERNAME}}` - 邮箱用户名
- `{{EMAIL_PASSWORD}}` - 邮箱密码
- `{{DEEPSEEK_API_KEY}}` - DeepSeek API密钥
### 3. 脚本配置
1. 编辑 `scripts/main_scheduler_template.sh`:
```bash
# 替换以下变量
WORK_DIR="/your/actual/work/dir"
XHS_SKILL_DIR="/your/xiaohongshu/skill/dir"
LOG_DIR="/your/log/dir"
```
2. 重命名脚本:
```bash
mv scripts/main_scheduler_template.sh scripts/main_scheduler.sh
chmod +x scripts/main_scheduler.sh
```
### 4. 敏感文件处理
**重要:以下文件不应提交到Git仓库**
1. **Cookie文件**:保持原位置,通过软链接引用
2. **数据库文件**:在工作目录中创建
3. **环境变量**:使用 `.env` 文件(已添加到.gitignore)
### 5. 定时任务设置
```bash
# 编辑crontab
crontab -e
# 添加以下行(每天16:00执行)
0 16 * * * /bin/bash /path/to/it_automation/scripts/main_scheduler.sh
```
## ⚠️ 安全注意事项
### 绝对不能提交的文件:
- `*.cookies.*` - Cookie文件
- `*.env` - 环境变量文件
- `config.json` - 包含敏感信息的配置文件
- `*.log` - 日志文件
- `*.db` - 数据库文件
### 安全建议:
1. 使用环境变量存储敏感信息
2. 定期更新Cookie
3. 监控系统日志
4. 定期备份数据库
## 🔍 故障排除
### 常见问题:
1. **脚本权限问题**:
```bash
chmod +x scripts/*.sh scripts/*.py
```
2. **Python依赖问题**:
```bash
pip3 install -r requirements.txt
```
3. **路径问题**:
- 检查所有脚本中的路径配置
- 确保目录存在且有写入权限
4. **小红书发布失败**:
- 检查Cookie是否过期
- 检查网络连接
- 查看详细日志
## 📞 支持
如有问题,请检查:
1. 系统日志:`logs/` 目录
2. 错误信息:脚本输出
3. 文档更新:查看最新版本
---
**最后更新:2026-03-19**
**版本:1.0.0**