Vlad Debugging and Solutions

Vlad the Deployer is a well–written piece of software. It demonstrated that a realistic alternative to Capistrano is possible, with way less code. I’ve come to rely on it for a few projects and I like the design. There are times, however, when using Vlad can feel like pulling teeth.

This is another deployment–themed article about how to fix issues when using Vlad. If you’d like to read more about deployment, visit my agiledeployment tag.

SSH and All That

If you run ssh on a different port (or need other ssh options), put the relevant settings in .ssh/config. Here's an example:

host example.com
     Port 1999

Or, set it in your deploy file with ssh_flags:

  set :ssh_flags, ['-p 3123']

This will allow your colleagues to get the same settings as you (except for keys).

Debugging Broken Deploys

Vlad pays attention to Rake’s --trace flag. This is a key tool for debugging your deploy script.

The output is fairly clean, but it’s hard to break down those blocks of one–line && separated shell commands.

Other Gotchas

Look out for these gotchas:

  • Invalid permissions — you might need some chmod -R or chgrp
  • OS compatibility — I had problems with Solaris and git archive due to tar
  • Process restart issues — I use my own for Solaris/Mongrel/Apache, on Linux/Passenger Vlad’s standard stuff works well

OS Compatibility

Vlad usually refers to commands using variables, which means you can switch them out for others. You generally don’t need to, but I switched a few around for Solaris.

Here’s a full set of shell commands that you can switch:

  • :rake_cmd -- set to "rake"
  • :rsync_cmd -- set to "rsync"
  • :ssh_cmd -- set to "ssh"
  • :sudo_cmd -- set to "sudo"
  • :darcs_cmd -- set to "darcs"
  • :git_cmd -- set to "git"
  • :p4_cmd -- set to "p4"
  • :svn_cmd -- set to "svn"

Where’s my VCS?

Vlad supports a lot anyway, but if you wanted to add support for another version control system, it isn’t that hard:

  • Create a module
  • Add set :source, Vlad::WhateverVCS.new
  • Add checkout and export methods that take revision, destination parameters
  • Add a revision method that returns something sensible with revisions

Where’s Dry–Run?

Sadly Vlad doesn’t appear to like dry runs much. I’d like it to pay attention to --dry-run, but it doesn't. Simply echoing the shell commands it would have executed in a readable format would really help visualise what it's going to do.

Vlad’s Git Support Sucks

Vlad checks out an entire copy of your repository every time you deploy. This isn’t ideal because makes deployment take longer than a coffee break.

A friend of mine wrote a patch before they even supported git, but the seattle.rb guys use their own version. If you’d like to check out his fork, see git.rb or annealer.org.

On the Upside

If you’re having problems getting Vlad to behave, just remember:

  • Vlad relies on old friends like rsync and ssh, so if those work you’re almost there
  • Due to this, Vlad’s code can be understood very quickly. If you hit a problem don’t be afraid of reading the source
blog comments powered by Disqus