From 28ec5b58719624d552f438a1cfa23e534cd05493 Mon Sep 17 00:00:00 2001 From: Pavlo Paliychuk Date: Tue, 1 Oct 2024 10:25:27 -0400 Subject: [PATCH] feat: add health checks and dependencies to docker-compose (#163) * chore: Add healthcheck for neo4j and graph service in docker compose * chore: Fix healthcheck url --- docker-compose.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 04889e33..e2ee91c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,20 @@ services: image: zepai/graphiti:latest ports: - "8000:8000" - + healthcheck: + test: + [ + "CMD", + "python", + "-c", + "import urllib.request; urllib.request.urlopen('http://localhost:8000/healthcheck')", + ] + interval: 10s + timeout: 5s + retries: 3 + depends_on: + neo4j: + condition: service_healthy environment: - OPENAI_API_KEY=${OPENAI_API_KEY} - NEO4J_URI=bolt://neo4j:${NEO4J_PORT} @@ -14,7 +27,12 @@ services: - PORT=8000 neo4j: image: neo4j:5.22.0 - + healthcheck: + test: wget "http://localhost:${NEO4J_PORT}" || exit 1 + interval: 1s + timeout: 10s + retries: 20 + start_period: 3s ports: - "7474:7474" # HTTP - "${NEO4J_PORT}:${NEO4J_PORT}" # Bolt