Skip to content

Commit

Permalink
Simple healthcheck
Browse files Browse the repository at this point in the history
Useful for Kubernetes readinessProbe and livenessProbe
  • Loading branch information
kentbull committed Aug 31, 2023
1 parent 5bf91c0 commit 249522a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from keri.db import dbing
from keri.db.basing import OobiRecord
from keria.end import ending
from keri.help import helping, ogler
from keri.help import helping, ogler, nowIso8601
from keri.peer import exchanging
from keri.vc import protocoling
from keri.vdr import verifying
Expand Down Expand Up @@ -58,6 +58,7 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No
bootServerDoer = http.ServerDoer(server=bootServer)
bootEnd = BootEnd(agency)
bootApp.add_route("/boot", bootEnd)
bootApp.add_route("/health", HealthEnd())

# Create Authenticater for verifying signatures on all requests
authn = Authenticater(agency=agency)
Expand Down Expand Up @@ -674,6 +675,14 @@ def on_post(self, req, rep):
rep.status = falcon.HTTP_202


class HealthEnd:
"""Health resource for determining that a container is live"""

def on_get(self, req, resp):
resp.status = falcon.HTTP_OK
resp.media = {"message": f"Health is okay. Time is {nowIso8601()}"}


class KeyStateCollectionEnd:

@staticmethod
Expand Down

0 comments on commit 249522a

Please sign in to comment.