Skip to content

Instantly share code, notes, and snippets.

@sintaxi
Created August 28, 2010 02:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sintaxi/554620 to your computer and use it in GitHub Desktop.
Save sintaxi/554620 to your computer and use it in GitHub Desktop.

NodeKO Tips on Joyent

Tip 1) Use process.env.PORT

Listen to process.env.PORT and fallback to port 8001 will make your life easier. By default process.env.PORT is set to port 80.

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World!\n');
}).listen(parseInt(process.env.PORT) || 8001);

Tip 2) Add more ssh keys.

You can easily add your team members to your provisioned machine. Ssh into your node smartmachine and run this command. The following will add jill and sally's ssh keys to your machine...

curl -k https://api.no.de/userkeys/jill/sally >> ~/.ssh/authorized_keys

Tip 3) Set .node_libraries path (*FIXED this should no longer be necessary)

If you are using npm on your node smartmachine you will want to do this. There are two ways to add .node_libraries to you path.

# top of server.js
require.paths.unshift("/home/node/.node_libraries")

OR

# add the following to `~/node-service/profile` in your smartmachine
NODE_PATH=/home/node/.node_libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment