Automatic Rails Applications
The following article was written for the FiveRuns blog. FiveRuns makes Ruby on Rails performance and monitoring tools. With the release of Dash, they’ve extended the tool set to include more frameworks and social networking integration. Very cool stuff.
A few additional notes on the article:
Some potential future enhancements:
The Original Article Follows:
Welcome to the third installment of configuration-automation, a Ruby on Rails environment setup script. We’ll take a remote Linux server from first boot to fully configured, live Rails application server with just a hostname and password. This version includes a menu of Rails applications to choose from and replaces the nginx/mongrel servers with Phusion Passenger. Four popular Rails applications: Radiant, Spree, jobberRails and El Dorado are available to be deployed automatically.
All you need is Capistrano and git installed on your *nix client to download and execute the scripts. On the remote server, Ubuntu 8.04 or 8.10 with ssh listening is supported, such as a Slicehost VM or VMWare image.
Using The Script
Just download the files from github and run:
An ssh connection to the Ubuntu server updates core system libraries and installs dependencies such as Ruby and MySQL. The Rails application chosen is deployed via Capistrano with a second ssh connection. Each connection requires the target server’s password or you can install an ssh key pair to skip those prompts.
To install additional Rails applications to the newly configured server, run configure_rails_apps.sh from the same ./configuration-automation directory. The main script can also be rerun from the same directory against other blank Ubuntu targets.
Why Do This?
With no DSL to learn or manifests to build, this is a fast, simple way to bootstrap a Rails server. I built it to test (and quickly retest) compatibility with FiveRuns Manage and TuneUp product updates. As such, it makes a decent acceptance test environment builder. It is also a way to experiment with a functioning Ruby on Rails app server without working through every installation issue.
It’s not intended to meet the meet the same needs as more powerful tools like Puppet, or now Chef, though you could easily add these after running configuration-automation. For EC2 environments, also check out Matt Conway’s cool Rubber Capistrano/Rails plugin.
The Rails app versions are frozen to today to ensure their project updates don’t break the automation. I’ll refresh these in later updates to configuration-automation. Suggestions and feedback are welcome via comments below or on my blog.
Copyright © 2017 MarkPReynolds.com - All Rights Reserved