feat: strengthen P0 security and operations
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
可选:
|
||||
|
||||
- Redis 7;
|
||||
- ClamAV(验证资源安全扫描时需要)。
|
||||
|
||||
```bash
|
||||
dotnet --version
|
||||
@@ -98,15 +99,17 @@ export ConnectionStrings__Redis='localhost:6379,abortConnect=false'
|
||||
|
||||
Production 必须配置 Redis;PostgreSQL 仍是用户、Session、权限、套餐和用量的权威数据源。
|
||||
|
||||
## 7. 后台处理
|
||||
## 7. 启动 Worker 与 ClamAV
|
||||
|
||||
API 默认在同一进程启动域名、订阅、用量和后台任务 Hosted Service。需要临时关闭时配置:
|
||||
API 不处理后台循环。另开终端启动 Worker:
|
||||
|
||||
```bash
|
||||
export BackgroundProcessing__Enabled=false
|
||||
dotnet run --project Tiku.Worker
|
||||
```
|
||||
|
||||
后台任务状态、租约、重试和 `RunAfter` 存在 PostgreSQL。域名 DNS/TLS 流程只有在 `TenantDomains` 的 CNAME target 和 Gateway 配置完整后才能激活自定义域名。
|
||||
`Worker__Enabled=false` 仅用于测试或维护。后台任务状态、租约、重试和 `RunAfter` 存在 PostgreSQL;多个 Worker 通过 advisory lock 和任务租约协调。域名 DNS/TLS 流程只有在 `TenantDomains` 的 CNAME target 和 Gateway 配置完整后才能激活自定义域名。
|
||||
|
||||
上传确认会创建 `asset_security_scan` 任务。Worker 通过 TCP 3310 连接 ClamAV,且 ClamAV `StreamMaxLength` 必须不小于 `Storage:MaxUploadBytes`(当前默认均为 500 MiB)。本地可以使用容器启动 ClamAV,并确保该限制已配置;ClamAV 不可用时任务会重试,资源保持不可访问。
|
||||
|
||||
## 8. 开发验证
|
||||
|
||||
@@ -146,7 +149,7 @@ psql -h 127.0.0.1 -U <数据库用户> -d postgres -c 'select current_user;'
|
||||
|
||||
### Readiness 返回 503
|
||||
|
||||
检查响应中的 `database` 和 `redis.ready`。配置了 Redis 连接串但服务未启动时,readiness 会返回 503。
|
||||
匿名 readiness 只返回总体 `status` 与 `checkedAt`。配置了 Redis 连接串但服务未启动时会返回 503;依赖细节需要使用具有 `platform:operations:view` 权限的平台账号访问 `/api/platform-admin/operations/health`。
|
||||
|
||||
### API 出现 HTTPS 重定向警告
|
||||
|
||||
|
||||
Reference in New Issue
Block a user