Skip to content

Conversation

zzstoatzz
Copy link
Collaborator

Closes #18997

Summary

This PR adds a simple healthcheck endpoint for background services to enable Docker health monitoring.

Changes

  • Add --with-healthcheck flag to prefect server services start command
  • Start HTTP server on port 8080 that responds with 200 OK to /health endpoint
  • Add minimal test coverage for healthcheck functionality

Implementation Notes

The implementation follows the minimal approach similar to the worker healthcheck pattern, providing a simple HTTP endpoint that returns 200 when services are running.

When the --with-healthcheck flag is provided:

  • An HTTP server starts on port 8080
  • The /health endpoint returns 200 OK with "OK" text body
  • Other paths return 404
  • Works in both foreground and background modes

This enables Docker containers running Prefect services to use standard Docker healthcheck configurations.

Testing

  • Added tests to verify healthcheck server starts when flag is provided
  • Added test to ensure no health server runs without the flag
  • All existing tests continue to pass

Closes #18997

This PR adds a simple healthcheck endpoint for background services to enable Docker health monitoring.

Changes:
- Add --with-healthcheck flag to 'prefect server services start' command
- Start HTTP server on port 8080 that responds with 200 OK to /health endpoint
- Add minimal test coverage for healthcheck functionality

The implementation follows the minimal approach similar to the worker healthcheck pattern, providing a simple HTTP endpoint that returns 200 when services are running.
@github-actions github-actions bot added the enhancement An improvement of an existing feature label Sep 22, 2025
Copy link

codspeed-hq bot commented Sep 22, 2025

CodSpeed Performance Report

Merging #19009 will not alter performance

Comparing simple-services-healthcheck (9b987b8) with main (bd1281a)

Summary

✅ 2 untouched

- Create proper healthcheck server module using FastAPI/uvicorn
- Follow exact pattern from worker healthcheck implementation
- Manager process now handles healthcheck in background mode
- Returns JSON response like worker healthcheck
- Tests updated to expect JSON response
Copy link
Contributor

github-actions bot commented Oct 6, 2025

This pull request is stale because it has been open 14 days with no activity. To keep this pull request open remove stale label or comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature status:stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Healthcheck for prefect server services
1 participant