Socket
Socket
Sign inDemoInstall

@vgrid/areyouready

Package Overview
Dependencies
0
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vgrid/areyouready

Are You Ready module - used to signal readiness/liveliness to clusters (such as Kubernetes) via a simple HTTP server


Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Install size
40.2 kB
Created
Weekly downloads
 

Readme

Source

vGrid's AreYouReady Module

This is a very simple module to include in your node projects to provide HTTP Readiness/Liveness checks to clusters (such as Kubernetes) or load-balancers (nginx/haproxy/etc)

We found other great projects that provided similar functionality, but way too much bloat for our use case - so we wrote this!

Install

npm install --save @vgrid/areyouready

Usage

import AreYouReady from '@vgrid/areyouready';
const ayr = new AreYouReady({ port: 9999 }); // 9999 is default if none supplied

// Do your application logic
// .....

ayr.signalReady(true); // Signal that the app is ready
ayr.signalLive(true); // Signal that the app is now live

// Some while later
// .....
ayr.signalLive(false); // Signal that the app is NOT live
ayr.signalReady(false); // Signal that the app is NOT ready

Set up your cluster / load-balancers to check the following URLs:

http://service:9999/live and http://service:9999/ready

API

Only two methods exist, signalLive and signalReady which independently toggle the ready and live states:

signalLive (state: boolean): void;
signalReady (state: boolean): void;

The app will respond with one of the following response codes:

  • live/ready: 200 - 'OK'
  • not live / not ready: 500 - 'NOT_LIVE' / 'NOT_READY'
  • other url: 404 - 'UNKNOWN'

Contributing

Any contributions are more than welcome!

Keywords

FAQs

Last updated on 24 Jun 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc