Skip to content


Subversion checkout URL

You can clone with
Download ZIP
zero downtime deployment for your node.js server using native cluster api
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



 * zero downtime code hot-swapping
 * ability to change environment variables of workers with zero downtime
 * resuscitation - when a worker dies it is restarted
 * redirect worker stdout and stderr to rotating log files
 * runs as daemon, providing ability to start and stop


    To use naught, your node.js server has 2 requirements.
    1. Once the server is fully booted and is readily accepting connections,


       Usually this is done in the `listening` event for a node server, for

           server = http.createServer(...);
           server.listen(80, function () {

    2. Listen to the `shutdown` message and shutdown gracefully. This message
       is emitted after there is already a newer instance of your server
       online and taking care of business:

           process.on('message', function(message) {
               if (message === 'shutdown') {

       If your server has no long-lived connections, you may skip this step.
       However, note that most node.js apps do have long lived connections.
       In fact, by default, the connection: keep-alive header is sent with
       every request.

       When you receive the `shutdown` message, either close all open
       connections or call `process.exit()`.


    naught start [options] server.js [script-options]

        Starts server.js as a daemon passing script-options as command
        line arguments.

        Available options and their defaults:

        --worker-count 1
        --pidfile naught.json
        --log naught.log
        --stdout stdout.log
        --stderr stderr.log
        --max-log-size 10485760
        --cwd (the current working directory)
        --tmp (the temp dir appropriate for your OS)

    naught stop [options] [pidfile]

        Stops the running server which created the pidfile.
        Uses `naught.json` by default.

        This sends the 'shutdown' message to all the workers and waits for
        them to exit gracefully.

        If you specify a timeout, naught will wait for the seconds to pass,
        and then send a SIGTERM to kill your server. Naught will then wait
        for timeout again, finally sending a SIGKILL to your server if it
        has not exited on its own.

        Available options and their defaults:

            --timeout none

    naught status [pidfile]

        Displays whether a server is running or not.
        Uses `naught.json` by default.

    naught deploy [options] [pidfile]

        Replaces workers with new workers using new code and optionally
        the environment variables from this command.

        Naught spawns all the new workers and waits for them to all become
        online before killing a single old worker. This guarantees zero
        downtime if any of the new workers fail and provides the ability to
        cleanly abort the deployment if it hangs.

        Uses `naught.json` by default.

        Available options and their defaults:

            --replace-env true

    naught deploy-abort [pidfile]

        Aborts a hanging deploy. A hanging deploy happens when a new worker
        fails to emit the 'online' message, or when an old worker fails
        to shutdown upon receiving the 'shutdown' message.

        Uses `naught.json` by default.

    naught help [cmd]

        Displays help for cmd


    $ sudo npm install -g naught


    $ npm run dev
Something went wrong with that request. Please try again.