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!
npm install --save @vgrid/areyouready
;; // 9999 is default if none supplied// Do your application logic// .....ayr.signalReadytrue; // Signal that the app is readyayr.signalLivetrue; // Signal that the app is now live// Some while later// .....ayr.signalLivefalse; // Signal that the app is NOT liveayr.signalReadyfalse; // Signal that the app is NOT ready
Set up your cluster / load-balancers to check the following URLs:
Only two methods exist,
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'
Any contributions are more than welcome!