Here’s a quick overview of how to get your Node.js Knockout app up and running correctly. Please review the overview section of this post, as it contains essential information for the contest.


  1. Set up a server with the NKO npm module.
  2. Push to your team’s GitHub repo.
  3. Deploy to Joyent, Heroku or Linode.
  4. Verify your app is marked as deployed.


For these instructions you will need two keys, both available on your team page:

Slug and secret

  1. your team slug - in this example, your-team-slug
  2. your team secret - in this exmaple, yourteamsecret

Step 1. Set up a Server

Create Project Folder

You want to make sure you have a folder for everything before you get started.

$ mkdir your-team-slug
$ cd your-team-slug

Set up Dependencies

Install npm.

$ curl | sh

Then set up your package.json and dependencies:

$ npm init
$ npm install --save nko

Create server.js

// server.js
var http = require('http')
, nko = require('nko')('yourteamsecret');

var app = http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/html' });
    res.end('Hello, World');

app.listen(parseInt(process.env.PORT) || 7777);
console.log('Listening on ' + app.address().port);

Require the `nko` Module

Make sure you require the nko module or else your site will not be voted on:


We use the nko module to determine where your site has been deployed, so we can send judges to the right url to evaluate it.

Step 2. Push to GitHub

Instruct git to ignore your npm dependencies.

$ echo node_modules > .gitignore

Then create a git repository and add everything to it.

$ git init .
$ git add .
$ git commit -m 'first commit'

Finally, set GitHub as the origin for the repository.

$ git remote add origin
$ git push -u origin master

Step 3. Deploy Your Server

Joyent, Heroku, and Linode are providing free, private instances for you to deploy your code during the competition.

The choice of service for your submission is up to you (kinda like Pokémon):

  • Joyent provides a full VPS with root-level access combined with the ease of git push deployment. But note that Joyent only provides Solaris (ZFS!).
  • Heroku is crazy easy and fast to get up and running, but has some limitations (non-writable disk; XHR long-polling, but no WebSockets).
  • Linode is also a full VPS, with your choice of Linux distro and root-level access. It offers flexibility, but requires the most configuration and UNIX skillZ of the three hosting services.

You cannot deploy to your own private server no matter how face-meltingly awesome it is.

Joyent (

Detailed instructions for deploying to are available here.

The hosting service has just launched! Please send support inquiries to

  1. Create an account at (or login).

  2. Click “Order a Machine” button in the upper right hand corner.

    • In the following instructions, we will assume you name your smart machine your-team-slug.
  3. Click on the smart machine you ordered.

  4. Follow the instructions on the smart machine page to add the host to your ~/.ssh/config file.

  5. Add joyent as a remote on your git repo:

    $ git remote add joyent
  6. Now you should be able to deploy with a git push:

    $ git push joyent master
  7. Load your app in a browser to verify that it works.
  8. Check your app is marked as deployed correctly on your team page.


  1. Follow the invitation link in the invitation email you received from Heroku. Create a password in the invitation page.

  2. Install the heroku gem on your development machine.

    gem install heroku
  3. Configure your heroku login credentials, using the same email and password you supplied in step 1. Answer yes when prompted to use your existing ssh key.

    $ heroku login
    Enter your Heroku credentials.
    Found existing public key: /Users/user/.ssh/
    Would you like to associate it with your Heroku account? [Yn] y
    Uploading ssh public key /Users/user/.ssh/
  4. Configure a Procfile, to instruct Heroku how to serve your app.

    $ echo 'web: node web.js' > Procfile
  5. Install Foreman and test your app locally (on port 5000 in this example).

    $ gem install foreman
    $ foreman start
    13:52:16 web.1     | started with pid 83853
    13:52:16 web.1     | Listening on 5000
  6. Configure your remote Heroku repository.

    $ git remote add heroku
  7. Deploy to Heroku.

    $ git push heroku master
  8. Load your app in a browser to verify that it works.
  9. Check your app is marked as deployed correctly on your team page.


  1. Login to the Linode Manager.

  2. Enter the credentials from your team page.

  3. Follow the Deploying to Linode blog post.

  4. Deploy your app.

    ./deploy linode
  5. Check your app is marked as deployed correctly on your team page.

Verify Your App is Marked Deployed

Once you deploy, you should visit your node knockout team page and verify that your app is correctly marked as deployed.

If your app is deployed correctly, you should see a nice green checkbox.

Deployed Correctly

Additional Notes

All entries will be hosted at least until the competition winners are announced. During judging, we will require remote access to your instance via an SSH key to make sure there is no cheating. We will compare your deployed code with the code in your git repo.

After the 48-hour competition deadline, you will still be allowed to restart processes, free up disk space, and perform other general sysadmin tasks (including playing lots of StarCraft 2).

Blog comments powered by Disqus