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

[HUMAN App] Healthcheck endpoints #2696

Merged
merged 3 commits into from
Oct 25, 2024
Merged

[HUMAN App] Healthcheck endpoints #2696

merged 3 commits into from
Oct 25, 2024

Conversation

dnechay
Copy link

@dnechay dnechay commented Oct 24, 2024

Description

Adding healthcheck functionality to Human App Server

Summary of changes

Added new health endpoints: ping and check with different purpose:

  • ping is useful when you want to check that the server is up, running and can be reached via HTTP; it supplies some information about version as well, so you can easily understand what's is deployed w/o having access to CI/infra tools
  • check - the main endpoint that provides information about operability and health of dependencies.

Before this PR, application crashed in case of connection errors to Redis and wasn't able to recover until Redis is green. In order to avoid that we have to add error handling to underlying client of cache-manager-redis-store instance with some basic configuration:

  • disableOfflineQueue: true is necessary to not make incoming requests "wait" if they rely on Redis and just fail
  • throttle error log because otherwise it floods with new message every 500ms
    With this change application will keep serving routes that do not rely on Redis (e.g. profile, sign-in, etc.), which is believed to be better than full outage.

Also removed some unused packages.

How test the changes

To test /health/ping

  1. export GIT_HASH=$(git rev-parse HEAD) && yarn start
  2. Call the endpoint and check the body

To test /health/check

  • run the app with redis server running; call the endpoint and check the result, should be ok
  • stop the redis server while app is running; call the endpoint and check the results, should be error

Release notes

In order to enable commit hash for non-local envs we will need to include it to "start" command to include GIT_SHA from RENDER_GIT_COMMIT env variable:

GIT_HASH=$RENDER_GIT_COMMIT yarn start:prod

or put it somehow via env variables config if possible

Related issues

Closes #2646

Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 9:13am
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 9:13am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 9:13am
faucet-server ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 9:13am

@dnechay dnechay self-assigned this Oct 24, 2024
@dnechay dnechay merged commit ccb06ae into develop Oct 25, 2024
12 checks passed
@dnechay dnechay deleted the dnechay/2646 branch October 25, 2024 11:01
@dnechay dnechay linked an issue Oct 25, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Human App][Server] Implement a /healthcheck endpoint
3 participants