Skip to content

Commit 84bf488

Browse files
committed
Add grpc health checks
1 parent c12ad79 commit 84bf488

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

llmstack/common/runner/server.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import redis
1313
from grpc import ServicerContext
1414
from grpc import server as grpc_server
15+
from grpc_health.v1 import health, health_pb2, health_pb2_grpc
1516
from playwright._impl._api_types import TimeoutError
1617
from playwright.async_api import async_playwright
1718

@@ -328,6 +329,14 @@ def main():
328329
runner.wss_secure = args.wss_secure
329330

330331
add_RunnerServicer_to_server(runner, server)
332+
333+
# Add health checking service
334+
health_servicer = health.HealthServicer()
335+
health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)
336+
337+
# Set the health status to SERVING
338+
health_servicer.set('', health_pb2.HealthCheckResponse.SERVING)
339+
331340
server.add_insecure_port(f'[::]:{args.port}')
332341
server.start()
333342

runner/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ RUN apt-get update && apt-get install -y \
1515

1616
RUN pip3 install poetry
1717

18+
# Install grpc_health_probe
19+
RUN wget -qO/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.22/grpc_health_probe-linux-amd64 && \
20+
chmod +x /grpc_health_probe
21+
1822
RUN mkdir /code
1923
WORKDIR /code
2024

0 commit comments

Comments
 (0)