[HUMAN App] Healthcheck endpoints #2696
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adding
healthcheck
functionality to Human App ServerSummary of changes
Added new
health
endpoints:ping
andcheck
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 toolscheck
- 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 failWith 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
export GIT_HASH=$(git rev-parse HEAD) && yarn start
To test
/health/check
ok
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:or put it somehow via env variables config if possible
Related issues
Closes #2646