Files
MC_Report/INSTALL.md

111 lines
2.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.
# MC Report — 部署文档
## 环境要求
- Node.js ≥ 18 / npm ≥ 9
- MySQL ≥ 5.7(或 MariaDB ≥ 10.2
## 快速开始
```bash
npm install
node backend/server.js
# → 浏览器打开 http://localhost:3100
# → 自动跳转安装向导
```
### 安装向导
**第1步数据库配置**
- MySQL 主机(默认 localhost
- 端口(默认 3306
- 用户名 / 密码
- 数据库名(不存在则自动创建)
**第2步创建服主账号**
- 站点名称、站点地址
- 服主用户名、密码、邮箱
安装完成后 **重启服务器** 加载业务路由。
## 配置文件 `data/config.json`
```json
{
"db_host": "localhost",
"db_port": 3306,
"db_user": "root",
"db_pass": "",
"db_name": "mc_report",
"jwt_secret": "(安装时随机64位)",
"api_key": "(安装时随机48位)",
"external_api_key": "(安装时随机48位)"
}
```
## 生产部署
```bash
PORT=3100 CORS_ORIGIN=https://your-domain.com node backend/server.js
```
### PM2
```bash
npm i -g pm2
pm2 start backend/server.js --name mc-report
pm2 save && pm2 startup
```
### Nginx
```nginx
server {
listen 80;
server_name mc.example.com;
client_max_body_size 55m;
location / {
proxy_pass http://127.0.0.1:3100;
include nginx.inc;
}
}
```
## 邮件配置
后台 → 系统设置 → SMTP 填写。未配置时注册用户自动激活。
## Webhook
后台 → 通知配置 → 添加 Discord Webhook URL → 选择触发事件(工单创建/认领/转交/更新)。
## 数据库
MySQL安装时自动建表。备份
```bash
mysqldump -u root -p mc_report > backup.sql
```
## 目录
```
mc-report/
├── backend/
│ ├── server.js
│ ├── db.js
│ ├── mailer.js
│ ├── webhook.js
│ ├── middleware/{auth,security,upload}.js
│ └── routes/{auth,tickets,install,external,users,settings,export,polls,features,notifications,captcha,uploads}.js
├── public/ # 前端 SPA16 页面)
├── mc-report-plugin/ # Paper 1.20+ 插件
├── nginx.inc
├── data/config.json
├── data/uploads/
├── package.json
├── README.md
└── INSTALL.md
```