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

tinycloud

v1.1.3

Published

minimal module for launching and managing a compute cluster

Downloads

18

Readme

tinycloud

Minimal module for launching compute clusters with node.js. Lets you spin up a cluster on Amazon EC2, monitor its status, and login to its nodes. Use and extend as a module, or use as a CLI with the help of clicloud.

There are already a couple great modules for cloud deployments, like kirby and pkgcloud, but they are either very specific (targeting single nodes) or very broad (supporting compute, storage, etc.). tinycloud is just enough to make and play with a cluster!

NOTE: This module launches clusters, which can cost real money. It is also still under development. Carefully monitor your AWS usage!

BONUS: tinycloud is a cat from the Warriors series

install

Install as a command-line tool

npm install tinycloud -g

Or as a module in your project

npm install tinycloud --save

use as a cli

You can use as a CLI to launch and monitor your cluster. First make sure to set the environmental variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. To create a cluster you just need to give it a name (we'll call it voltron) and the name of key pair (we'll call it mykey)

tinycloud launch voltron -k mykey

To make a bigger cluster, just add more workers

tinycloud launch voltron -k mykey -n 5

Once launched, you can list all instances

tinycloud list voltron

And login to your nodes with the help of ssh2 by providing a identity key file

tinycloud login voltron -i mykey.pem

By default you'll log into the master. You can also specify a group and/or instance number

tinycloud login voltron master -i mykey.pem
tinycloud login voltron worker 4 -i mykey.pem

Shut down your cluster with

tinycloud destroy voltron

If you want to test the launch process without creating instances use a dry run

tinycloud launch -d

See all options with

tinycloud --help

use as a module

Example launching a cluster with 1 master and 1 worker

var tinycloud = require('tiny-cloud')

var options = {
  dry: false, // do a dry run
  image: 'ami-d05e75b8', // amazon image
  type: 'm3.medium', // machine instance type
  cluster: 'voltron', // name of cluster
  ports: [22, 80], // ports to open
  key: 'mykey' // name of
}

var groups = [
  {tag: 'master', count: 1},
  {tag: 'worker', count: 1}
]

var cloud = new tinycloud(options, groups)

cloud.launch( function(err, data) {
  if (err) console.log(err)
  if (data) console.log(data)
})

API

cloud = tinycloud(options, groups)

Create a new cloud

options

  • dry do a dry run
  • image amazon image
  • type machine instance type
  • cluster name of cluster
  • ports ports to open
  • key name of key file

groups

each corresponds to one or more tagged collections of instances

[
  {tag: 'master', count: 1},
  {tag: 'scheduler', count: 1},
  {tag: 'worker', count: 10}
]

cloud.launch([cb])

Launch a cluster.

cb if provided will be called with cb(error, data). If succesful, data will be a list of instance reservations (one per requested group).

cloud.destroy([cb])

Terminate a cluster.

cb if provided will be called with cb(error, data). If successful, data will be a list of terminated instances.

cloud.list([tag], cb)

List instances associated with a cluster.

tag restricts the list to only those instances belonging to the group with that tag, e.g. master or worker. Default is to list all instances.

cb if provided will be called with cb(error, data). If successful, data will be a list of instances.

cloud.login([tag], [ind], keyfile, [cb])

Login to a single instance associated with a cluster.

tag specifies instances belonging to the specified group. If not provided, will use the first group.

ind specifies indth instance belonging to the specified group. If not provided, will use the first instance.

keyfile required for authentication.

cb if provided will be called with cb(error).

cloud.execute([tag], [ind], keyfile, cmd, [cb])

Execute a command on one or more instances assocaited with a cluster.

tag specifies instances belonging to the specified group. If not provided, will use all groups.

ind specifies the indth instance belonging to the specified group. If not provided, will use all instances.

keyfile required for authentication.

cmd is the string to execute on the instances.

cb if provided will be called with cb(error).