EC2 on Rails

UPDATE: I am no longer maintaining this project.

A Ruby on Rails EC2 "Appliance"

EC2 on Rails is an Ubuntu Linux server image for Amazon's EC2 hosting service that's ready to run a standard Ruby on Rails application with little or no customization. It's a Ruby on Rails virtual appliance. EC2 on Rails is opinionated software: the opinion is that for many rails apps the server setup can be generalized and shared the same way as the web application framework itself. For many people (Twitter, this isn't for you) the server image can be treated the same way as other shared libraries. And if the day comes when your needs are unique enough that EC2 on Rails can't be configured to work for you then you can bundle your own image from it or fork the build source and customize it. But until then, why spend your time configuring servers?

Background

In 2007, just as I was ready to launch an early version of GigPark, Amazon was beginning to revolutionize server hosting with the launch of their EC2 service. EC2 was still in limited beta at the time and I was lucky enough to get an account. EC2 was revolutionary partly because they offered dynamically-resizable (a.k.a. "elastic") compute capacity billed by the hour. But the really big change was that this "elastic" property required us to think about servers differently: it separated the concept of "instance" and "image". It became possible to create and publish preconfigured server "images" that anyone can use. EC2 on Rails was basically an abstraction of the work that I was doing to configure the GigPark servers, generalized in such a way that it would work with any standard Ruby on Rails application. It was the first public Ruby on Rails server image ("AMI"), and in fact it was the first public Ubuntu AMI that I know of (though Eric Hammond went on to create what later became the definitive Ubuntu public AMI and Canonical eventually produced official Ubuntu images). It includes such features as:

  • A standard Rails deployment stack: Apache + mongrel at first (later upgraded to Phusion Passenger + Nginx in the unreleased 0.9.11 version) plus MySQL and Memcached
  • Varnish proxy (with optional HTTP caching) in the unreleased 0.9.11 version
  • Automatic backup (including efficient incremental backup every 5 minutes) of the MySQL database to S3 (EBS support was later added)
  • Automatically created hostname aliases for all other instances in the cluster
  • Process and system monitoring with Monit (later changed to the Ruby-based God monitoring daemon)
  • Easy creation of hourly, daily, weekly and monthly scripts
  • Local Postfix SMTP mail server (only available from within the instance, not listening on external network interfaces)
  • Automatic archiving of all logs to S3 nightly
  • SSL support

Share

Like this article? I spend a lot of time writing here, it would only take a second to say thanks by sharing...