Trying out Vlad the Deployer 26 Jan 2008
This blog wasn’t using any form of automated deployment until late last night. For the longest time rsync and ssh seemed to be adequate enough even though I’m familiar with “Capistrano”: and had been well aware of “Vlad the Deployer’s”: release. Since I know about Capistrano I decided to invest some time getting to know Vlad.

This site is currently running on a 0.7.3 “Mephisto”: installation with a custom theme by yours truly and it’s hosted on “Dreamhost”: servers. Out of the box Vlad works with mongrel+apache+svn. Unfortunately Dreamhost uses apache+fastcgi, but thankfully tweaking Vlad was a piece of cake.

I followed the instructions on the “examples”: page for Vlad, but ultimately found I needed to do a little tweaking for my environment. Based on those basic examples I ended up making the following changes to my Rakefile and deploy.rb recipe file.

Here’s what I appended to my Rakefile:

# appended to my Rakefile
require 'vlad'
Vlad.load(:app => :apache)

Here’s my config/deploy.rb file:

set :domain,      ""
set :deploy_to,   "/my/path/to/"
set :repository,  "http://myserver/svn/"
set :web_command, "echo skipping web "

namespace :vlad do
  remote_task :start_app do
    run "pkill -f dispatch.fcgi"
    fork do
      puts "sending a request to the domain so dispatchers restart"
      `wget http://#{domain} -O /dev/null`

  remote_task :update do

  remote_task :after_update do
    run "ln -s #{deploy_to}/shared/system/database.yml #{deploy_to}/current/config/database.yml"
    run "rm -f /home/zdennis/ &&
         ln -s #{deploy_to}/current /home/zdennis/"      

  remote_task :deploy => [:update, :start_app]

I overrode the :web_command setting so Vlad didn’t try to restart apache. The other tasks were added to customize specific needs for the deployment of the blog:

  • :start_app - kill all of dispatchers on Dreamhost and then send a request to have Dreamhost launch new ones
  • :update - adds this task to the :update task call chain. This simulates an after_update.
  • :after_update - create symlinks, etc to be performed after code has been updated.
  • :deploy - update code and restart the app

Overall, it was a pleasant process. I give Vlad a +1.

blog comments powered by Disqus