fix(api): 加 /health 存活探针端点(治Docker HEALTHCHECK恒unhealthy,/health原404)
This commit is contained in:
@@ -61,6 +61,12 @@ def build_app(config_path: str = "config/backtest.yaml", static_dir: str | None
|
|||||||
max_workers=max_workers,
|
max_workers=max_workers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Liveness probe for Docker HEALTHCHECK (curl -f /health). Registered
|
||||||
|
# unconditionally so it works with or without the SPA static mount.
|
||||||
|
@app.get("/health", include_in_schema=False)
|
||||||
|
async def _health() -> dict[str, str]:
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
# SPA static mount with history fallback. Register the root route BEFORE
|
# SPA static mount with history fallback. Register the root route BEFORE
|
||||||
# mounting StaticFiles at "/" so the explicit handler wins for "/".
|
# mounting StaticFiles at "/" so the explicit handler wins for "/".
|
||||||
if static_dir and os.path.isdir(static_dir):
|
if static_dir and os.path.isdir(static_dir):
|
||||||
|
|||||||
Reference in New Issue
Block a user