Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💉 Add health check for hosting containerized tiled instances #770

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading