Hacker News new | past | comments | ask | show | jobs | submit login
Deploying Node.js on Amazon EC2 (carbonfive.com)
89 points by rudyjahchan on Sept 2, 2011 | hide | past | favorite | 17 comments



"After nearly a month of beating my head against the wall that is hosted node.js stacks — with their fake beta invites and non-existent support ..."

It would be interesting to know what kind of experiences other people have had with the various Node.js platforms.


How easy is it to interactively provision an new EC2 instance nowadays? When I wrote an eerily similar blog post (scripted install of node 0.2.1 on EC2) last year I didn't really enjoy the process of setting up my zones and picking an Alestic image, etc.

By contrast, I've set up my first Rackspace Cloud VPS a few months ago and the install was a few clicks followed by them emailing me the SSH connection info. I'm not making any claims about the serviceability of one product over another, but the "I just want to try it out" story for Rackspace ca. July '11 was far better than EC2 ca. September '10.

Edit: I was also put off by the many meters of EC2 pricing... I never really knew ahead of time what costs I was going to incur. With Rackspace it was easy for me to calculate $10/mo. for a single Ubuntu box. Perhaps I missed a tool on EC2 that I should've known about?


I can't speak for amazon back in '10 as we've only recently adopted the system, but I assure you this isn't the case nowadays.

Launching an instance takes < 30 seconds and is a matter of a few clicks, the author of this post chose to use an external AMI which makes things a bit trickier and entails a few extra steps.


The AWS APIs are a twisty maze of passages, all [nearly] alike.

The management console is okay if you just want an instance or two, but it still strikes me that AWS is best when you want (or need) to automate allocation of cloud services. Libraries like Python's Boto are great way to get the basics taken care of, like working with S3 and spinning up/shutting down EC2 instances, without having to fret too much about the raw AWS APIs.

Beyond the basics, it's quite common to want to spin up a web of resources (EBS, load balancers, security groups, elastic IPs) along with new EC2 instances. The console isn't ideal for that, but Cloud Formation is fairly good: CFN allows you declare the resources you want and their relationship to one other. Construction is transactional, so you either get a working web or you get nothing. The Cloud Formation syntax is JSON and a little wonky -- there are things like functions to do table lookups so you have some semblance of making choices -- but it's serviceable.

(For sanity we use YAML for Cloud Formation and convert to JSON before sending it up to AWS. JSON lacks comments and sucks to hand-edit on deeply nested structures. Some of our YAML is hand-written; some of it generated by our Fabric scripts.)


The new AWS console is super easy to use. I've never played with Rackspace Cloud but it takes about 2 minutes to provision a new server on EC2 these days.


Rasmus Andersson wrote a good tutorial on how to set up node.js on EC2 as well. Think it was posted here on HN.

http://rsms.me/2011/03/23/ec2-wep-app-template.html


This comes in real handy since I'm forced to leave GAE for their crazy new price.


You've been running NodeJS on GAE?


No, that would be quite a accomplishment. I'm leaving GAE to run node.js on EC2. It's been amazing so far.


anyone have experience with node on heroku, with all the jazz (mongo, redis, socket.io)?


Yes, and it's brilliantly easy. Cedar stack is a pleasure to work with.

The best part about using Heroku for NodeJS apps is that I can focus more on writing my app code and less on sysadmin-related tasks. I don't have to worry very much about provisioning or scaling ("heroku scale web=2" tadaaa).

The downsides include cost (this depends on a variety of factors of course, e.g. what 3rd party plugins you're using) and lack of "control" (if you care about that sort of thing). Also, they don't support WebSockets (yet).

<self-promotion-warning> My Node Knockout app is running nodejs/mongo/redis/socket.io (resorting to long-polling since Heroku doesn't support Websockets, but it's quick enough): http://restalytics.com (sorry, the home page is kinda busted, but scroll down to the bottom and log in with nkodemo@restalytics.com/nkodemo if you'd like to see a working demo. Modern browsers only). </self-promotion-warning>

Edit: I'm linking to my app to show you an example of a working NodeJS app on Heroku, but I've wrapped it in a self-promotion-warning regardless to preemptively fend off any downvotes that I might get as a result of people misunderstanding my intentions.

Edit2: Full disclosure, I happen to work at Salesforce.com.


I just set up my first node app on Heroku last week. As far as I can tell, doing anything with sockets is not possible, per their doumentation, however, I have been pleased with the service thus far. Here is the article from Heroku as to how to set it all up:

http://devcenter.heroku.com/articles/node-js

You have to use an add-on for Mongo, but it's easy to configure that from the Heroku app dashboard. Overall, I have been pleased thus far. The one gotcha I ran into was that you have to define the port the app will listen on as process.env.PORT as opposed to your own port. Thus, assuming you are using express, the line is:

app.listen(process.env.PORT || YOUR LOCAL DEV PORT);


Don't forget that Heroku's "PORT" is a string while app.listen will expect an int. Easy fix, just parseInt(process.env.PORT).


http://devcenter.heroku.com/articles/node-js

"-----> Compiled slug size is 3.2MB"

It takes 3.2MB to say "Hello World!" on Heroku using Node.js?


a `Hello World` HTTP Server + Express + Connect

that's basically Rails


My iPhone app (http://convoyapp.net) uses NodeJS hosted on Heroku, I looked at various NodeJS hosting options and found Heroku the easiest to get going, not being a Rails guy I've not used them before but I can see what the fuss is about now. It's been running since without a hitch, definitely recommended.


The lack of WebSocket support is a bit discouraging. We tried out nodester for a while as well but ended up rolling our own. no.de appears to be the new hotness on that front.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: