Capistrano Tip'n'Trick

May 3rd, 2008

If like me you didn’t know, you can do that with Capistrano:

1
2
$ cap HOSTS=web0.myapp.com deploy:update_code
cap ROLES=web,app deploy

Not terribly useful for the tasks demonstrated above, but what about this ?

1
$ cap ROLES=app monit:summary

Incidentally, where are these documented ? I dimly remembered reading this somewhere once, and tried it. Works like a charm!

Even though Capistrano “tags” each release by creating a new folder on the production server(s), it might be interesting to have a historical perspective in your repository anyway.

This makes it easier to know exactly what went up for a release.

I would like to share the following Capistrano recipe for your pleasure:

1
2
3
4
5
6
7
8
require 'uri'
task :after_deploy do
  source = repository
  dest = URI.parse(repository).merge("../releases/#{File.basename(release_path)}")
  cmd = "svn copy --revision=#{revision} --quiet --message \"Auto tagging release #{release_path}\" #{source} #{dest}"
  puts cmd
  `#{cmd}`
end

First, we start by requiring uri, because Subversion does not like relative URLs.

Next, we find the location into which to tag the release, and finally, we just do it.

Simple, effective.

Enjoy !

 

Search

A picture of me

I am François Beausoleil, a Ruby on Rails coder. During the day, I work on XLsuite. At night, I am interested many things. Read my biography

Tags

(3) (1) (0) (2) (1) (1) (2) (2) (1) (2) (1) (2) (1) (2) (1) (1) (1) (1) (2) (14) (1) (1) (1) (1) (2) (1) (1) (2) (0) (1) (2) (1) (3) (1) (1) (1) (1) (1) (1) (0) (3) (2) (1) (2) (2) (1) (3) (2) (8) (8) (9) (12) (1) (1) (3) (1) (1) (1) (1) (1) (1) (2) (2) (2) (1) (1) (3) (1) (3) (1) (0) (21) (1) (1) (0) (1) (1) (1) (21) (23) (1) (1) (13) (1) (1) (2) (3) (1) (1) (4) (1) (2) (3) (0) (1) (7) (3) (1) (5) (5) (2) (2) (2) (4) (6) (7) (1) (0) (1) (1) (2) (2) (1) (4) (12) (2) (1) (2) (4) (1) (1) (1) (2) (8) (2) (3) (2) (2) (1) (3) (1) (1)

Links

Projects I work on

Categories

Archives