合并启动脚本到deploy.sh,支持reset重置数据

- 删除 start_web.sh,统一使用 deploy.sh(Docker部署)
- 新增子命令:reset(删除所有数据需确认)、logs、stop、restart
- 更新 README 文档
This commit is contained in:
yml2213
2026-06-24 16:11:00 +08:00
parent a7da949d9c
commit ab84355cdc
3 changed files with 196 additions and 208 deletions
+14 -41
View File
@@ -35,30 +35,29 @@ douyu_login_py/
├── utils/ # 通用工具
│ └── logger.py
├── data/ # 运行时数据(gitignore
├── start_web.sh # 一键启动
├── deploy.sh # 部署/重置工具
└── pyproject.toml
```
## 快速开始
```bash
# 一键启动(自动检查依赖
./start_web.sh
# Docker 部署(推荐
./deploy.sh
```
或手动启动:
访问 `http://localhost:8000`,默认账号 `admin / admin123`
**常用命令:**
```bash
# 后端
uv pip install -e .
.venv/bin/python -m uvicorn web.backend.main:app --reload --port 8000
# 前端
cd web/frontend && npm install && npm run dev
./deploy.sh # 构建并部署
./deploy.sh logs # 查看实时日志
./deploy.sh stop # 停止服务
./deploy.sh restart # 重启服务
./deploy.sh reset # 重置所有数据(需二次确认)
```
访问 `http://localhost:5173`,默认账号 `admin / admin123`
### 敏感数据加密
账号密码、邮箱密码、Cookie、代理密钥等敏感字段会以密文形式落盘。生产环境请在 `.env` 中设置稳定的 `APP_ENCRYPTION_KEY`,并长期保留;更换该密钥会导致历史密文无法解密。
@@ -100,46 +99,20 @@ MIT License
## 部署
### Docker 部署(推荐,生产环境)
### Docker 部署
```bash
# 一键部署(自动构建镜像 + 启动服务)
./deploy.sh
# 或手动操作:
docker compose up -d --build
# 重置所有数据(删除数据库/Cookie/日志,需二次确认)
./deploy.sh reset
```
部署完成后访问 `http://服务器IP:8000`,默认账号 `admin / admin123`
**Docker 常用命令:**
```bash
docker compose logs -f # 查看实时日志
docker compose restart # 重启服务
docker compose down # 停止服务
docker compose up -d --build # 重新构建并启动(代码更新后)
```
**数据持久化:** 数据库和日志通过 volume 挂载到宿主机 `./data``./logs` 目录,容器重建后数据不丢失。
### 本地开发
```bash
# 一键启动(自动检查依赖,前后端分离开发模式)
./start_web.sh
# 或手动启动:
# 后端
uv pip install -e .
.venv/bin/python -m uvicorn web.backend.main:app --reload --port 8000
# 前端
cd web/frontend && npm install && npm run dev
```
访问 `http://localhost:5173`(开发模式),默认账号 `admin / admin123`
### 代理配置说明
在 Web 界面"代理配置"页面设置: