rtchat icon indicating copy to clipboard operation
rtchat copied to clipboard

Add readiness & liveness status check handlers

Open charmitro opened this issue 1 year ago • 2 comments

This PR adds readiness and liveness status check handlers to the agent, which help ensure the health of the application in Kubernetes.

Changes Made:

  • Added /readiness endpoint to check if the service is ready.
  • Added /liveness endpoint to check if the service is running.
  • Kept the existing root endpoint handler. (not sure if this is OK)

It should work in Kubernetes like,

        readinessProbe:
          httpGet:
            path: /readiness
            port: 8080
          initialDelaySeconds: 5
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /liveness
            port: 8080
          initialDelaySeconds: 5
          periodSeconds: 10

Sadly I cannot test this because it needs some Google Cloud auth:

2024-07-29T23:01:12.775+0300    FATAL   cmd/main.go:92  failed to create firestore client       {"error": "google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}

charmitro avatar Jul 30 '24 10:07 charmitro

I believe CI fails because it's a fork of the repository?

charmitro avatar Jul 31 '24 18:07 charmitro

Thanks for the PR! The ticket could've been more specific but the additional endpoints aren't actually necessary. We also don't use Kubernetes to deploy, really we only need some configuration set up in the GCP console. That being said, since the agent code hasn't changed much in the last few years, the utility of doing so it not very high.

I appreciate the help though, if you're interested we'd be more than happy to work in any frontend improvements you can think of.

kevmo314 avatar Aug 04 '24 00:08 kevmo314