RightScale Blog

Cloud Management Blog
Cloud Management Blog

The 10-Minute EC2 Server

The new Rails All-In-One ServerTemplate we just made public makes it really easy to get your own Rails application running on Amazon EC2. And it's all free to boot!

The ServerTemplate is a collection of RightScripts that install Apache, mod_balancer, Mongrel, and MySQL, and a backup cron script all on one EC2 instance. All you need to do is to specify where your code is located and launch the whole thing! This all-in-one ServerTemplate is excellent for a number of purposes:

  • kick the tires of Amazon EC2 -- see your own app running and play around
  • launch a simple site -- many small sites don't need more, the traffic load isn't high, and if the site is down a couple of hours every few months because of some problem with the instance then that's not the end of the world
  • do some development -- if you need an extra dev server then this is yours cheap, whether for a few hours or for days
  • try something out-- want to turn your app upside-down and see how it holds up, don't mess up your own server or laptop, instead launch-wreck-discard an EC2 instance as many times as you please

Make no mistake: this ServerTemplate is neither a black box nor a toy! All the configurations are available for you to inspect and modify. You can clone the template and replace the pieces you want to design differently. You can also add additional functionality or even split the server in two and run the database on a separate instance for a better performance. This is not a canned set-up like most hosting shops provide: instead, it's a starting point that you can customize to your needs and wants. If you're set to grow and are looking into multiple servers, check out the site architectures we recommend. We're readying a short how-to that takes you through launching your own Rails app using the ServerTemplate step-by-step. In the meantime, you can also easily launch a demo server with Mephisto: it's the same template but we have adapted it to get Mephisto onto it. OK, so how do you get started? Here are the steps:

Log into RightScale

Log into RightScale, or, if you don't have a RightScale account yet:

  • sign-up for a free account.
  • Go to your email inbox, look for the validation email, click on the link to get as couple of hours of EC2 time
  • Alternatively, if you have an EC2 account enter your credentials into RightScale (Settings > My Account > Credentials) and thereby get more features enabled
  • Create an SSH key, if you don't have one: Design > Ec2 > SSH key

Launch a Server Running Mephisto

Mephisto is a blog engine written in Rails and the server you are about to launch has a generic Rails set-up plus the Mephisto app so you can see something in action with the fewest steps.

  1. Swing over to the ServerTemplates using the Design menu at the left and locate the Mephisto All-In-One v1 demo ServerTemplate:
  • Before being able to launch it, you need to specify an SSH key (so you can SSH into the server) and a security group (corresponds to ingress firewall settings): click on the edit icon on the right
  • Select an SSH key and a security group, ignore all the other settings, and hit "save" at the bottom (yes, we're making this easier soon)
  • Now hit the "Launch" button at the top of the page and you see a page with all the settings you can change for this ServerTemplate. Ignore most of them for now and put something (root@localhost will do) into the ADMIN_EMAIL field, which is empty. Then hit "Launch" again at the bottom.
  1. Watch the instance that will run a demo app appear as "launched" in your Recent Tasks pane on the left: it will take 2-3 minutes to start booting, and then another 6-8 to install and configure all the software.
  2. Sit back, relax and watch the server go through its boot process until it shows "operational" in the Recent Tasks pane. This may take 6-8 minutes. We're working on reducing the boot time: most of it is actually taken by the gem install commands!
  3. Once your server is operational, you are ready to use your brand new server. Go to Manage > Active Servers and click on the server's DNS name (ec2-67-000-0-00.z-1.compute-1.amazonaws.com or similar), that should bring you straight to your own Mephisto instance!
    • Quick troubleshooting: if everything looks ready but all connections to your server simply time out make sure you have ports 22 (SSH) and 80 (HTTP) open in your security group setting: Design > EC2 > Security Groups, add IPs: "tcp 0.0.0.0/0 ports 22..22" and ""tcp 0.0.0.0/0 ports 80..80".
  4. Start using the app. For example, edit the url by appending "/admin" and log in using the default Mephisto user/password (i.e., "admin" and "test"), hit "create new article", type "Hello World!", save, go back to the root URL of your server and voila! your first article in Mephisto on your server on EC2. Woot!
  5. Remember that you have just launched servers that are inexpensive, but do cost money. You can check your active instances at Manage > Servers > Active Servers, and terminate any which you've finished testing.

So this canned Mephisto all-in-one template is a good example to get your feet wet in bringing up a complete rails up in EC2. But unless you actually need Mephisto, this doesn't get you that much. If you are a Rails developer you will want to bring up your own app...so stay tuned for our coming step-by-step guide to launching your own Rails "All-In-One" server using RightScale.

Comments

I don't find any edit button. Can you help me?
Is there a server configuration that is more geared towards the production users? Let's say I wanted to manage a site that gets 20,000 hits per day and is continuously banging the database. Do we use the Rails-all-in-one server package?
Hi Eric, Thanks for the comment. Great Question. Our all-in-one templates are designed to help people get their feet wet and test out their application on the cloud. You probably would not want to use them in a production application. For a production site, RightScale provides distributed templates (load balancing front ends, app servers, DB servers) so you can cluster them into a deployment. This is how you'd attain scalability and redundancy on EC2. Check out this post here for more information on different site architecture concepts in the cloud: <a href="http://blog.rightscale.com/2007/09/11/setting-up-site-on-ec2-with-rightscale/" rel="nofollow">Setting up site on EC2 with RightScale</a> If you'd like more information, or would like to see a demo of a distributed deployment just email us at info@rightscale.com.
Posted by Matthew Small (not verified)   Ι   May 20, 2008   Ι   05:12 PM

Post a comment