fix: 将 get_weather_details 和 health_check 移出 JWT 保护作用域作为公开接口
This commit is contained in:
35
AGENTS.md
35
AGENTS.md
@@ -43,6 +43,7 @@ migrations/
|
||||
static/
|
||||
└── katex/ # KaTeX 数学公式渲染库
|
||||
|
||||
test_deployment.sh # 部署后测试脚本(自动执行)
|
||||
tests/
|
||||
└── integration_test.rs # 基础测试框架
|
||||
|
||||
@@ -327,8 +328,40 @@ cargo clippy # 代码检查
|
||||
|
||||
**部署**:
|
||||
```bash
|
||||
./deploy.sh development # 部署到测试服务器
|
||||
./deploy.sh development # 部署到测试服务器(编译 + 传文件 + 重启服务)
|
||||
./deploy.sh production # 部署到生产服务器
|
||||
|
||||
```
|
||||
|
||||
**deploy.sh 功能说明**:
|
||||
|
||||
| 步骤 | 说明 |
|
||||
|------|------|
|
||||
| 依赖检查 | 验证 `cargo`、`rsync`、`ssh` 命令 |
|
||||
| 编译 | `APP_ENV={环境} cargo build --release` |
|
||||
| 上传二进制 | `rsync target/release/rust-backend → 远程目录` |
|
||||
| 上传配置 | `rsync ./config/ → 远程目录/config/` |
|
||||
| 上传测试脚本 | `rsync test_deployment.sh → 远程目录/` |
|
||||
| 重启服务 | `systemctl restart {服务名}` |
|
||||
| **部署后测试** | `ssh 远程执行 test_deployment.sh` |
|
||||
|
||||
**远程目录与服务对应**:
|
||||
|
||||
| 环境 | 远程目录 | systemd 服务 |
|
||||
|------|---------|-------------|
|
||||
| development | `/root/rust/rust_backend_dev` | `rust-backend-dev.service` |
|
||||
| production | `/root/rust/rust_backend` | `rust-backend.service` |
|
||||
|
||||
> 直接运行 `./deploy.sh` 默认部署 production 环境。
|
||||
|
||||
**test_deployment.sh 测试内容**:
|
||||
|
||||
| 测试项 | 说明 |
|
||||
|--------|------|
|
||||
| 本地后端 | `GET http://127.0.0.1:8080/health` 返回 200 |
|
||||
| 域名访问 | `GET https://xmclassmate.top/dev` 返回 200/301/302 |
|
||||
| 静态文件 | CSS、JS、favicon 等文件返回 200 |
|
||||
|
||||
> 部署后自动执行,测试通过才算部署成功。
|
||||
|
||||
服务器尝试端口顺序:4433、8443、8080、3000、8000、8888
|
||||
|
||||
Reference in New Issue
Block a user