Skip to content

Enhancement: Improve /_mgmt/ping endpoint to check if pgstac is ready #229

Closed
@emmanuelmathot

Description

@emmanuelmathot

Description

Currently, the /_mgmt/ping endpoint in the STAC FastAPI pgstac implementation always returns a positive message ({"message": "PONG"}) without actually checking if all services are available, especially the PgSTAC database.

Problem

This creates a misleading health/readiness check, as the API might respond positively even when the underlying database connection is not functional. In production environments, this can lead to incorrect assumptions about service availability.

Proposed Solution

Enhance the /_mgmt/ping endpoint to perform an actual health check against the PostgreSQL database with PgSTAC before responding positively. The endpoint should:

  1. Attempt to establish a connection to the database
  2. Execute a simple query to verify PgSTAC tables/functions are accessible
  3. Return a success message only if both checks pass
  4. Return an appropriate error status code and message if any check fails

Benefits

  • More accurate health/readiness checks in containerized/cloud environments
  • Better integration with container orchestration systems like Kubernetes
  • Faster detection of database connectivity issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions