Skip to content
A connect middleware for the cloud-health module, providing liveness and readiness endpoints for Kubernetes
Branch: master
Clone or download
George Adams
George Adams 1.0.2
Latest commit 76b1aae Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
src/connect-cloud-health Initial commit Jul 20, 2018
test/connect-cloud-health
.gitignore
.travis.yml Bump cloud-health version to 1.0.1 Dec 3, 2018
LICENSE
README.md
index.d.ts Initial commit Jul 20, 2018
index.js Initial commit Jul 20, 2018
index.js.map
index.ts
package.json
tsconfig.json Initial commit Jul 20, 2018
tslint.json

README.md

Cloud Health Connect

Build status Coverage Status Module LTS Adopted IBM Support

Cloud Health Connect provides a Connect Middleware for use in Express.js, Loopback and other frameworks that uses Cloud Health to provide:

  • Readiness checks
  • Liveness checks
  • Shutdown handling

to enable applications for use with Kubernetes and Cloud Foundry based clouds.

Using Cloud Health Connect

Cloud Health Connect takes the status reported by Cloud Health and makes it available on the liveness and/or readiness URL endpoints that the middleware is configured to use.

The middleware writes the data returned by the Cloud Health module as JSON, and sets the HTTP Status Code as follows:

Cloud Health Status Readiness Status Code Liveness Status Code
STARTING 503 UNAVAILABLE 200 OK
UP 200 OK 200 OK
DOWN 503 UNAVAILABLE 503 UNAVAILABLE
STOPPING 503 UNAVAILABLE 503 UNAVAILABLE
STOPPED 503 UNAVAILABLE 503 UNAVAILABLE
- 500 SERVER ERROR 500 SERVER ERROR

Using Cloud Health with Node.js

  1. Installation:
npm install @cloudnative/health-connect
  1. Set up a HealthChecker:
const health = require('@cloudnative/health-connect');
let healthcheck = new health.HealthChecker();
  1. Register a Liveness endpoint:
app.use('/health', health.LivenessEndpoint(healthcheck))

If no livessness checks are registered, this will report 200 OK and UP.

  1. Register a readiness endpoint:
app.use('/ready', health.ReadinessEndpoint(healthcheck))

If no readiness checks are registered, this will report 200 OK and UP.

For information on how to register startup, liveness and shutdown checks, see the Cloud Health documentation.

Using Cloud Health Connect with Typescript

The Cloud Health Connect module is created in TypeScript and as such provides out of the box TypeScript support.

Module Long Term Support Policy

This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:

Module Version Release Date Minimum EOL EOL With Status
1.x.x July 2018 Dec 2019 Current

License

Apache-2.0

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.