Skip to content

wise-team/node-docker-watchdog

Repository files navigation

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);
}

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published