diff --git a/tiled/_tests/test_routes.py b/tiled/_tests/test_routes.py index bec5f7961..f8a0b78c5 100644 --- a/tiled/_tests/test_routes.py +++ b/tiled/_tests/test_routes.py @@ -5,7 +5,7 @@ from ..server.app import build_app -@pytest.mark.parametrize("path", ["/", "/docs"]) +@pytest.mark.parametrize("path", ["/", "/docs", "/healthz"]) @pytest.mark.asyncio async def test_meta_routes(path): app = build_app({}) diff --git a/tiled/server/app.py b/tiled/server/app.py index e5c953b3a..a21162867 100644 --- a/tiled/server/app.py +++ b/tiled/server/app.py @@ -217,6 +217,12 @@ async def lifespan(app: FastAPI): app = FastAPI(lifespan=lifespan) + # Healthcheck for deployment to containerized systems, needs to preempt other responses. + # Standardized for Kubernetes, but also used by other systems. + @app.get("/healthz", status_code=200) + async def healthz(): + return {"status": "ready"} + if SHARE_TILED_PATH: # If the distribution includes static assets, serve UI routes.