Archive for the ‘Ruby on Rails’ Category

Help Wanted: Advanced Slicehost with Capistrano

Monday, December 3rd, 2007

I’m looking for someone to help me with some advanced server setup adminstration.

I have configured a Slicehost VPS to deploy my applications, but I need to get MySQL Replication working, along with some Capistrano/Deprec Recipes to automate deployment and configuration.

If anyone is interested in some paid work, drop me a line:

Performance testing Mongrel and Rails with httperf and autobench

Saturday, December 1st, 2007

I posted recently about my experiences with Slicehost, Capistrano and Deprec.

As part of my approach for migrating the Top Secret Project to Slicehost, I’ve been testing my new VPS using httperf and autobench.

Maybe it’s just me, but performance testing and statistics is a whole lot of fun.

My 256 Slice running Apache proxied to two Mongrel instances peaks at about 41.6 requests/second, but can handle about 40 req/sec as consistent average. The single instance averages about 15 req/sec but can burst up to 30.

I think 40 requests/second is more than enough for my needs at the moment … it provides a pretty good peak capacity, and with Slicehost you can always get more resources when you need them - running extra Mongrels is wonderfully straight forward, but can also create slice to act as a dedicated database host. The options are endless.

One useful lesson: your client connection makes a BIG difference to these tests.

On my laptop running a wireless ADSL connection, the results were all over the place. Running the tests from one of my servers with a much fatter pipe, gave consistent test results.
For more information on using httperf and autobench, this is your best friend: HTTP performance testing with httperf, autobench and openload

Capistrano, Deprec: Best Things Ever

Saturday, December 1st, 2007

I signed up for a slice on Slicehost a little while ago (there’s quite a waiting list, which is a good sign).

I’m planning on moving some stuff from a local provider to Slicehost, but wanted to experiment first.My current host is a CPanel VPS and it’s proved a little challenging to get that configured for Rails - CPanel doesn’t provide great support out-of-the-box, so it’s all manual, but with the added complexity fo having to work with CPanel’s configuration. I’ve only been able to get a single Mongrel instance running, because CPanel doesn’t support Apache 2.2.x.

System Administration is definitely the weakest part of my skill set - I have always been focussed on the code, and have had the advantage of working with dedicated sys admins - so configuring a VPS from scrach is a little daunting.

Enter Capistrano and Deprec to the rescue.

These tools automate the installation of your Rails stack and deployment of your applciation from Subversion (or GIT, or whatever is hot this week).

The basic steps:

cap setup_admin_account_as_root
cap setup_ssh_keys
cap install_rails_stack
cap deprec_setup
cap deploy_with_migrations
cap restart_apache

And that’s it, you’re done …

You bneed to create a deploy.rb file with your Apache and Mongrel configuration details and Cap will work the rest out.

It’s pretty incredible.

Slicehost has some detailed instructions for configuring Configuring Rails on Ubuntu using Capistrano and Deprec. The instructions pretty much worked out of the box for me.

RailsCamp 2.0

Wednesday, November 21st, 2007

RailsCamp is on this weekend. 40 uber-geeks gathered to immerse themselves in Ruby On Rails.
It should be pretty cool.

I haven’t prepared any materials, but might present something on Amazon Web Services - I did this for the Melbourne Ruby User Group a little while ago.

New York, New York

Monday, November 12th, 2007

I’ve been living in Melbourne for 7 years now, and I have decidely itchy feet.

I moved to Melbourne for work just after the dot-com crash of 2000 and it was always meant to be a temporary stop on my way to New York, which I visited and fell in love with.

I think it’s time to get that dream moving again.

I am happy to work remotely to get a foot in the door, if that suits. Happy to sign up for a short-term contract if it gets me to your fair city.

So, if you’re in New York and need a developer with lots of experience, expert skills in Java, PHP and Ruby, and a penchant for user experience, drop me a line.

Now Hiring!

Tuesday, October 2nd, 2007

Been very swamped with contract work, but I have managed to roll a Facebook App called Now Hiring into production for Taleo.

I had a list of updates, but the blog died a horrible and fatal death, and I can’t for the life of me remember what they where.

Except pagination in Rails with will_paginate is so good it’s terribly terribly frightening

Mock testing with mocha

Wednesday, September 12th, 2007

Mocha is a library designed to let you mock objects in your test environment. It’s very useful for testing around external dependencies

Inside one of my controllers I am calling a SOAP Service:

message_result = SOAPService.send_message(message)

This leaves me with a problem in my functional test - external dependencies are not conduive to self-contained test. Enter Mocha to the rescue!

Mocha lets me create a stub for a method on any instance of my object. This means that I can intercept the calls in my test, without needing to touch the code inside my controller.

SOAPService.any_instance.stubs(:send_message).returns( MessageResult.new )
get :respond
assert_match(/1<\/status>/, @response.body)

The get :respond call above would normally invoke a SOAP call, but using any_instance.stubs(:send_message).returns( MessageResult.new ) means that the SOAPService.send_message method now will return a new MessageResult. My controller doesn’t care and now my functional test is tight and focussed, and tests the controller logic without the external dependency being a factor.

Did you find this Ruby on Rails article useful? Why not recommend Toby at Working With Rails?

RailsRumble: distro decisions decisions

Friday, September 7th, 2007

I received my Linode account for the Rails Rumble.

I logged in and the first thing I have to do is pick the Linux distro I want to install and use for the Rumble.

There are far too many options!

The available distros are:

  • Arch 0.7.1
  • Debian 4.0 (Etch)
  • Finnix 86.1
  • Ubuntu 6.06
  • Ubuntu 7.04
  • CentOS 5.0 (RHEL rebuild)
  • Fedora Core 6 (FC6)
  • Slackware 12.0 (-new-)
  • Mandrake 9.1 (Bamboo)
  • Gentoo Linux 2006.1

I’m not really a systems person … I know my way around Linux, but I don’t have a whole lot of experience setting a machine up from scratch. I’ve been lucky that for the last several years I’ve worked with truly awesome sys admins who take care of all this stuff for us.

So what to use?

I am leaning toward Ubuntu 6.06 (Dapper Drake) because it looks like there are some good tutorials around (I even think the Peepcode guys have been using Ubuntu for some of their work - it might be time to subscribe).

Any ideas are appreciated. I am definitely going to learn a lot this weekend.

RailsRumble Notes - WoR! by self.Team

Saturday, September 1st, 2007

You can find all my notes for the RailsRumble in Backpack.

I changed my mind, I am going to keep my notes here in the blog.

Go self.Team!

self.Team

Wednesday, August 29th, 2007

I’ve registered for the RailsRumble as a one-person team called, cunningly: self.Team

See what I did there?

I am going to be building a game - a browser-based, AJAXified wargame loosely based on the Roll Out The Gun Barrels ruleset. I’ll be posting a few design ideas over the next week.