Skip to content

Instantly share code, notes, and snippets.

@vinibaggio
Created December 3, 2009 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vinibaggio/248246 to your computer and use it in GitHub Desktop.
Save vinibaggio/248246 to your computer and use it in GitHub Desktop.
require 'capistrano/ext/multistage'
set :application, "minha_app"
set :repository, "meu_repositorio"
set :scm, :git
set :use_sudo, false
set :ssh_options, { :forward_agent => true }
# Asset packager
namespace :deploy do
desc "Create asset packages for production"
task :after_update_code, :roles => [:web] do
run <<-EOF
cd #{release_path} && #{rake_path} asset:packager:build_all
EOF
end
end
# copy shared files after update
task :update_config, :roles => :app do
run "cp -Rf #{shared_path}/config/database.yml #{release_path}/config/"
end
after "deploy:update_code", :update_config
# mod_rails (phusion_passenger) stuff
namespace :deploy do
desc "Restart Application"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "start/stop is not necessary with mod_rails"
task t, :roles => :app do
# nothing
end
end
end
set :domain, "meu_dominio.com"
set :user, "meu_user"
set :deploy_to, "/home/meu_site/rails_apps/minha_app"
server domain, :app, :web
role :db, domain, :primary => true
set :deploy_via, :copy
set :copy_compression, :bzip2
set :copy_cache, true
set :copy_cache, "/tmp/caches/minha_app"
set :copy_exclude, [".git/*"]
set :rake_path, "meu_rake_que_nao_eh_do_env_do_rails"
# Add locaweb specific paths
task :update_environment, :roles => :app do
run "cp #{shared_path}/config/environment.rb #{release_path}/config/"
end
after "deploy:update_code", :update_environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment