Skip to content

Commit

Permalink
Merge pull request #770 from Kezzsim/pod_health
Browse files Browse the repository at this point in the history
💉 Add health check for hosting containerized tiled instances
  • Loading branch information
Kezzsim authored Jul 17, 2024
2 parents 9398939 + 3a42a2d commit 2e392d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tiled/_tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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({})
Expand Down
6 changes: 6 additions & 0 deletions tiled/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 2e392d6

Please sign in to comment.