项目作者: eggjs

项目描述 :
Liveness and Readiness health check for egg application
高级语言: JavaScript
项目地址: git://github.com/eggjs/egg-healthy.git
创建时间: 2018-11-08T14:18:29Z
项目社区:https://github.com/eggjs/egg-healthy

开源协议:MIT License

下载


egg-healthy

NPM version
build status
Test coverage
David deps
Known Vulnerabilities
npm download

Liveness and Readiness health check for egg application

Health Status Code Readiness Status Code Liveness Status Code Description
STARTING 503 UNAVAILABLE 200 OK
UP 200 OK 200 OK
DOWN 503 UNAVAILABLE 503 UNAVAILABLE
STOPPING 503 UNAVAILABLE 503 UNAVAILABLE

Install

  1. $ npm i egg-healthy --save

Usage

Configuration

Configure plugin.js

  1. // {app_root}/config/plugin.js
  2. exports.healthy = {
  3. enable: true,
  4. package: 'egg-healthy',
  5. };

Configure config.js

  1. // {app_root}/config/config.default.js
  2. exports.healthy = {
  3. readinessPath: 'custom path for readiness check',
  4. livenessPath: 'custom path for liveness check',
  5. };

see config/config.default.js for more detail.

Run with Kubernetes

You can run egg in kubernetes well with this plugin, you can set Liveness and Readiness Probes when create pod.

  1. livenessProbe:
  2. httpGet:
  3. path: /healthy/liveness
  4. port: 7001
  5. initialDelaySeconds: 3
  6. periodSeconds: 3
  7. readinessProbe:
  8. httpGet:
  9. path: /healthy/readiness
  10. port: 7001
  11. initialDelaySeconds: 3
  12. periodSeconds: 3

Questions & Suggestions

Please open an issue here.

License

MIT