From 223b832840c43fafb2adebbe0d5e858eee46346c Mon Sep 17 00:00:00 2001 From: mason5052 Date: Wed, 8 Apr 2026 09:47:20 -0400 Subject: [PATCH] infra: add healthcheck for pgvector in docker-compose Add pg_isready healthcheck to pgvector service and update pentagi and pgexporter depends_on to use service_healthy condition. This prevents the application from starting before PostgreSQL is ready to accept connections, matching the pattern used in docker-compose-langfuse.yml. --- docker-compose.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2b6adb7..6a78a7e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: - ${PENTAGI_LISTEN_IP:-127.0.0.1}:${PENTAGI_LISTEN_PORT:-8443}:8443 depends_on: pgvector: - condition: service_started + condition: service_healthy environment: - DEBUG=${DEBUG:-false} - DOCKER_GID=998 @@ -200,6 +200,12 @@ services: options: max-size: 50m max-file: "7" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${PENTAGI_POSTGRES_USER:-postgres}"] + interval: 3s + timeout: 3s + retries: 10 + start_period: 5s volumes: - pentagi-postgres-data:/var/lib/postgresql/data networks: @@ -209,7 +215,8 @@ services: image: quay.io/prometheuscommunity/postgres-exporter:v0.16.0 restart: unless-stopped depends_on: - - pgvector + pgvector: + condition: service_healthy container_name: pgexporter hostname: pgexporter expose: