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

node-deploy

v0.2.0

Published

Makes deploying node web apps to nginx + upstart machines easy

Downloads

8

Readme

node-deploy

node-deploy is a tool for deploying a node web app to an upstart+nginx machine automatically.

Installation

npm

npm install -g node-deploy

GitHub

npm install -g https://github.com/martinrue/node-deploy/tarball/master

Prerequisites

The remote machine must have git, nginx, node and npm installed before deployments can be made to it. The machine should also be configured for remote access via ssh.

Usage

usage: nd [init | deploy | remove] -b <branch> -d <directory>
  • Run nd init to generate the deploy config files. You need to commit and push these files before deploying.
  • Run nd deploy to begin a deployment.
  • Run nd remove to stop and remove the app from the server.

Options

-b <branch>

node-deploy will deploy from the master branch. Use -b <branch> to deploy a different branch. The new branch will be deployed over the same application – it's just a means of deploying from an alternative branch.

####-d <directory>

Config files are stored in the deploy directory unless you specify a custom directory via -d <directory>. Example: nd deploy -d deployconfigs

##Example First run nd init and answer the questions. It will try to guess some settings for you – if you're happy with the guess, just hit enter to accept it:

node v0.10.8 in ~/Desktop/app on master
→ nd init
app url: martinrue.com
app name (app): martinrue.com
app start command (node blog.js):
upstream port (4001):
app path on server (/var/www):
nginx sites-enabled path (/etc/nginx/sites-enabled):
git clone URL ([email protected]:martinrue/delme.git):
server SSH address: [email protected]

Second, commit and push the newly created config files:

node v0.10.8 in ~/Desktop/app on master
→ git add -A

node v0.10.8 in ~/Desktop/app on master
→ git commit -m "add deploy config"
[master 9a0def5] add deploy config
 3 files changed, 30 insertions(+)
 create mode 100644 deploy/deploy.json
 create mode 100644 deploy/martinrue.com
 create mode 100644 deploy/martinrue.com.conf

node v0.10.8 in ~/Desktop/app on master with unpushed
→ git push
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 912 bytes | 0 bytes/s, done.
Total 6 (delta 1), reused 0 (delta 0)
To [email protected]:martinrue/martinrue.git
   b973149..9a0def5  master -> master

And finally, deploy:

node v0.10.8 in ~/Desktop/app on master
→ nd deploy
deploying master to [email protected]:/var/www/martinrue.com

Questions

After running nd init, you'll be asked a series of questions. Here's what each answer is used for:

####app url

This is the public URL your app will be served from.

Example: martinrue.com

####app name

Specifies the name of the app directory and the nginx/upstart config files.

Example: martinrue.com

####app start command

The command used to start the application on the server.

Example: node app.js

####upstream port

The port the node app listens on. This is needed to properly link the node process with the upstream nginx server.

Example: 1234

####app path on server

The directory the app will be cloned into and run from on the server.

Example: /var/www

####nginx sites-enabled path

The path of the nginx sites-enabled directory. The nginx config file will be copied here.

Example: /etc/nginx/sites-enabled

####git clone URL

The URL of the repo. The repo is cloned on the first deploy and then pulled from thereafter.

Example: [email protected]:martinrue/martinrue.com.git

####server SSH address

The SSH user + host address of the server. You can specify a non-22 SSH port number by using a : after the hostname.

Example: [email protected]:3022

Notes

  • Following a successful deploy, nd will wait a further 15 seconds (to account for the configured respawn limits of upstart) to verify the app process is still alive and well.

  • As a shorthand, the nd init, nd deploy, nd remove commands can also be referred to by their first letter, i.e. nd i, nd d and nd r respectively.

  • If no errors are reported, the command was successful. The appropriate zero or non-zero error code is returned to allow nd to be invoked by third party tools.

  • It's assumed that all files in the sites-enabled nginx directory are valid config files, i.e. that your nginx.conf includes them using something like this include /etc/nginx/sites-enabled/*;.

License

MIT