29 12 / 2011
Deploying an Existing Node.JS App to Nodester
Do you have an existing Node.JS application and a Nodester Node.JS hosting account? Cool! Let’s walk through getting that app deployed for you.
1. Open your command line and cd into your app directory
2. Run “nodester app create <appname>”. (Note: If your starting javascript file is NOT server.js, add its name after the appname on the create command)
3. Update your app’s port address to match the one we assigned via the create app command. (Note: If your app uses websockets, set your client app to use port 80.)
4. Run “nodester app info <appname>”
5. Assuming you already have a git repo, add a nodester remote by running “git remote add nodester <git repo from info command>”. If you do not have a git repo already, first run “git init” followed by “git add .” and git commit -m “initial commit”
6. Run “git push nodester master”. This will push and run your existing app to Nodester where it can be reached at http://<appname>.nodester.com.
Does your application use any NPM modules? If so, you will need to install them to your app’s sandbox and restart your application using the following commands:
7. Run “nodester npm install <appname> <module>”
8. Run “nodester app restart <appname>”
Subsequent git pushes update your Nodester app and restarts it automatically for you. Easy as that :)
Permalink 26 notes
03 3 / 2011
Running Websockets on Nodester!
Websockets are the latest craze and a natural fit for Node.JS. Thanks to @DanBUK and @DavGlass, websockets are now supported on Nodester!
Deploying a websocket application to Nodester couldn’t be any easier. We’ll use socket.io’s chat example as an example.
All you need to make is two source code changes:
server.js
server.listen(8362);
chat.html
var socket = new io.Socket(null, {port: 80, rememberTransport: false});
Remember: The client side of the websocket always talks over HTTP port 80 on Nodester. The server side is the port that was assigned to you when you created your Nodester application. You can always run the following CLI command to get the port addressed we assigned you (as the git repo and status):
nodester app info
Note: We actually just rolled out an enhancement where you no longer need to update your assigned port address. We will automatically do it for you!
Now it’s time to deploy your hot new websocket-based Node.JS app on Nodester! Since Nodester applications are sandboxed, you will need to install your NPM module(s) with the following command:
nodester npm install socket.io
Node: You can install more than one module at once by adding a spaces between them such as nodester npm install socket.io express etc.
git push
That’s it! If you need to restart your application for any reason, it’s as simple as:
nodester app restart
Now you’re ready to rock and roll with Nodester! Want to see this chat demo in action? Goto http://chat.nodester.com
Permalink 12 notes