@3-s-it/healthcheck 中文文档教程

发布于 3年前 浏览 25 更新于 3年前

healthcheck

Description

这个 npm 模块包含各种健康检查,以便从数据库、文件系统或上游服务等不同来源检索状态。

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

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
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文