1.0.0 • Published 5 years ago

egg-healthy v1.0.0

Weekly downloads
250
License
MIT
Repository
github
Last release
5 years ago

egg-healthy

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

Liveness and Readiness health check for egg application

Health Status CodeReadiness Status CodeLiveness Status CodeDescription
STARTING503 UNAVAILABLE200 OK
UP200 OK200 OK
DOWN503 UNAVAILABLE503 UNAVAILABLE
STOPPING503 UNAVAILABLE503 UNAVAILABLE

Install

$ npm i egg-healthy --save

Usage

Configuration

Configure plugin.js

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

Configure config.js

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

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.

livenessProbe:
  httpGet:
    path: /healthy/liveness
    port: 7001
  initialDelaySeconds: 3
  periodSeconds: 3
readinessProbe:
  httpGet:
    path: /healthy/readiness
    port: 7001
  initialDelaySeconds: 3
  periodSeconds: 3

Questions & Suggestions

Please open an issue here.

License

MIT