Skip to content
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

Dashboard Card for CodeGate Server Health #417

Closed
lukehinds opened this issue Dec 19, 2024 · 2 comments
Closed

Dashboard Card for CodeGate Server Health #417

lukehinds opened this issue Dec 19, 2024 · 2 comments

Comments

@lukehinds
Copy link
Contributor

lukehinds commented Dec 19, 2024

Dashboard Card for CodeGate Server Health

Summary
Create a new Dashboard card to display the health status of the CodeGate server by querying the /api/health endpoint
This feature should could validate that the server’s CA certificate chains back correctly for additional security assurance, to help users needing a cert (aka CoPilot)

server.py#L101


Background & Motivation

  • Developers need a quick, at-a-glance indicator of whether CodeGate server is operational.
  • Currently, there’s no immediate visual feedback within the dashboard to confirm successful server connectivity or certificate validity.
  • By adding a dedicated health status card, we improve the user experience and reduce troubleshooting time if the server is down or certificates are misconfigured.

NOTE: As always, start small, simple and validate, the following acts as a guideline of where this could lead.


Requirements

  1. Health Endpoint Check
    • The dashboard should automatically send a request to the /api/health endpoint at set intervals (e.g., every 30 seconds or on page load).
    • The result should clearly indicate “Healthy” or “Unhealthy” status.
  2. Certificate Validation
    • When requesting the /api/health endpoint, the client should validate the server’s certificate chain.
    • The dashboard should display a warning if the CA chain is invalid or not trusted.
  3. UI/UX
    • Introduce a “Health Status” card on the main dashboard screen (or in the sidebar if that’s more appropriate).
    • The card could show:
      • Status: “Healthy” (green) or “Unhealthy” (red).
      • Last Check: Timestamp of the most recent successful/failed check.
      • Certificate Validation: Indicate whether the cert chain is valid (“Valid CA Chain”) or invalid (“Untrusted CA”).
    • If Unhealthy, optionally provide a link to troubleshooting docs or logs.
  4. Configuration & Extensibility
    • Expose a configuration option for the refresh interval in a settings panel if needed.
    • The certificate chain validation step should be pluggable to support future enhancements (e.g., custom CAs or more detailed SSL checks).
  5. Error Handling & Logging
    • If the server is unreachable or certificate validation fails, log an event in CodeGate’s logging system.
    • Provide a clear user-facing error message in the dashboard card.

Implementation Ideas

  • Endpoint:
    • Use the existing /api/health endpoint which returns a JSON object with a status (e.g., { "status": "ok" }).
  • Certificate Chain Validation:
    • Utilize a standard library function in the front-end (if available) or a proxy in the backend that verifies the server certificate.
    • Alternatively, rely on the browser’s native certificate validation for HTTPS requests, capturing errors in JavaScript for display.
  • UI:
    • Use a simple card component that fetches data on a set interval or on component mount.
    • Switch the card’s style based on the success/failure of the check.

Acceptance Criteria

  1. The dashboard displays a new card labeled “CodeGate Server Health” or equivalent.
  2. On page load, the card queries /api/health and shows one of the following states:
    • Healthy: If the endpoint returns a successful response and certificate validation passes.
    • Unhealthy: If the endpoint returns an error or certificate validation fails.
  3. The card shows a timestamp of the most recent health check.
  4. If an Unhealthy state is detected, the user is provided with a warning or brief troubleshooting steps.
  5. Logs are recorded for both successful and failed checks.

Additional Notes / Suggestions

  • Consider caching responses and only refreshing the UI at configurable intervals to avoid unnecessary API calls.
  • Extra credits for providing a quick link to logs or server status pages for deeper diagnostics.
@lukehinds lukehinds changed the title UI Health Check Dashboard Card for CodeGate Server Health Jan 11, 2025
@lukehinds
Copy link
Contributor Author

@jtenniswood good first candidate for your pipeline

@alex-mcgovern
Copy link
Contributor

The initial work for this was completed in stacklok/codegate-ui#62.

This just added a polling check for the health-check endpoint.

Validating the server's CA certificate isn't started yet. I'm still unclear on the best approach here, have tried a few hacky workarounds, but so far, no joy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants