welcome: please sign in

Diff for "MemberManual/WebApplications/NodeJs"

Differences between revisions 2 and 3
Revision 2 as of 2014-05-16 08:01:13
Size: 1940
Editor: MattCarberry
Comment: Added more information
Revision 3 as of 2014-05-16 08:51:08
Size: 2121
Editor: MattCarberry
Comment: Added more to test install
Deletions are marked like this. Additions are marked like this.
Line 52: Line 52:

 Configure your domain, modelling [[DomTool/Examples#mod_proxy|this example]]. This will foward from requests to your domain on navajos to the port that you requested on bog.
 

What is Node.js

  • Node.js is an application server based off of Google's V8 Javascript Engine. Quite a few popular frameworks have popped up around Node.js such as AngularJS and Backbone.js.

How

Request a port

  • Request a ProxiedServer port on bog as described in FirewallRules

Get Node.js

  • Make a directory for your website
       1 mcarberry@bog:~$ mkdir ~/public_web/sitename
       2 mcarberry@bog:~$ mkdir ~/public_web/sitename/nodejs
       3 mcarberry@bog:~$ cd ~/public_web/sitename
    
    Download Node.js
       1 mcarberry@bog:~/public_web/sitename$ wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
       2 mcarberry@bog:~/public_web/sitename$ tar -xf node-v0.10.26.tar.gz 
       3 mcarberry@bog:~/public_web/sitename$ cd node-v0.10.26/
    

Build Node.js

  •    1 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ ./configure 
       2 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ make
       3 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ make install DESTDIR=~/public_web/sitename/nodejs
    
    Cleanup Install Directory
       1 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ cd ../nodejs/
       2 mcarberry@bog:~/public_web/sitename/nodejs$ cp -r usr/local/* .
       3 mcarberry@bog:~/public_web/sitename/nodejs$ rm -r usr
       4 mcarberry@bog:~/public_web/sitename/nodejs$ cd ..
       5 mcarberry@bog:~/public_web/sitename$ rm -r node-v0.10.26/
    

Test Install

  • Change the port in this script (gleaned from here) to the one requested in the firewall rules and place it in ~/public_web/sitename/.

       1 var http = require('http');
       2 http.createServer(function (req, res) {
       3   res.writeHead(200, {'Content-Type': 'text/plain'});
       4   res.end('Hello Node.js\n');
       5 }).listen(8124, "127.0.0.1");
       6 console.log('Server running at http://127.0.0.1:8124/');
    

    Configure your domain, modelling this example. This will foward from requests to your domain on navajos to the port that you requested on bog.

MemberManual/WebApplications/NodeJs (last edited 2014-05-18 02:50:36 by MattCarberry)