@3-s-it/healthcheck

get health status from various sources like dbs, filesystems or upstream services

Usage no npm install needed!

<script type="module">
  import 3SItHealthcheck from 'https://cdn.skypack.dev/@3-s-it/healthcheck';
</script>

README

healthcheck

Description

This npm module contains various healthchecks in order to retrieve the status from different sources like dbs, filesystems or upstream services.

elasticsearch

  • read+write check by incrementing a counter within a document, if index or document does not exist yet it is created on first run

mongodb

  • read+write check by creating a new document with a random testvalue in a capped collection of max 1 document on each run

postgres

  • read+write check by incrementing a counter stored within a sequence, if sequence does not exist yet it is created on first run

redis

  • read+write check by incrementing a counter associated with a specific key, if key does not exist yet it is created on first run

success

  • dummy check for testing purposes which does not perform any tests and always returns true

upstream

  • performs a GET request to /alive endpoint and resolves check successfully if a http status code of 200 OK is returned

filesystem

  • read+write check by creating and removing a file in a temporary directory

Development

Before starting development

  • Install npm packages: make npm or npm install
  • Build service dependencies (docker images): make build-dev-images
  • Start service dependencies (docker container): make dev-inf-up
  • Watch for file changes: npm run watch
    • alternatively press ⇧⌘B to execute default task runner in vscode

During development

  • Run test suite: npm run test
  • Commit your changes into a separare feature branch using semantic commit messages
  • Regulary push your changes to remote origin

After finishing development

  • Stop service dependencies: make dev-inf-down
  • Push your changes to remote origin
  • Create a pull request from feature branch to branch Development via the Webinterface of git server
    • Add a reviwer to the pull request
  • Check CI/CD Pipeline result

Publishing

  • Sign in to registry with npm adduser --registry=<registry> --always-auth
  • Update version number in package.json file
  • Make sure to update .npmignore file
  • Run npm publish --registry=<registry> to push latest version to private registry
  • Signin to the registry and verify result