npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nonstop-host

v1.0.2

Published

A self-updating service host

Downloads

21

Readme

nonstop-host

Nonstop-host is a bootstrapper/service host that self-updates when new packages that match its configured parameters become available in the nonstop-index.

Configuration

Nonstop can be used either as a library or as a command line interface.

As a command, you can configure it via a bootstrap.json file and environment variables. As a library, the same configuration means are available but you can also programmatically control how it is configured and when it starts.

Note: environment variables take precendent over settings in the file.

Bootstrap file

Defaults are shown here. The index property provides information necessary to contact the package index. The package property allows you to specify filtering information for the package. You shouldn't need to set the architecture or platform as those are detected for you. The service block lets you specify information for how to communicate with the service host's API as well as set failure tolerance for the hosted service. The logging block lets you control how standard out and file logging (via rollerpunk) get configured. By default info, warning and error levels for all nonstop-host log entries are logged to the console. timeouts are optional values you can change in order to determine how long nonstop will wait during a particular step before assuming something has gone very wrong so that it can re-initialize itself.

{
    "index": {
      "host": "localhost",
      "api": "/api",
      "frequency": 60000,
      "port": 4444,
      "ssl": false,
      "token": ""
    },
    "package": {
      "architecture": detected,
      "branch": "",
      "build": "",
      "owner": "",
      "platform": detected,
      "project": "",
      "releaseOnly": false,
      "version": "",
      "files": "./downloads"
    },
    "service": {
      "name": sysInfo.name,
      "host": {
        "ip": "",
        "name": ""
      },
      "port": {
        "local": 9090,
        "public": 9090
      },
      "tolerance": 5000,
      "failures": 1,
      "autoRollback": true
    },
    "logging": {
      "stdOut": {
        "level": 3,
        "bailIfDebug": true,
        "topic": "#"
      },
      "rollerpunk": {
        "level": 0,
        "logFolder": "/var/log",
        "fileName": "nonstop.log",
        "maxSize": 1024,
        "maxLogFiles": 10,
        "maxUnwritten": 100,
        "maxConsecutiveReboots": 10,
        "rebootInterval": 10,
        "topic": "#"
      }
    },
    "timeouts": {
      "initializing": 15000, // 15 seconds
      "downloading": 300000, // 5 minutes
      "installing": 60000, // 1 minute
      "loading": 5000, // 5 seconds
      "prebooting": 60000, // 1 minute
      "starting": 30000, // 30 seconds
      "waiting": 60000 // 1 minute
    }
}

Environment Variables

| Group | Variable | Default | |-------|-------------|---------| | Index | | | | | INDEX_HOST | "localhost" | | | INDEX_API | "api" | | | INDEX_FREQUENCY | 5000 | | | INDEX_PORT | 4444 | | | INDEX_SSL | false | | | INDEX_TOKEN | "" | | Package | | | | | PACKAGE_OWNER | | | | PACKAGE_PROJECT | | | | PACKAGE_BRANCH | | | | PACKAGE_BUILD | | | | PACKAGE_VERSION | | | | PACKAGE__RELEASE_ONLY | | | | PACKAGE_ARCHITECTURE | detected | | | PACKAGE_PLATFORM | detected | | | PACKAGE_FILES | "./downloads" | | service | | | | | SERVICE_NAME | "service name" | | | SERVICE_HOST_NAME | "service name" | | | SERVICE_HOST_IP | "unspecified | | | SERVICE_PORT_LOCAL | 9090 | | | SERVICE_PORT_PUBLIC | 9090 | | | SERVICE_FAILURES | 1 | | | SERVICE_TOLERANCE | 5000 | | | SERVICE__AUTO_ROLLBACK | true | | logging | | | "rollerpunk" | | ROLLERPUNK_LEVEL | 0 | | | ROLLERPUNK__LOG_FOLDER | "/var/log/myapp" | | | ROLLERPUNK__FILE_NAME | "whistlepunk.log" | | | ROLLERPUNK__MAX_SIZE | 1024 | | | ROLLERPUNK__MAX_LOG_FILES | 10 | | | ROLLERPUNK__MAX_UNWRITTEN | 100 | | | ROLLERPUNK__MAX_CONSECUTIVE_REBOOTS | 10 | | | ROLLERPUNK__REBOOT_INTERVAL | 10 | | | ROLLERPUNK__TOPIC | "#" | | timeouts | | | | | TIMEOUT_INITIALIZING | 15000 | | | TIMEOUT_DOWNLOADING | 300000 | | | TIMEOUT_INSTALLING | 60000 | | | TIMEOUT_LOADING | 5000 | | | TIMEOUT_PREBOOTING | 60000 | | | TIMEOUT_STARTING | 30000 | | | TIMEOUT_WAITING | 60000 |

Boot file - boot.yaml|boot.json

nonstop expects a boot file to be contained in any package it downloads which will provide the instructions for how it should start the packaged application. The files can be written in either JSON or YAML syntax.

The boot file consists of two sections: the service boot command and an optional pre-boot command set. The boot command simply tells nonstop how to start the packaged service while the optional pre-boot command set gets fed to drudgeon. Both the boot command and pre-boot commands are expressed using drudgeon's command syntax since it has a flexible means of supporting command and command set variation across platforms.

Note: these examples are super arbitrary and should not be used to infer how you would actually create steps for an actual thing.

JSON

{
  "boot": "node ./src/index.js",
  "preboot": {
    "one": {
      "win32": "gulp check-windows",
      "*": "gulp check"
    },
    "two": "node prep"
  }
}

YAML

boot: "node ./src/index.js",
preboot:
  one:
    win32: "gulp check-windows"
    *: "gulp check"
  two: "node prep"