You are not logged in.
Hello, I hope some of you have heard of node.js, which is event based server side javascript.
I wanted to give it a try, but failed to compile it on Webfaction, ran into problem similar to this post.
I like Webfaction for it customizability, why not to make it possible to run node.js as well?
Offline
I created this example and ran it as custom app listening on port.
var sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
setTimeout(function () {
res.sendHeader(200, {'Content-Type': 'text/plain'});
res.sendBody('Hello World');
res.finish();
}, 2000);
}).listen(40740);
sys.puts('Server running at http://127.0.0.1:40740/');When i open it in browser, it outputs
b Hello World 0
Do you know why it appends extra symbols to just "Hello World"?
At the same time when I run this on server, the output is correct:
curl http://127.0.0.1:40740 Hello World
Last edited by dw0rm (2009-12-03 00:42:01)
Offline
It looks like this is a result of the 'chunked' Transfer-encoding set by the node.js server. Could you have the server not send the 'Transfer-Encoding: chunked' header?
Another option is to buy a dedicated IP address, and run your server on a custom unprivileged port number, so you can access it as http://your-domain.com:40740
Offline
tie,
Thanks for your tip. I'm gonna post the question on node.js google group.
Offline
They helped with a patch, this is groups thread for somebody who might run into same problem:
http://groups.google.com/group/nodejs/b … 9f5be21be1
Offline
That's great! Hopefully the patch will make it into the next release. In any case, we'll keep it in mind in case anyone else runs into the same problem.
Offline
got this all running as a locally accessible app, is there any suggestion on how to route my domain hosted to hit this service?
my only thought is i have to wrap an existing framework (django/whatever) to proxy the calls mydomain.com, to the internal localhost:port ?
thanks,
Offline
I simply used "Custom app (listening on port)" app type, and ran node.js app under screen.
Offline
Since you already started this thread I'll post my question here..
I'm not getting tests to run at all with node.. Building seemed to go nicely along, also all of the built in self tests I've tried works, but im not getting a response in the browser when using the custom app(listening on port) feature.. Do I have to build node in the webapps/mywebappsname directory to make it work correctly or something?
Offline
Actually I made it work without building a new instance in the application directory.. Don't know how but it works now:)
Offline
Anyways, made a howto for other users that wish to set up nodeJS on their Webfaction account.
http://enotodden.net/nodejshowto-webfaction.txt
Offline
enotdden, that how-to link seems to be dead; could you post it here please? Would be a great help.
Offline
@markashleybell
I'm so sorry for the late answer, haven't been on the webfaction forums lately.. You've probably figured it out by now, but anyways... Here you go:
How to set up nodeJS on Webfaction.
Version: 0.1.94
Date: 12.05.10
By enotodden
1. Fire up a shell.
2. Get the .tar.gz file from nodejs.org
wget http://nodejs.org/dist/node-v0.1.94.tar.gz
3. Extract the archive.
tar -zxvf node-v0.1.94.tar.gz
4. cd into directory.
cd nodev0.1.94
5. Configure with the --jobs flag.
./configure --jobs=1 --prefix=$HOME
6. Build.
make
7. Install
make install
8. Thats it, lets test it!
9. Go to the control panel, make a new application,
set the type to custom(listening on port) and call it nodetest.
Write down the port number your app was assigned. (for this example I'll use 54321)
10. Make a new subdomain for your testing app.
11. Make a new website entry, set domain and application accordingly.
12. cd into your apps' directory.
cd ~/webapps/nodetest/
13. make a new file called nodetest.js
nano nodetest.js
14. Paste in this code and save it(ctrl-o enter ctrl-x)
var sys = require("sys"),
http = require("http");
Offline
Hi,
I got my site up and running brilliantly with Node (node.dshaw.com), but have no idea how to keep the service up?
Currently, I login and run "node dshaw.js" and it works great. However, when I close my SSH session, down goes the site. I want to leave that process running. Is that possible with a custom script configuration? Any suggestions?
Cheers,
@dshaw
Offline
Your best option would be to use nohup, here is a full set of documentation for it: http://www.cyberciti.biz/tips/nohup-exe … rompt.html
Offline
@klynton
Thanks. That's excellent.
Any tips on killing the process when it comes time to do that?
Cheers,
@dshaw
Offline
@klynton
Brilliant. Thank you so much. Working like a charm now.
- @dshaw
Offline
I created a node install script and made a post about it. See http://forum.webfaction.com/viewtopic.p … 060#p17060 for details. I hope the script is helpful.
Offline