Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat(docreader): add health check
wizardchen6f6ca84dae96
diff --git a/docker-compose.yml b/docker-compose.ymlindex 9af3f4135..9499cffeb 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -68,6 +68,8 @@ services:condition: service_healthyminio:condition: service_started+ docreader:+ condition: service_healthynetworks:- WeKnora-networkrestart: unless-stopped@@ -129,6 +131,12 @@ services:- MINIO_BUCKET_NAME=${MINIO_BUCKET_NAME}- MINIO_USE_SSL=${MINIO_USE_SSL}- WEB_PROXY=${WEB_PROXY}+ healthcheck:+ test: ["CMD", "grpc_health_probe", "-addr=:50051"]+ interval: 30s+ timeout: 10s+ retries: 3+ start_period: 60snetworks:- WeKnora-networkrestart: unless-stoppeddiff --git a/docker/Dockerfile.docreader b/docker/Dockerfile.docreaderindex d512749c4..e90be5dfd 100644--- a/docker/Dockerfile.docreader+++ b/docker/Dockerfile.docreader@@ -114,7 +114,13 @@ RUN apt-get update && apt-get install -y \libglu1-mesa \libsm6 \libreoffice \+ curl \&& rm -rf /var/lib/apt/lists/*++# 安装 grpc_health_probe+RUN GRPC_HEALTH_PROBE_VERSION=v0.4.24 && \+ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \+ chmod +x /bin/grpc_health_probe# 从构建阶段复制已安装的依赖和生成的代码COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packagesdiff --git a/services/docreader/requirements.txt b/services/docreader/requirements.txtindex d6e6afabb..afef307d7 100644--- a/services/docreader/requirements.txt+++ b/services/docreader/requirements.txt@@ -1,5 +1,6 @@grpciogrpcio-tools+grpcio-health-checkingprotobufpython-docxPyPDF2diff --git a/services/docreader/src/server/server.py b/services/docreader/src/server/server.pyindex 988ba36a1..9018d3e27 100644--- a/services/docreader/src/server/server.py+++ b/services/docreader/src/server/server.py@@ -6,6 +6,8 @@ import tracebackimport grpcimport uuidimport atexit+from grpc_health.v1 import health_pb2_grpc+from grpc_health.v1.health import HealthServicer# Add parent directory to Python pathcurrent_dir = os.path.dirname(os.path.abspath(__file__))@@ -348,9 +350,13 @@ def serve():],)- # Register service+ # Register servicesdocreader_pb2_grpc.add_DocReaderServicer_to_server(DocReaderServicer(), server)+ # Register health check service+ health_servicer = HealthServicer()+ health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)+# Set listen addressserver.add_insecure_port(f"[::]:{port}")