Richard Hart

Head of Something @ Somewhere
Kent, UK

My Music
My Photos


Vlad 2.0 Not Finding Tasks in deploy.rb

When I restalled all my gems on Snow Leopard, vlad refused to find any of the tasks I had defined in my deploy.rb. I thought this was a SL issue but turned out a week before it’s release Vlad had been updated to version 2 which used a new plugin system. Looking for vlad rake tasks returned an error:

 >> rake -T vlad
  Could not load vlad: no such file to load -- vlad/git

To solve the problem just required an install of the new vlad-git gem.

 >> sudo gem install vlad-git

Now all my tasks were appearing properly. Vlad 2 always brought around a few changes in it’s deploy.rb and use. Here is my deploy.rb for reference:

 set :application, "yourdomain"
  set :domain, ""

  set :user, "yourdomain"
  set :repository, ""

  task :staging do
    set :revision, "origin/staging"
    set :deploy_to, "/opt/yourdomain.staging/"  

  task :production do
    set :revision, "origin/master"
    set :deploy_to, "/opt/yourdomain/"  

  namespace :vlad do

    desc "Pull from git, run migrations, then (re)start the app server"
    task :migrate_deploy => [:update, :migrate, :start_app]
    desc "Pull from git then (re)start the app server"
    task :deploy => [:update, :start_app]
    desc 'Restart Passenger'
    remote_task :restart do
      puts "Touching: #{deploy_to}current/tmp/restart.txt"
      run "touch #{deploy_to}/current/tmp/restart.txt"

Now invoking Vlad for my staging environment works as such:

>> rake staging vlad:deploy