Add service health checks and dynamic Apps page
Backend polls each registered service's /health endpoint every 30 s via a background asyncio task. GET /api/services exposes the live status snapshot. The Apps page now renders from this endpoint — showing "Unavailable" (dimmed, non-clickable) when a service is registered but its container is unreachable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# 2026-04-17 — Service health checks and dynamic Apps page
|
||||
|
||||
**Timestamp:** 2026-04-17T00:00:00Z
|
||||
|
||||
## Summary
|
||||
|
||||
Added a background health-check system to the backend that polls each registered feature service every 30 seconds. The Apps page now renders dynamically based on live service status — showing "Unavailable" when a service is registered but its container is unreachable.
|
||||
|
||||
## Files Added / Modified / Deleted
|
||||
|
||||
### Added
|
||||
- `backend/app/services/__init__.py` — package init
|
||||
- `backend/app/services/service_health.py` — service registry, background polling loop (`POLL_INTERVAL=30s`), `get_all_statuses()` read API
|
||||
- `backend/app/routers/services.py` — `GET /api/services` endpoint (requires auth)
|
||||
|
||||
### Modified
|
||||
- `backend/app/core/config.py` — added `DOC_SERVICE_URL` setting (default `http://doc-service:8001`)
|
||||
- `backend/app/main.py` — added FastAPI `lifespan` context manager: registers services, runs initial health check, starts background polling loop; mounts `/api/services` router
|
||||
- `frontend/src/api/client.ts` — added `ServiceStatus` interface and `getServices()` API function
|
||||
- `frontend/src/pages/AppsPage.tsx` — replaced hardcoded `APPS` array with dynamic query to `GET /api/services`; adds "Unavailable" state with dimmed card and explanation text
|
||||
- `backend/STATUS.md` — documented `/api/services` endpoint and health-check architecture
|
||||
- `frontend/STATUS.md` — documented dynamic Apps page behaviour
|
||||
Reference in New Issue
Block a user