Feb Ruby Meeting Report - Capistrano and Starfish

I came to the meeting knowing a bit about capistrano and nothing about starfish and left with a firms grasp of basic concepts of both!
In short:

  • Capistrano - A tool for deploying actions on multiple servers. Not necessarily for Rails and you don’t need Ruby on the deployment servers! Presented by Michael H Buselli
  • Starfish - Distributed programming in Ruby. Presented by Peter Chan

In Long(er):

Capistrano
Like Rails, this tool relies on convention over configuration and makes some assumptions about your environment such as Rails, Subversion, Apache 1.x and FastCGI. Of course you can override some of these assumptions and even use it with PHP and CVS (yikes). Future versions will be completely separate from Rails. I know people who stiffen at any mention of Rails, but really.. this is how tools are born, out of a need. This one so happened to be a need by Rails developers and thus it makes sense it would be naturally easier to use to deploy a rails site.
Commands
The basic commands are run, sudo (run as root), put, delete, render (returns output from erb template) and get. In addition you can add your own commands.

Tasks:
You group commands similar to a batch file or shell script. And interesting thing is if your task is called “say_hello” … you can also have a task “before_say_hello” and “after_say_hello” that will run before and after respectively. This might be useful for making “changes” to some of the standard tasks that will do any preparation or cleanup without having to hack the code. The question was asked if you could call “before_before_say_hello” and yes, recursive calls that that do work..though I think it could get pretty confusing!

Roles:
Machines are grouped by roles, such as “web”, “db” and you can have multiple machines in those roles. The db role is unique in that you specify one as primary, because thats where the migrations are run (then I’m guessing that the database is just copied to the other database servers?).
Putting them together:
You can specify on the tasks which machine role it is to be used for such as:

task :say_hello_to_webservers, :roles => :web do
run ‘echo “hello world” ‘
end

Anyways thats the basics as I understood. Please correct me if I am off base.
Link to presentation and resources: http://www.cosinewave.net/ruby/cap

Here’s a blog posting that describes how to use Capistrano with Perl or PHP which I bookmarked some time ago, it may be a little out of date but probably has some good information still.

Then we had a brief moment of fun as we watched this (which is no joke!)

Erlang - http://tinyurl.com/ytgp27


Starfish
This was interesting as I have never done distributed programming or had a need too, but I’m always wondering how things work. The presenter said that he thinks this is one of Google’s secret weapons in making things load faster.
The starfish file consists of two sections — the server and the client. The server section describes the process and the client section describes the output. Once that is set, you run the starfish program and the first time you run it, it starts a client and a server. To start another process, run the starfish command again and this time it sees there’s a server already started and then just starts up another client.
ex:
starfish find_primes.rb #starts server, client
starfish find_primes.rb #sttarts another client
Pretty neat, I had to leave before the end of this talk since I have such a long commute home but I got the jist of what starfish was and know where to look if I need distributed programming in the future!

Links to his demo files: http://oaktop.com/go/starfish/

Live in Chicago? Join Chirb, the Chicago Ruby group. Can’t make it downtown? There some individuals starting meetings in the burbs, join the mailing list for details!

Leave a Comment