node-docker-watchdog
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

node-docker-watchdog

Simple watchdog. For node&docker friendship forever. No more stalled loop.

Healthcheck script

const watchdog = require("node-docker-watchdog");
 
watchdog.CliWatchdogHealthcheck({
    project: "wise-hub",
    environment: "production",
});

Watchdog in looping server:

import { DockerWatchdogServer, TimeWatchdogStrategy } from "node-docker-watchdog";
 
const timeWatchdogA = new TimeWatchdogStrategy().setIdentitier("timeWatchdogA");
const timeWatchdogB = new TimeWatchdogStrategy().setIdentitier("timeWatchdogB");
const watchdogServer = new DockerWatchdogServer([timeWatchdogA, timeWatchdogB]);
 
(async () => {
    await watchdogServer.listen();
 
    recurrentLoopFn();
})();
 
function recurrentLoopFn() {
    console.log("beat 20000ms");
    timeWatchdogA.beat(14000);
    timeWatchdogB.beat(8000);
    setTimeout(() => recurrentLoopFn(), 20000);
}

Readme

Keywords

Package Sidebar

Install

npm i node-docker-watchdog

Homepage

wise.vote/

Weekly Downloads

7

Version

1.2.3

License

MIT

Unpacked Size

52.8 kB

Total Files

48

Last publish

Collaborators

  • jblew