Setting up new server on Amazon's ec2

 

I wanted to set up a custom database and server for the new version of gifpumper.com.
I decided to go with MongoDB for database setup and Node.JS running on ec2. This way I’ll be able to keep everything javascript, and have a fast and scalable system from the get-go.

This is the first time I tried installing a server and it took some time to figure out. So I figured I should post some tips and links to tutorials I used along the way.

The first step was setting up an Amazon Web Services account. They offer a free one-year mini virtual ec2 machine which is great for starting a small project that can be scaled up easily if needed. The instructions on setting up an ec2 instance are pretty straight-forward. Something I was stuck on for a while is adding the private .pem key to my ssh settings for easier shell access. This is done with this command.

$ ssh-add ~/.ssh/key_name.pem

Next it was time to download and install mongodb:
http://www.mongodb.org/display/DOCS/Amazon+EC2
http://www.mongodb.org/display/DOCS/Quickstart+Unix

pretty easy

Next setting up Node.JS. I made the mistake of installing the unstable version at first which did work with some of the modules, so I recommend the older, stable one. Some helpful instructions here:
http://www.embracingthecloud.com/2010/12/05/InstallingNodejsOnAmazonEC2.aspx
except for the command:
$ sudo ./configure --without-ssl
it should be just
$ sudo ./configure

the install npm (nodejs package manager)
$ curl http://npmjs.org/install.sh | sudo sh

finally this tutorial was extremely helpful in setting up a site and getting familiar with node.js and mongo functionality:
http://howtonode.org/express-mongodb

Next Step will be porting the existing code (php and mysql) to the new setup, writing an api and putting everything on github.

 

 
Projects: gifpumper
Tags: ec2, mongodb, node.js