fix: P0问题修复 - JWT配置、安全扫描、备份、Runbook

P0 问题修复(按照 gap analysis):

1. JWT密钥配置修复
   - config.yaml 移除占位符,改为空字符串
   - 添加测试验证 JWT_SECRET 环境变量覆盖功能

2. Docker 部署完善
   - 添加 deploy.resources 限制(内存 512M,CPU 0.5)
   - 添加 healthcheck 健康检查
   - 添加 restart: unless-stopped 重启策略

3. 安全扫描集成
   - 创建 scripts/security/run-gosec.sh 安全扫描脚本
   - 创建 scripts/security/workflow-template.yml CI工作流模板
   - 运行 gosec 扫描发现 6 个 HIGH 级别整数溢出问题

4. 备份自动化
   - 创建 scripts/backup/backup.sh 自动备份脚本
   - 支持 SQLite 数据库和配置文件备份
   - 支持备份验证、自动清理、恢复功能

5. Runbook 文档
   - 创建 docs/runbooks/ 目录
   - 添加 4 个核心 Runbook:服务启动、服务停止、备份恢复、日志分析
   - 添加 README.md 索引文档
This commit is contained in:
2026-04-08 22:31:43 +08:00
parent 1b96715b55
commit 3b0bcf0ff7
11 changed files with 1191 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ redis:
jwt:
algorithm: HS256 # debug mode 使用 HS256
secret: "change-me-in-production-use-at-least-32-bytes-secret"
secret: "" # ⚠️ 生产环境必须通过 JWT_SECRET 环境变量设置
access_token_expire_minutes: 120 # 2小时
refresh_token_expire_days: 7 # 7天