Skip to end of metadata
Go to start of metadata

The title of the page serves as the heading to this section. It describes the problem that this page is solving.

In this page:

Accessing your Node.js SmartMachine

You can access your node.js SmartMachine via ssh as the "node" or "root" user using your ssh key and the public IP address of your node.js SmartMachine:

You should access your SmartMachine primarily as the node user and use root for admin tasks (such as when installing or configuring software).

Paths to the appropriate node binary (/home/node/local/nodejs/bin/node), npm, and various services (node-service-info, node-service-log) are set for the node user and not for the root user.

Deploying with Git

You deploy your Node.js application to your Node.js SmartMachine via git from a local git repos to the remote repos on your Node.js 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 your local git repository:

And to push to your Node.js SmartMachine:

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.

npm Dependencies and 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!

At a Glance

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

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.