Skip to content

Instantly share code, notes, and snippets.

@webchi
Created March 9, 2012 21:18
Show Gist options
  • Save webchi/2008751 to your computer and use it in GitHub Desktop.
Save webchi/2008751 to your computer and use it in GitHub Desktop.
Ultimate capistrano config file with rvm, bundle, git, passanger restart, symlink to databae.yml and db:migrate
# RVM
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.3@rails321'
set :rvm_type, :user # Copy the exact line. I really mean :user here
set :normalize_asset_timestamps, false # Убирает сёр ошибок со старыми папками жаваскрипта и имаджов
#Bundle
require "bundler/capistrano"
#Server settings
set :application, "docinout" #Name
server "host.com", :app, :web, :db, :primary => true #Our one server for all roles
set :user, "wwwuser"
set :use_sudo, false
set :deploy_to, "/home/#{user}/www/#{application}" #Where to deploy
#Repository settings
set :repository, "git://github.com/RailsApps/rails3-devise-rspec-cucumber.git"
set :scm, :git
after 'deploy:update_code', 'deploy:symlink_shared'
after "deploy", "deploy:migrate"
namespace :deploy do
desc "Symlinks the database.yml"
task :symlink_shared, :roles => :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment