CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Production-grade media metadata backend per docs/aurora-core-spec.md: Aurora-owned UUIDv7 identity system, normalized movie/TV/people/credits schema, provider abstraction with a TMDb adapter, an idempotent async ingestion pipeline (normalize -> match -> upsert -> provenance), a Postgres FTS/trigram search layer, a stateless FastAPI v1 API with Redis caching/rate-limiting, arq workers, dev/prod Docker Compose topologies, unit + integration + load tests, CI, and architecture/ database/API/ERD documentation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""Liveness and readiness endpoints (section 24)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from app.core.config import get_settings
|
|
from app.core.database import database_is_ready
|
|
from app.core.redis import redis_is_ready
|
|
from app.schemas.health import DependencyStatus, HealthOut, ReadyOut
|
|
|
|
router = APIRouter(tags=["health"])
|
|
|
|
|
|
@router.get("/health", response_model=HealthOut)
|
|
async def health() -> HealthOut:
|
|
"""Liveness probe: process is up and able to respond. No dependency
|
|
checks — that's /ready."""
|
|
|
|
return HealthOut(status="ok")
|
|
|
|
|
|
@router.get("/ready", response_model=ReadyOut)
|
|
async def ready() -> ReadyOut:
|
|
settings = get_settings()
|
|
|
|
db_ok = await database_is_ready()
|
|
redis_ok = await redis_is_ready()
|
|
|
|
dependencies = [
|
|
DependencyStatus(name="postgresql", ok=db_ok, required=True),
|
|
DependencyStatus(name="redis", ok=redis_ok, required=settings.REDIS_REQUIRED),
|
|
]
|
|
|
|
is_ready = db_ok and (redis_ok or not settings.REDIS_REQUIRED)
|
|
return ReadyOut(status="ready" if is_ready else "not_ready", dependencies=dependencies)
|