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

roost

v1.0.12

Published

System provisioning toolkit.

Downloads

43

Readme

 ____    _____   _____   ____    ______   
/\  _`\ /\  __`\/\  __`\/\  _`\ /\__  _\  
\ \ \L\ \ \ \/\ \ \ \/\ \ \,\L\_\/_/\ \/  
 \ \ ,  /\ \ \ \ \ \ \ \ \/_\__ \  \ \ \  
  \ \ \\ \\ \ \_\ \ \ \_\ \/\ \L\ \ \ \ \ 
   \ \_\ \_\ \_____\ \_____\ `\____\ \ \_\
    \/_/\/ /\/_____/\/_____/\/_____/  \/_/

Introduction

Roost is a simple provisioning system written on top of nodejs. It is like puppet and chef but heavily inspired by the clean and unobtrusive design of the nodejs module eco-system.

The Basics

Roost is configured through a simple configuration file, typically called roost.json, however other names can be used too. The file is used to describes how a system is provisioned, i.e what packages, services and other characteristics a system needs to adhere to.

When running roost without any command-line parameters it will try to look for the manifest file inside the current working directory. With the -r|--roost option you can specify any arbitrary file or directory to be used by roost. For example:

roost -r /path/to/folder # /path/to/folder/roost.json will be loaded
roost -r /path/to/file # /path/to/file will be loaded

Roost has the concept of targets. The default target is local:. You can use ssh: too. The target specifies what system will be provisioned. Here is an example:

roost # will provision the local system
roost 'ssh://username@host;privateKey=/path/to/private/key' # will provision a remote host over ssh

In case you are not sure what you are doing, you can also try dry-running by using the -d|--dry option. For example:

roost -d # will output information on what will happen if run the command for real

These are all options you need to know.

Basic roost.json File Structure

The following snippet describes the basic structure of the roost manifest file.

{
	"plugins": {
		"node-roost-nginx": true # true or false for loading extra plugins in the form of nodejs modules 
	},
	
	"packages": {
		"nodejs": "version|installed|purged" # excepted input is version, installed (for the latest version) or purged
	},
	
	"services": {
		"nginx": "running|stopped" # a service can be either running or stopped
	},
	
	"commands": {
		"command": true # a command will execute if true or not execute if false
	}
}

Apt can be configured with the following directive, although this is not standard at the moment:

{
	"apt": {
		"update": true # true or false for auto updating the system before installing extra packages
	}
}

Due to the nature of JSON documents you can use a mix of the values provided above although it is generally perceived as a bad thing so it should be avoid.

Order Of Execution

Roost does not expose means by which you can configure the order of execution of things. The order is already chosen for you in advance, which is:

  • plugins
  • packages
  • services
  • commands

This order is not finalised but this is what it is at the moment. The order of execution is pre-selected to avoid confusion and to provide some level of consistency. Based on the feedback that we get from the community we will tune this order or even expose means by which you can do dependency relationship management.

The Plugin System

The plugin system of roost is essentially the nodejs module system. You can load plugins by declaring them inside the roost manifest file as illustrated previously. The plugin must to be either installed globally via npm or locally inside the node_modules folder structure.

Each plugin must export a function called roost. The function expects two parameters: the manifest file and the target. Once the function is invoked the plugin will be able to traverse the manifest file for declarations it recognizes and execute actions via the target. A plugin may even augment the manifest structure if desired, i.e. a plugin my install more packages by simply extending the "packages" directive.

Two functions exist in the target that are useful to plugin developers: "exec" and "spawn". Use "exec" to launch any shell command. Use "spawn" to launch an executable with a fine-grain control over the process.

For examples and inspiration check out the project source code.

Embedding Into Other Projects

Roost can be easily embedded into other projects. Checkout bin/roost for inspiration. Just copy and paste the parts that you need. The whole project has been designed to be easily embedable so that it can leave as part of larger and more complex systems.

Project Status and Future Plans

The project is new and immature in many ways. We hope to change that in the upcoming months. At the moment only ubuntu/debian is supported so please fork it as much as you want and send us patches. We are keen to make something out of this.

Roost, although open source, is commercially backed by Websecurify. We are just starting to use it internally to manage our infrastructure. We are committed to support it in the foreseeable future so you can be assured that it is actually used to satisfy real needs.

How To Contribute

Fork the project. Improve it. Send us the patches. Write some plugins and spread the news. We are happy to help with any technical queries you may have.

We want to support the community to create all kinds of ready-made systems. Share your roost files for the world to see. Get in touch if you want them to be included as part of the default distribution.

Roost Plugins You Can Use

  • node-roost-nginx - install and configure nginx
  • node-roost-nodejs - install and configure nodejs
  • node-roost-mongo - install and configure mongo

The easiest way to install these plugins is to create a package.json file and declare the modules just as you usually do. Execute npm install inside the same folder than use roost to load the plugins that you need. It is as simple as that.