Structure for your non-trivial node.js project.
Get the boilerplate:
mkdir projectname git clone git://github.com/hunterloftis/node-boilerplate.git projectname cd projectname
Check your system requirements and start local databases:
scripts/requirements redis-server mongod
sudo npm install sudo node server
code, code, code
- Set up a git repository hosting your project (eg, on Github)
Ubuntu VPS (eg, Linode)
- Fill out
- Put your & other developers' public keys in
scripts/provisioning/keys(these public keys will have root access)
Provision your server as root:
cd scripts sudo ./provision staging root
Run within /scripts:
./deploy staging setup ./deploy -T staging
deploy(1) will look for ./deploy.conf, consisting of one or more environments,
[production], etc, followed by directives.
An example .conf file with all available directives:
[production] project awesome repo firstname.lastname@example.org:Skookum/awesome.git host 123.456.789.10 private /keys/awesome.id_rsa environment production ref origin/master stack node [media] project awesome_media repo email@example.com:Skookum/awesome.git host 123.456.789.11 private /keys/awesome.id_rsa ref origin/master stack nginx
The name of your project. This is also the username of your deploy user, and the location of your deployed project (/home/$projectname). Avoid using characters other than [a-z] and underscore.
Your git repository. Deploying will pull from this uri as the deploy user, $projectname.
The IP address of your server.
Path to your deploy user's private key. This is necessary if you are using a private git repository. If not, just use /dev/null.
A string that sets NODE_ENV for this project.
The default git ref from which to deploy. Defaults to origin/master.
The stack determines what type of server deployment you'd like to do. Node deploys a node server, while nginx deploys a very simple, fast, static file server that hosts your
app/public directory. It's designed to deploy media.yoursite.com.