Open source video conferencing app powered by LiveKit. Built with Django and React.
ποΈ(summary) serve health endpoints with the dockerflow router
briquet6ea2a858107d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8ed940a5..b53bd2dd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ and this project adheres to### Changed- π(backend) pin the dockerflow logger level to WARNING+- ποΈ(summary) serve health endpoints with the dockerflow router- β»οΈ(backend) serve the dockerflow views early in the middleware stack- π(frontend) include LiveKit SIDs in the connection analytics event- π(backend) silence expected 401 warnings on /mediff --git a/src/summary/pyproject.toml b/src/summary/pyproject.tomlindex c81f4d9f..04d5a751 100644--- a/src/summary/pyproject.toml+++ b/src/summary/pyproject.toml@@ -10,6 +10,7 @@ dependencies = ["pydantic-settings>=2.1.0","celery==5.6.3","redis==5.2.1",+ "dockerflow==2026.3.4","minio==7.2.20","openai==2.48.0","posthog==7.29.0",diff --git a/src/summary/summary/api/health.py b/src/summary/summary/api/health.pydeleted file mode 100644index eb37a711..00000000--- a/src/summary/summary/api/health.py+++ /dev/null@@ -1,17 +0,0 @@-"""API routes related to application health checking."""--from fastapi import APIRouter--router = APIRouter()--[email protected]("/__heartbeat__")-async def heartbeat():- """Health check endpoint for monitoring."""- return--[email protected]("/__lbheartbeat__")-async def lbheartbeat():- """Health check endpoint for load balancer."""- returndiff --git a/src/summary/summary/core/checks.py b/src/summary/summary/core/checks.pynew file mode 100644index 00000000..4ba6d167--- /dev/null+++ b/src/summary/summary/core/checks.py@@ -0,0 +1,24 @@+"""Dockerflow checks backing the /__heartbeat__ endpoint."""++from celery.exceptions import OperationalError+from dockerflow import checks++from summary.core.celery_worker import celery++BROKER_SOCKET_TIMEOUT = 2 # Should be under the readiness probe timeout (5s)++[email protected](name="broker_connected")+def check_broker_connected():+ """Report whether the Celery broker accepts a connection."""+ try:+ with celery.connection_for_write(+ transport_options={+ "socket_connect_timeout": BROKER_SOCKET_TIMEOUT,+ "socket_timeout": BROKER_SOCKET_TIMEOUT,+ }+ ) as connection:+ connection.ensure_connection(max_retries=0)+ except OperationalError as exc:+ return [checks.Error(str(exc), id="summary.health.E001")]+ return []diff --git a/src/summary/summary/main.py b/src/summary/summary/main.pyindex a63d2413..2f5659a9 100644--- a/src/summary/summary/main.py+++ b/src/summary/summary/main.py@@ -1,10 +1,11 @@"""Application."""import sentry_sdk+from dockerflow.fastapi import router as dockerflow_routerfrom fastapi import FastAPI-from summary.api import healthfrom summary.api.main import api_router_v2+from summary.core import checks # noqa: F401 -- registers the Dockerflow checksfrom summary.core.config import get_settingssettings = get_settings()@@ -18,4 +19,4 @@ app = FastAPI()app.include_router(api_router_v2, prefix=settings.app_api_v2_str)-app.include_router(health.router)+app.include_router(dockerflow_router)diff --git a/src/summary/tests/api/test_api_health.py b/src/summary/tests/api/test_api_health.pyindex b80e1762..ac374ff6 100644--- a/src/summary/tests/api/test_api_health.py+++ b/src/summary/tests/api/test_api_health.py@@ -1,21 +1,54 @@-"""Integration tests for the health check endpoints."""+"""Tests for the health check endpoints."""+from unittest import mock-class TestHeartbeat:- """Tests for the /__heartbeat__ endpoint."""+import pytest+from celery.exceptions import OperationalError- def test_returns_200(self, client):- """The heartbeat endpoint responds with 200 OK without an api_key."""- response = client.get("/__heartbeat__")- assert response.status_code == 200[email protected](name="broker")+def fixture_broker():+ """Patch the Celery broker connection the heartbeat check opens."""+ with mock.patch("summary.core.checks.celery.connection_for_write") as connect:+ connection = connect.return_value+ connection.__enter__.return_value = connection+ yield connectionclass TestLBHeartbeat:"""Tests for the /__lbheartbeat__ endpoint."""- def test_returns_200(self, client):+ def test_returns_200(self, client, broker):"""The LB heartbeat endpoint responds with 200 OK without an api_key."""response = client.get("/__lbheartbeat__")+ broker.ensure_connection.assert_not_called()assert response.status_code == 200+++class TestHeartbeat:+ """Tests for the /__heartbeat__ endpoint."""++ def test_returns_200(self, client, broker):+ """The heartbeat endpoint responds with 200 OK without an api_key."""+ response = client.get("/__heartbeat__")++ assert response.status_code == 200+ assert response.json()["checks"]["broker_connected"] == "ok"+ broker.ensure_connection.assert_called_once_with(max_retries=0)++ def test_returns_500_when_the_broker_is_unreachable(self, client, broker):+ """An unreachable celery broker takes the readiness probe down."""+ broker.ensure_connection.side_effect = OperationalError("Connection refused")++ response = client.get("/__heartbeat__")++ assert response.status_code == 500++ payload = response.json()+ assert payload["status"] == "error"+ assert payload["checks"]["broker_connected"] == "error"+ assert (+ payload["details"]["broker_connected"]["messages"]["summary.health.E001"]+ == "Connection refused"+ )diff --git a/src/summary/uv.lock b/src/summary/uv.lockindex cc4e11cd..e706316d 100644--- a/src/summary/uv.lock+++ b/src/summary/uv.lock@@ -423,6 +423,15 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/ba/5a/18ad964b0086c6e62e2e7500f7edc89e3faa45033c71c1893d34eed2b2de/dnspython-2.8.0-py3-none-any.whl", hash = "sha256:01d9bbc4a2d76bf0db7c1f729812ded6d912bd318d3b1cf81d30c0f845dbf3af", size = 331094, upload-time = "2025-09-07T18:57:58.071Z" },]+[[package]]+name = "dockerflow"+version = "2026.3.4"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/9c/03/935f8399094611981b37634a7ee078484b3995f744135339e51385638f6c/dockerflow-2026.3.4.tar.gz", hash = "sha256:6cc7fcab2a078d06aeca8b02e22fd7f6766dca322fb30aed6910684dbc08690c", size = 68701, upload-time = "2026-03-04T09:01:28.178Z" }+wheels = [+ { url = "https://files.pythonhosted.org/packages/86/b9/2d7bf30eb0c24e60e61e4f6ae7574e123d3fa51b39a612e146c94158446a/dockerflow-2026.3.4-py2.py3-none-any.whl", hash = "sha256:38fe0ad30a4aedf68e589919695d502fc6f584a761b56a91f56e80cbadfbf61a", size = 36424, upload-time = "2026-03-04T09:01:26.631Z" },+]+[[package]]name = "email-validator"version = "2.3.0"@@ -1511,6 +1520,7 @@ version = "1.31.0"source = { editable = "." }dependencies = [{ name = "celery" },+ { name = "dockerflow" },{ name = "fastapi", extra = ["standard"] },{ name = "langfuse" },{ name = "minio" },@@ -1534,6 +1544,7 @@ dev = [[package.metadata]requires-dist = [{ name = "celery", specifier = "==5.6.3" },+ { name = "dockerflow", specifier = "==2026.3.4" },{ name = "fastapi", extras = ["standard"], specifier = ">=0.105.0" },{ name = "langfuse", specifier = "==4.14.1" },{ name = "minio", specifier = "==7.2.20" },