生产检查清单
安全(Security)
安全(Security)
- 使用强度高且随机生成的 keys(密钥)
- 启用 HTTPS/TLS
- 限制 CORS origins(允许来源)
- 使用环境变量管理 secrets(敏感配置)
- 启用数据库加密
- 配置防火墙规则
性能(Performance)
性能(Performance)
- 配置 connection pooling(连接池)
- 启用 Redis 持久化
- 配置缓存
- 优化数据库查询
- 配置 rate limiting(限流)
监控(Monitoring)
监控(Monitoring)
- 配置日志聚合
- 配置 health checks(健康检查)
- 启用指标采集(metrics)
- 配置告警(alerts)
- 监控错误率
备份与恢复(Backup & Recovery)
备份与恢复(Backup & Recovery)
- 自动化数据库备份
- 演练恢复流程
- 备份配置文件
- 文档化恢复过程
安全配置
生成安全的 Keys
生产环境 config.yaml
部署架构
AWS 示例
环境变量(Environment Variables)
使用环境变量管理敏感配置:监控与日志(Monitoring & Logging)
日志配置
config.yaml
健康检查接口(Health Check Endpoint)
监控指标(Metrics)
- 请求延迟(p50、p95、p99)
- 按 endpoint 统计的错误率
- Providers 同步成功率
- 数据库连接池使用率
- Redis cache 命中率
- CPU 与内存使用率
备份策略
数据库备份
配置备份
扩容与伸缩(Scaling)
水平扩展(Horizontal Scaling)
- 在 load balancer 后部署多个 API 实例
- 使用 Redis cluster 做分布式缓存
- 读多写少场景使用数据库只读副本(read replicas)