Skip to content

Add /ready endpoint for comprehensive service readiness checking #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 10, 2025

This PR adds a new /ready endpoint that provides a simple way to determine when the Stellar Quickstart image is fully ready for use, addressing the issue where users need to write custom scripts to test readiness.

Changes

New /ready Endpoint

  • HTTP 200 when all services are ready for use
  • HTTP 503 when any service is not ready
  • JSON response with detailed service status

Example response when ready:

{
  "status": "ready",
  "services": {
    "stellar-core": "ready",
    "horizon": "ready",
    "horizon_health": {
      "database_connected": true,
      "core_up": true,
      "core_synced": true
    },
    "stellar-rpc": "ready"
  }
}

Implementation Details

  • Auto-detection: Automatically detects which services are actually running
  • Smart health checks: Uses appropriate health check methods for each service:
    • stellar-core: /info endpoint
    • horizon: Root endpoint + ingestion status + built-in /health
    • stellar-rpc: getHealth JSON-RPC method
  • Non-conflicting: Works alongside existing Horizon /health endpoint
  • Comprehensive: Only reports "ready" when ALL detected services are functioning

Architecture

  • Python-based service running on internal port 8004
  • nginx proxy routes /ready through main port 8000
  • supervisord management ensures service reliability
  • Integrated with start script for proper deployment

Documentation

  • Added comprehensive endpoint documentation with examples
  • Updated ports table to include readiness service
  • Explained difference between /health (Horizon-specific) and /ready (all services)

Testing

Verified working with test container running --local --enable core,horizon,rpc:

  • ✅ All three services detected and reported as ready
  • ✅ HTTP 200 status when ready
  • ✅ Proper JSON response format
  • ✅ Original /health endpoint continues to work
  • ✅ Test script passes

This eliminates the need for users to write custom scripts to test multiple service endpoints individually.

Fixes #683.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add general health endpoint Add /ready endpoint for comprehensive service readiness checking Jul 10, 2025
@Copilot Copilot AI requested a review from sagpatil July 10, 2025 17:33
Copilot finished work on behalf of sagpatil July 10, 2025 17:33
@leighmcculloch
Copy link
Member

Can the endpoint be /health?

@leighmcculloch
Copy link
Member

It's fine for the /health endpoint to sit over Horizon's health endpoint.

@sagpatil
Copy link
Contributor

@copilot can you rename the endpoint to /health

Copy link
Author

Copilot AI commented Jul 11, 2025

@copilot can you rename the endpoint to /health

Done! Renamed the endpoint from /ready to /health as requested. The changes include updating nginx configuration, Python service, documentation, and tests. Commit f4e78bb.

Copilot finished work on behalf of sagpatil July 11, 2025 18:39
@sagpatil sagpatil marked this pull request as ready for review July 11, 2025 19:04
@leighmcculloch
Copy link
Member

@sagpatil @fnando There was a discussion offline at https://stellarfoundation.slack.com/archives/C06KTGUULUF/p1752530679018619 where I shared the idea that we think about the root URL as the health endpoint. For the most part that's what it is for horizon historically, and as a user it's where I go when I want to see that the image is working. When Horizon is removed from being by default on, we should rethink the root path and what it serves, and a status / health like endpoint, like what horizon does today, could make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog (Not Ready)
Development

Successfully merging this pull request may close these issues.

Add general health endpoint
3 participants