Vlad the Deployer — Sample Recipe
Here’s a recipe I’m using right now for a site of mine. It really is this easy—once you figure out what goes where. Note that I did need to dig in to Vlad and patch an issue or two (mongrel variables and web_command) but I’m told a fix is on the way.
My favorite part is the custom symlink_assets
and deploy
tasks to get around the lack of Capistrano style “after” hooks. It’s just so natural and Rake-tastic!
Rakefile (excerpt)
require 'vlad'
Vlad.load 'config/deploy.rb'
deploy.rb
set :application, "appname"
set :domain, "appname.example"
set :deploy_to, "/var/www/apps/#{application}"
set :repository, "svn+ssh://#{domain}#{deploy_to}/repos/trunk"
set :mongrel_port, 8020
set :web_command, "sudo /usr/local/apache2/bin/apachectl"
set :public_assets, %w(image_assets)
namespace :vlad do
remote_task :symlink_assets do
run public_assets.collect do |asset|
"ln -s #{shared_path}/public/#{asset} #{current_release}/public"
end.join(" && ")
end
remote_task :deploy => [
:update, :symlink_assets, :migrate, :start_app
]
end