Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cloudnative/health-connect

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudnative/health-connect

Connect middleware for Cloud Health

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Cloud Health Connect

npm Build status Coverage Status Greenkeeper 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
  • Combined Health (Readiness and 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 StatusReadiness Status CodeLiveness Status CodeCombined Health Status Code
STARTING503 UNAVAILABLE200 OK503 UNAVAILABLE
UP200 OK200 OK200 OK
DOWN503 UNAVAILABLE503 UNAVAILABLE503 UNAVAILABLE
STOPPING503 UNAVAILABLE503 UNAVAILABLE503 UNAVAILABLE
STOPPED503 UNAVAILABLE503 UNAVAILABLE503 UNAVAILABLE
-500 SERVER ERROR500 SERVER ERROR500 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 separate Liveness endpoint:
app.use('/live', health.LivenessEndpoint(healthcheck))

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

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

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

  1. Register a combined health endpoint:
app.use('/health', health.HealthEndpoint(healthcheck))

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

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

Health, Liveness and Readiness endpoints

The difference between liveness and readiness endpoints is the purpose: readiness should be used to denote whether an application is "ready" to receive requests, and liveness should be used to denote whether an application is "live" (vs. in a state where it should be restarted.

The combined health endpoint is designed for cloud technologies, such as Cloud Foundry which only support a single endpoint for both liveness and readiness checking.

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 VersionRelease DateMinimum EOLEOL WithStatus
2.x.xMay 2019April 2021Current
1.x.xJuly 2018Dec 2019LTS

License

Apache-2.0

Keywords

FAQs

Package last updated on 25 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc