[PR #243] [MERGED] infra: add healthcheck for pgvector in docker-compose #264

Closed
opened 2026-06-06 22:09:57 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/243
Author: @mason5052
Created: 4/8/2026
Status: Merged
Merged: 4/11/2026
Merged by: @asdek

Base: mainHead: infra/docker-compose-healthchecks


📝 Commits (1)

  • 223b832 infra: add healthcheck for pgvector in docker-compose

📊 Changes

1 file changed (+9 additions, -2 deletions)

View changed files

📝 docker-compose.yml (+9 -2)

📄 Description

Summary

  • Add pg_isready healthcheck to pgvector service in docker-compose.yml
  • Update pentagi depends_on from service_started to service_healthy
  • Update pgexporter depends_on to use service_healthy condition

Problem

The pentagi service depends on pgvector with condition: service_started, which only waits for the container to start -- not for PostgreSQL to be ready to accept connections. This can cause the application to fail on startup if the database needs time to initialize (e.g., first run with volume creation, or after a crash).

Solution

Add a pg_isready healthcheck to pgvector, matching the pattern already used in docker-compose-langfuse.yml for the Langfuse PostgreSQL service. Both pentagi and pgexporter now wait for service_healthy before starting.

healthcheck:
  test: ["CMD-SHELL", "pg_isready -U $${PENTAGI_POSTGRES_USER:-postgres}"]
  interval: 3s
  timeout: 3s
  retries: 10
  start_period: 5s

Image Compatibility Verification

The vxcontrol/pgvector:latest image is confirmed to be based on official PostgreSQL 16:

  • PG_MAJOR=16, PG_VERSION=16.3-1.pgdg120+1 (from image config env vars)
  • Entrypoint: docker-entrypoint.sh (standard official postgres entrypoint)
  • Cmd: postgres (standard postgres command)

pg_isready is included in all official PostgreSQL images as part of the postgresql-client package. This was verified by inspecting the image manifest and config blob from Docker Hub registry API.

Test Plan

  • YAML syntax validated (Python yaml.safe_load)
  • Healthcheck pattern matches docker-compose-langfuse.yml precedent
  • $$ escaping correct for Docker Compose variable substitution
  • vxcontrol/pgvector:latest image verified as official postgres:16-based (pg_isready available)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vxcontrol/pentagi/pull/243 **Author:** [@mason5052](https://github.com/mason5052) **Created:** 4/8/2026 **Status:** ✅ Merged **Merged:** 4/11/2026 **Merged by:** [@asdek](https://github.com/asdek) **Base:** `main` ← **Head:** `infra/docker-compose-healthchecks` --- ### 📝 Commits (1) - [`223b832`](https://github.com/vxcontrol/pentagi/commit/223b832840c43fafb2adebbe0d5e858eee46346c) infra: add healthcheck for pgvector in docker-compose ### 📊 Changes **1 file changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docker-compose.yml` (+9 -2) </details> ### 📄 Description ## Summary - Add `pg_isready` healthcheck to `pgvector` service in `docker-compose.yml` - Update `pentagi` depends_on from `service_started` to `service_healthy` - Update `pgexporter` depends_on to use `service_healthy` condition ## Problem The `pentagi` service depends on `pgvector` with `condition: service_started`, which only waits for the container to start -- not for PostgreSQL to be ready to accept connections. This can cause the application to fail on startup if the database needs time to initialize (e.g., first run with volume creation, or after a crash). ## Solution Add a `pg_isready` healthcheck to `pgvector`, matching the pattern already used in `docker-compose-langfuse.yml` for the Langfuse PostgreSQL service. Both `pentagi` and `pgexporter` now wait for `service_healthy` before starting. ```yaml healthcheck: test: ["CMD-SHELL", "pg_isready -U $${PENTAGI_POSTGRES_USER:-postgres}"] interval: 3s timeout: 3s retries: 10 start_period: 5s ``` ## Image Compatibility Verification The `vxcontrol/pgvector:latest` image is confirmed to be based on official PostgreSQL 16: - `PG_MAJOR=16`, `PG_VERSION=16.3-1.pgdg120+1` (from image config env vars) - `Entrypoint: docker-entrypoint.sh` (standard official postgres entrypoint) - `Cmd: postgres` (standard postgres command) `pg_isready` is included in all official PostgreSQL images as part of the `postgresql-client` package. This was verified by inspecting the image manifest and config blob from Docker Hub registry API. ## Test Plan - [x] YAML syntax validated (Python yaml.safe_load) - [x] Healthcheck pattern matches `docker-compose-langfuse.yml` precedent - [x] `$$` escaping correct for Docker Compose variable substitution - [x] `vxcontrol/pgvector:latest` image verified as official postgres:16-based (pg_isready available) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-06 22:09:57 -04:00
yindo closed this issue 2026-06-06 22:09:57 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#264