refactor: P9 运维完善(健康端点/Docker 加固/CI-CD/scripts)
- /health 健康端点(白名单已加,Docker HEALTHCHECK 目标) - docker-compose 加固:build context 修复、privileged false、flask_user、bridge 网络 - .github/workflows/ci.yml:flake8 + mypy + pytest(含 MySQL/Redis 服务) - scripts/:health_check.py / init_db.py - Makefile 更新为 src/ 结构 【验收】全项目 flake8 0;12 passed;/health 200;health_check 脚本运行正常 【注】docker-compose 实际构建验证需 Docker 环境执行 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
2b001dde95
commit
8937799973
@@ -123,6 +123,15 @@ def create_app():
|
||||
# ============================================================
|
||||
register_error_handlers(app)
|
||||
|
||||
# ============================================================
|
||||
# 健康检查端点(供 Docker HEALTHCHECK / 运维探活)
|
||||
# ============================================================
|
||||
@app.route('/health')
|
||||
def health():
|
||||
"""健康检查:返回服务存活状态。"""
|
||||
from src.core import response as R
|
||||
return R.ok(data={"status": "ok"})
|
||||
|
||||
# ============================================================
|
||||
# 依赖注入(组合根注入业务实现)
|
||||
# ============================================================
|
||||
|
||||
Reference in New Issue
Block a user