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 🙏

© 2025 – Pkg Stats / Ryan Hefner

do-cluster-deploy

v0.1.0

Published

Deploy to multiple DigitalOcean servers and load-balance between them

Readme

DigitalOcean cluster deploy

This node.js script allows you upload an application to multiple DigitalOcean droplets and then load-balance between them using nginx. This way your application can handle more requests at the same time.

Requirements

You need to have SSH keys added to your DigitalOcean accounts. You only have to change the do_token, ssh_keys, key fields to make the demo work!

Notice

This script will cause charges to your DigitalOcean account. If you spin up 100 droplets using this script, it's your fault!

Installation

npm install do-cluster-deploy

Usage

All fields are required. Load-balancing has to work using nginx, otherwise you are free to use any technology you'd like.

	var clusterDeploy = require('do-cluster-deploy');
	var fs = require('fs');

	clusterDeploy.deploy({
		// Your droplets will be named test-1, test-2 and so on.
		prefix: 'test',
		// If you use a region with private networking, it will be faster
		region: 'fra1',
		// Digital Ocean API token, obtain from your settings
		do_token: '9801xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
		// $5 instances are just fine for this demo
		size: '512mb',
		// If you enable this, you will benefit from faster speed. Not all regions might support this.
		private_networking: true,
		// SSH keys so you don't need a password. You need to enter those into your DO account first.
		ssh_keys: ['3b:03:7d:abxxxxxxxxxxxxxxxxxxx'],
		// Any OS goes!
		image: 'ubuntu-14-04-x64',
		// test-1 and test-2 droplets will be created *if they don't exist yet*
		instances: 2,
		// Setup commands
		commands: [
			// Install git if it doesn't exist yet
			'hash git || sudo apt-get install git --yes',
			// Install node.js if it doesn't exist
			'hash nodejs || curl -sL https://deb.nodesource.com/setup | sudo bash -',
			'hash nodejs || sudo apt-get install nodejs --yes',
			// Overwrite old app version
			'rm -rf node-hello-world',
			'git clone git://github.com/JonnyBurger/node-hello-world.git',
			// Start aoo
			'npm install forever -g',
			'killall node && killall nodejs',
			'forever start node-hello-world/index.js'
		],
		master_before: [
			// Install nginx
			// Will only be executed on test-1
			'hash nginx || sudo apt-get install nginx --yes'
		],
		master_after: [
			// Restart nginx
			// Will only be executed on test-1
			'sudo service nginx restart'
		],
		nginx: [
			// Nginx configuration
			// The cluster block gets configured automatically for you
			'server {',
			'    listen 80;',
			'    location / {',
			'        proxy_pass http://cluster;',
			'    }',
			'}'
		].join('\n'),
		// Which port does your app start on before you put nginx in front of it?
		port: 5000,
		// SSH key file that matches the ssh_keys above, so no password is needed
		key: fs.readFileSync('/Users/jonnyburger/.ssh/id_rsa')
	})