// Richard Hart / Hates_

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, "yourdomain@yourdomain.com"

  set :user, "yourdomain"
  set :repository, "git@github.com:youraccount/yourdomain.git"

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

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

  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"
    end

  end

Now invoking Vlad for my staging environment works as such:

  >> rake staging vlad:deploy
2 comments
  1. Vidar says: September 16, 20096:19 pm

    When migrating from vlad 1.4 to 2.0 I got a similar problem but a different message than you:

    $ rake vlad:deploy
    rake aborted!
    Don’t know how to build task ‘vlad:deploy’

    To make it work, I had to uninstall the 1.4 gem, change the Vlad.load :app => nil, :scm => :git to Vlad.load :scm => :git

    Since Passenger is default in 2.0 and I removed the :app => nil above, I got to remove the redefining task
    remote_task :start_app, :roles => :app do
    run “touch #{current_release}/tmp/restart.txt”
    end

    since passenger is restarted automatically making the deploy file a bit cleaner :) Thanks for letting me onto the solution!

  2. [...] to Richard Hart, through whom I found the solution. Like it? Share [...]

Submit comment