Monday, August 24, 2009

Deploying (almost) with Vlad

‹prev | My Chain | next›

With my "unpublished" code changes done, I would like to deploy them to the beta site. I could update the code by logging into the server and checking out the changes, but something more repeatable, without needing to log into the server is preferable.

I opt to use Vlad the Deployer because it was recently updated to version 2. Besides, I already use Capistrano at the day job. I end up regretting the choice after struggling with the setup.

Following Graham Ashton's instructions for deploying Sinatra applications with vlad, I install vlad:
gem install vlad
Then I update my Rakefile to include:
require "vlad"
Vlad.load(:app => nil, :scm => "git")
rescue LoadError
# do nothing
And create config/deploy.rb with the following:
set :application, "eeecooks"
set :repository, "git://"
set :deploy_to, "/var/www/#{application}"
set :domain, ""
The next step should be to run rake vlad:setup, but, when I do, I get this output:
cstrom@jaynestown:~/repos/eee-code$ rake vlad:setup
(in /home/cstrom/repos/eee-code)
rake aborted!
Please specify the server domain via the :domain variable

(See full trace by running task with --trace)
Wha!? The :domain is clearly set in my deploy.rb. What's going on there? Even the debug task is screwy:
cstrom@jaynestown:~/repos/eee-code$ rake vlad:debug
(in /home/cstrom/repos/eee-code)
rake aborted!
Please specify the deploy path via the :deploy_to variable

(See full trace by running task with --trace)
After more time than I can to admit, I finally realize that Git support has been removed from vlad core. After installing vlad-git via gem install vlad-git, the vlad setup works as desired:
cstrom@jaynestown:~/repos/eee-code$ rake vlad:setup                # Setup your servers.
(in /home/cstrom/repos/eee-code)'s password:
And on the beta server:
sh-3.2$ find /var/www/eeecooks/
I am also able to verify that the vlad:update task is working:
cstrom@jaynestown:~/repos/eee-code$ rake vlad:update
(in /home/cstrom/repos/eee-code)'s password:
Initialized empty Git repository in /var/www/eeecooks/scm/repo/.git/
Switched to a new branch 'deployed-HEAD'
I still have to get this working with Thin, but that will have to wait until tomorrow.


  1. Thanks for the gem install vlad-git tip, you saved me some time too.

  2. Hey. Thanks for highlighting the new vlad-git gem. I'll update the original article when I get a spare moment.



  3. Graham - thanks for the original article, it was a tremendous help. Glad you found this post. I meant to follow up directly, but totally spaced.

  4. Thanks for the vlad-git tip, man, this was driving me crazy. Vlad really should put a better message for this, this one is completely misleading.

  5. Thanks for the tip! Initially, what you said didn't work for me, but after I reinstalled both vlad and vlad-git, it worked. I also uninstalled all my old versions of vlad.

  6. Oh yah guy - big thanks for the vlad-git hint.

  7. An additional tip if, like me, you are particularly stupid - don't forget to require 'vlad-git' in your Rakefire

    1. Hi Alex, to me require 'vlad-git' is not needed and it causes error. Just "require 'vlad'" is fine. (FYI: