ruby, rails, textmate, automation, etc.

Integration Testing for Multiple Web Applications – Introducing Integral

Posted on November 11, 2008

I’ve recently been developing a Rails app that relies on a database that is maintained by another team as part of a different application. As you can imagine, unexpected changes to the database schema can bring our Rails app to it’s knees if they’re deployed to the live server before our application is updated.

So far we’ve been lucky, but the issue has been at the back of our minds for a while. So this week I sat down and cooked up a solution, and we’ve called it Integral.

Integral consists of some Thor tasks that:

  • Run tests on your test server.
  • Keep track of which versions of your applications work well together.
  • Can be integrated into your deployment recipes to ensure that deploying an app should never break your live server again…

All the Integral code is on github, and I’ve written some fairly extensive documentation on the Wiki. Please try it out, give us some feedback, fork it, burn it, give us some feedback, etc. etc.

Configure the Expires header for Rails under nginx

Posted on September 13, 2008

The images, CSS and JavaScript files served up by your Rails application can usually be cached by the web browser, rather than being downloaded (or checked) every time the browser loads a page on your site. For a properly configured site the net effect is faster page load times and a vastly improved user experience. Rails gives you some help here, but it doesn’t happen automatically – you need to configure your web server to set the HTTP Expires header. This article explains how to configure the expires header for a Rails application running behind the nginx HTTP proxy server.

database.yml should be checked in

Posted on May 24, 2008

It’s generally acknowledged to be good practice to keep your production database.yml file away from your version control system. Why? So that people snooping around your version control system don’t find your database password. There are plenty of examples out there that tell you how to achieve this with Capistrano.

I’m talking about the database.yml file that you use during development.

Easy git-svn for Rails (or "git-me-up")

Posted on April 24, 2008

I’ve been trying to persuade git-svn to work properly with Rails plugins that have been installed via svn:externals. Whilst working out how to do it I stumbled across several great articles, but I couldn’t get any of the solutions presented to work perfectly. Samuel Tesla’s article is especially informative, but for a long time I couldn’t stop git-svn from trying to commit Git metadata back into my Subversion repository…

After a bit of head scratching I got it sorted, and wrapped the process up in a little utility called git-me-up.

Monitoring BackgrounDRb with God

Posted on April 08, 2008

God is a very neat piece of software, frequently used by Rails developers to monitor mongrel servers, and restart them if/when they crash or use up too many system resources.

Its use isn't limited purely to monitoring web servers though; you can monitor pretty much anything you like. Read on to see how to configure it to monitor the Ruby job processing daemon, BackgrounDRb.