Skip to end of metadata
Go to start of metadata

Joyent offers Node.js™ Cloud Services including a Node.js Development SmartMachine. The free Node.js Development SmartMachines are located under the no.de domain.

In this page:

This documentation is for the free Node Development SmartMachines that have a domain name that end in no.de

If you are using a paid Node.js SmartMachine you have a static IP and your SSH server is on the default port

Creating a Node.js Development SmartMachine

First, you need an account on Joyent Cloud. Got to http://no.de/ and sign up. To provision a Node.js Development SmartMachine, you will need an SSH key.

You must compile all Node.js modules you build on a Node.js SmartMachine.

Finding your SSH key

Your SSH key can be found at ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub. If neither of those files exist, create them with

Once you've provisioned a machine, the service will provide information on how to update and connect to your newly provisioned Node.js Development SmartMachine. Be aware that the subdomain will take several minutes to propagate to your nameservers.

Updating ~/.ssh/config File

New Node.js Development SmartMachines use proxied HTTP which means that your machine does not have a unique IP address. That means that to access your Node.js Development SmartMachine with SSH, you will need to provide your machine's unique port number.

You can find the port number in the machine details page, along with instructions on how to update your SSH config file. They look something like this:

Host example.no.de
  Port 23456
  User node
  ForwardAgent yes

Deploying with git

Use git to deploy a Node.js application to your Node.js Development SmartMachine. For this to work, a file named server.js or a package.json file with a start script, must exist in the root of the repository. Here is a simple example of a possible server.js:

To initialize the git repository:

And to push to Joyent:

Each time git push is called the Node.js process on the server will be restarted. If the process exits in error, then the SmartMachine will rollback the Node.js process to the last working deployment.

A successful deployment looks like this:

To clone your Node.js Development SmartMachine repository into a different local machine, put the appropriate config settings in {{~/.ssh/config} and then use this command:

npm Dependencies and Integration

This only applies to the newest version of the no.de service. If you have an older version, you'll need to provision a new machine to take advantage of npm integration.

If you put a package.json file in the root of your git repository, then you can supply a list of dependencies, as well as a custom start command.

You can use the npm init command to initialize a package.json file, and then (using npm 1.0) install packages locally using npm install express --save to save the dependency to your package.json file.

By default the service gets started by running node server.js if a server.js file is found. However, if you would like to use a different start command, such as coffee-script server.coffee or node app.js --some args, then you can add this to your package.json file:

Make sure to git add your package.json file before pushing!

Configuration

By default the latest stable version, which at the moment is v0.4.11, is used. However, if a specific version of Node.js is needed, add a file to your git repository called config.json. The file should contain a single line

Note that this file is interpreted strictly as JSON, so the double quotes around the keys are required. At the moment "version" is the only setting in config.json but more may be added later.

You can specify a particular version

or choose a named version

or choose a version family to get the latest in that branch:

You can learn more about the available versions of Node.js and how to select a version here.

SSH access

You can use SSH to log in to your machine as the node user. For version 2 machines, you will need to provide your machine's port number.

If you update your ~/.ssh/config file as instructed in your machine's detail page in the no.de portal, you will be able to use SSH to log in like this:

Otherwise, you will need to use the -p switch to specify the port:

If you need to use sudo, you can log in as the admin user. This user has access to sudo without a password. See this topic.

The Node.js Development SmartMachine runs a purpose-built operating system that we call SmartOS. Yes, we're building an OS just to run your Node.js apps great! There is a lot to explore in the shell, but here are a few useful commands to get started:

Command Description
node-service-deploy Does a new checkout and deploy.
node-service-restart Restarts your Node.js service.
node-service-disable Turns off the Node.js service.
node-service-enable Turns on the Node.js service.
node-service-info Displays some information about the status of the daemon.
node-service-log An alias for tail -f node_log_file
pkgin install vim Use this to install various software.
pkgin search vim Use this to search for operating system packages.
npm help npm is already installed.
If you are an Ubuntu or Cygwin user and your SSH is slow to log in read this.

Installing npm

npm is already installed. To make sure you have the latest version, do:

See Updating npm From Very Old Versions if you have trouble updating npm.

At A Glance

This page gives you the basics you need to get started with Node.js on a Node.js Development SmartMachine.

Labels:
node node Delete
nodejs nodejs Delete
ssh ssh Delete
npm npm Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 12, 2011

    Anonymous

    I'm on a windows machine so curl isn't relevant for getting a coupon. I used python to post and only got "message": "Thanks for your interest, you are added to the queue" which really surprised me. I wanted to start testing no.de right away but I guess I can't.

    1. Mar 15, 2011

      Anonymous

      Install Cygwin

    2. Mar 15, 2011

      It may take a short while for you to receive your coupon code.

      You can get curl from the cURL download page.

      1. Apr 05, 2011

        Anonymous

        How long can it take to receive the coupon code? I posted the cUrl request about 2 days ago.

        Thank you

  2. Mar 15, 2011

    Anonymous

    I'm on a Ubuntu box, and I got the same "...added to the queue" message.   What happens when I reach the head of the queue - how do I get told?

    1. Mar 15, 2011

      You will get an email.

  3. Mar 26, 2011

    Anonymous

    I received my coupon code and provisioned my SmartMachine, however nothing happened.  This was 2 days ago :/

  4. Apr 19, 2011

    Anonymous

    Is there a lifetime on coupons?  Alternatively does calling https://api.no.de/v1/♥ again reset an existing coupon? 

    About a month ago I received an email saying that one was ready and I didn't get around to using it.  Today I thought I should get around to setting up the SmartMachine.  However, due to confusion on my part my first call was to https://api.no.de/v1/♥ as mentioned on the Provisioning page.  To which I got the 'added to the queue' message.  Having realised my mistake I reread the email and called https://api.no.de/v1/coupons instead.  However, that just gives me a blank response. 

    What's gone wrong?

    1. Apr 21, 2011

      Anonymous

      As I recall, they expire after a week. I also failed to use my coupon quick enough the first time.

      1. Apr 25, 2011

        Anonymous

        It turns out that you are right.  I actually made my way to the end of the email I received and it explicitly states that if I don't use it to deploy a SmartMachine within a week it will be reclaimed.  Similarly you have a week to log onto the newly created machine and then are expected to log on or deploy code at least one every 30 days after that.

        I will bear this in mind for next time.

        1. May 08, 2011

          Anonymous

          OK.  Got my new coupon but now when I try to use it I get

          Ruh-roh!

          • Service Unavailable

          I have tried this on two separate days (just in case there was a problem with the service) but I got the error message both times.

          What am I doing wrong now?  And am I going to manage to resolve it before this coupon expires?

  5. May 06, 2011

    Anonymous

    What is the wait time to get a SmartMachine provisioned ?

    1. May 08, 2011

      Anonymous

      In my case, about two weeks

  6. May 24, 2011

    Anonymous

    Can someone tell me what I am misunderstanding?  Following directions from two different places...

    curl https://api.no.de/? -X POST -u myUserName:myPassword

    Yields:

    {
      "errors": "page not found"
    }

    curl -u myUserName:myPassword https://api.no.de/v1/heart -X POST

    Yields:

    {
      "errors": "unauthorized"
    }

    1. May 24, 2011

      Hello,

      Have you set up an account on no.de yet?

      If you haven't, get one at https://no.de/signup

      Once you have an account, use the curl command to request a coupon code. Replace USERNAME with the user name you chose for you no.de account, and replace PASSWORD with the password you used when you created your no.de account.

      curl -u USERNAME:PASSWORD https://api.no.de/v1/heart -X POST
      

      If the user name you created was "phineas" and your password was "secret", you would enter the following curl command:

      curl -u phineas:secret https://api.no.de/v1/heart -X POST
      

      It may take up to 10 days or so to get a coupon code.

      1. May 25, 2011

        Anonymous

        Right - that's what I did... placing myUsername:myPassword in the problem statement was to avoid confusion over whether I was using literal "USERNAME" or "SECRET" or something dumb.  Even put an ssh key - still, see what I posted - that's what I get.

  7. Jun 21, 2011

    Anonymous

    I kept getting a SSL cert error on every curl request. Fortunately the error response indicated the -k options makes it go away (basically who cares if no.de can not prove its identity). So all is calm again, but not necessary configured properly.

    1. Jul 27, 2011

      Anonymous

      Using cygwin and I hit that certificate error. I followed the link to http://curl.haxx.se/docs/sslcerts.html

      There I went with option 5 to http://curl.haxx.se/docs/caextract.html

      This pointed to a perl script on github, raw it's at: https://raw.github.com/bagder/curl/curl-7_21_7/lib/mk-ca-bundle.pl

      I saved it a ran that and it generated a ca-bundle.crt file: perl /path/to/mk-ca-bundle.pl

      Add the path to that file to the curl statement with --cacert like

      curl -u USERNAME:PASSWORD https://api.no.de/v1/heart -X POST --cacert /your/path/to/ca-bundle.crt

      Doesn't complain anymore so I guess its cool. Now off to see how to make it permanent.