架构: 添加部署指南
This commit is contained in:
parent
4ccad813d9
commit
01172d429e
75
architecture/deployment.md
Normal file
75
architecture/deployment.md
Normal file
@ -0,0 +1,75 @@
|
||||
# 部署指南
|
||||
|
||||
## 环境要求
|
||||
|
||||
### 后端
|
||||
- Node.js 18+
|
||||
- SQLite3
|
||||
- 2GB+ RAM
|
||||
|
||||
### 前端
|
||||
- Electron 28+
|
||||
- 4GB+ RAM
|
||||
|
||||
## 部署步骤
|
||||
|
||||
### 1. 后端部署
|
||||
|
||||
```bash
|
||||
# 克隆代码
|
||||
git clone <repo-url>
|
||||
cd clouddisk-project/backend
|
||||
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 配置环境变量
|
||||
cp .env.example .env
|
||||
# 编辑 .env 文件
|
||||
|
||||
# 启动服务
|
||||
npm start
|
||||
|
||||
# 使用 PM2 守护进程
|
||||
pm2 start src/index.js --name clouddisk-backend
|
||||
```
|
||||
|
||||
### 2. 前端构建
|
||||
|
||||
```bash
|
||||
cd clouddisk-project/frontend
|
||||
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 开发模式
|
||||
npm run dev
|
||||
|
||||
# 生产构建
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 3. 反向代理 (Nginx)
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name api.yourdomain.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 监控
|
||||
|
||||
- PM2: `pm2 monit`
|
||||
- 日志: `pm2 logs`
|
||||
|
||||
## 备份
|
||||
|
||||
- 定期备份 SQLite 数据库文件
|
||||
- 备份上传目录
|
||||
Loading…
Reference in New Issue
Block a user