Skip to content

Commit

Permalink
Add alternate health check route for website server (datacommonsorg#4749
Browse files Browse the repository at this point in the history
)

Routes ending with "z" are reserved by Cloud Run:
https://cloud.google.com/run/docs/known-issues#ah
  • Loading branch information
hqpho authored and gmechali committed Nov 21, 2024
1 parent a5294f0 commit 5d38539
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions server/routes/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def healthz():
return "very healthy"


# Alternate health check route in case /healthz is intercepted by infrastructure
# (e.g. when running as a Cloud Run service)
@bp.route('/health')
def health():
return "super healthy"


# TODO(beets): Move this to a separate handler so it won't be installed on all apps.
@bp.route('/mcf_playground')
def mcf_playground():
Expand Down
2 changes: 1 addition & 1 deletion shared/lib/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NLWebServerTestCase(unittest.TestCase):
def setUpClass(cls):
# If this check fail, you need to start up website and NL servers
# with ./run_servers.sh before running pytest.
libutil.check_backend_ready([f'{cls.get_class_server_url()}/healthz'])
libutil.check_backend_ready([f'{cls.get_class_server_url()}/health'])

@classmethod
def get_class_server_url(cls):
Expand Down

0 comments on commit 5d38539

Please sign in to comment.