Skip to content

Instantly share code, notes, and snippets.

@adambyrtek
Created June 8, 2009 15:39
Show Gist options
  • Save adambyrtek/125883 to your computer and use it in GitHub Desktop.
Save adambyrtek/125883 to your computer and use it in GitHub Desktop.
Capistrano recipe to deploy a simple Rails app with frozen gems from a given repository tag
set :application, "foobar"
set :deploy_to, "/home/deployer/foobar"
set :user, "deployer"
set :use_sudo, false
set :deploy_via, :export
set :repository do
fail "Provide TAG environment variable to select tag to deploy from." if ENV['TAG'].nil?
"https://svn.example.com/#{application}/tags/" + ENV['TAG']
end
server "app.example.com", :app, :web, :db, :primary => true
namespace :deploy do
task :default, :roles => :app do
# Always deploy with migrations by default
migrations
end
task :after_update_code, :roles => :app do
# Copy configuration
run "ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
# Build native gems
run "cd #{release_path} && rake gems:build"
end
task :restart, :roles => :app do
# Passenger restart
run "touch #{current_path}/tmp/restart.txt"
end
task :start, :roles => :app do
restart
end
task :stop, :roles => :app do
# Nothing to do for Passenger
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment