Skip to content

onebeyond/systemic-service-runner

Repository files navigation

NPM version NPM downloads Node.js CI Maintainability Test Coverage Code Style systemic-service-runner Discover zUnit

Systemic Service Runner

Starts systemic systems

TL;DR

const Systemic = require('systemic');
const runner = require('systemic-service-runner');

const system = new Systemic().add('config', { foo: 1, bar: 2 }).add('app', require('./my-app')).dependsOn('config');

runner(system).start((err, components) => {
  if (err) throw err;
  console.log('Started');
});

Features

  • Attempts to shutdown gracefully on error, unhandled rejection, SIGINT and SIGTERM events
  • Attempts a graceful restart when process emits a systemic_restart event

Usage

runner(<system>, [<options>]).start(<cb>)

Default options

{
    logger: console,
    restart: {
        window: '60s'
    }
}