2011-10-25 23:30:39 +01:00
|
|
|
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
|
2011-12-06 14:45:20 +00:00
|
|
|
set :rvm_type, :user
|
2011-03-28 16:49:22 +01:00
|
|
|
require 'rvm/capistrano'
|
2011-10-25 23:30:39 +01:00
|
|
|
require 'bundler/capistrano'
|
2011-12-06 14:45:20 +00:00
|
|
|
require 'delayed/recipes'
|
2011-10-25 23:30:39 +01:00
|
|
|
require 'airbrake/capistrano'
|
2011-10-31 17:50:45 +00:00
|
|
|
set :whenever_command, "bundle exec whenever"
|
2011-12-06 22:21:08 +00:00
|
|
|
# require "whenever/capistrano"
|
2011-10-31 17:50:45 +00:00
|
|
|
|
2011-11-09 20:15:02 +00:00
|
|
|
set :default_stage, "staging"
|
2011-12-06 14:45:20 +00:00
|
|
|
# set :stages, %w(production staging pingwinsoft ui) # auto readed
|
2011-11-09 20:15:02 +00:00
|
|
|
require 'capistrano/ext/multistage'
|
|
|
|
|
2011-03-28 16:49:22 +01:00
|
|
|
# main details
|
2011-09-29 14:24:33 +01:00
|
|
|
ssh_options[:forward_agent] = true
|
2011-12-06 14:52:31 +00:00
|
|
|
default_run_options[:pty] = true
|
2011-10-25 23:30:39 +01:00
|
|
|
|
2011-03-28 16:49:22 +01:00
|
|
|
set :application, "rosa_build"
|
2011-12-06 18:35:19 +00:00
|
|
|
set(:deploy_to) { "/srv/#{application}" }
|
2011-12-06 14:45:20 +00:00
|
|
|
set :user, "rosa"
|
|
|
|
set :use_sudo, false
|
|
|
|
set :keep_releases, 3
|
2011-03-28 16:49:22 +01:00
|
|
|
|
2011-10-25 23:30:39 +01:00
|
|
|
set :repository, "git@github.com:warpc/rosa-build.git"
|
|
|
|
# set :git_shallow_clone, 1
|
2011-03-28 16:49:22 +01:00
|
|
|
set :scm, "git"
|
2011-11-18 12:50:06 +00:00
|
|
|
# set :deploy_via, :copy
|
|
|
|
# set :copy_cache, true
|
2011-03-28 16:49:22 +01:00
|
|
|
|
2011-12-06 14:45:20 +00:00
|
|
|
require 'lib/recipes/nginx'
|
2011-12-06 18:35:19 +00:00
|
|
|
require 'lib/recipes/unicorn'
|
2011-12-13 21:48:25 +00:00
|
|
|
require 'lib/recipes/bluepill'
|
2011-03-28 16:49:22 +01:00
|
|
|
namespace :deploy do
|
2011-12-06 14:45:20 +00:00
|
|
|
# task :restart, :roles => :app, :except => { :no_release => true } do
|
|
|
|
# run "touch #{current_release}/tmp/restart.txt"
|
|
|
|
# end
|
|
|
|
|
|
|
|
task :stub_xml_rpc do
|
2011-12-06 18:35:19 +00:00
|
|
|
path = File.join(release_path, 'config', 'environment.rb')
|
2011-12-06 14:45:20 +00:00
|
|
|
code = %Q{\nrequire 'stub_xml_rpc'\n}
|
|
|
|
puts "Stub XML RPC"
|
|
|
|
run %Q{echo "#{code}" >> #{path}}
|
2011-03-28 16:49:22 +01:00
|
|
|
end
|
|
|
|
|
2011-12-06 18:35:19 +00:00
|
|
|
task :symlink_all, :roles => :web do
|
2011-12-06 19:33:35 +00:00
|
|
|
run "mkdir -p #{fetch :shared_path}/config"
|
|
|
|
run "cp -n #{fetch :release_path}/config/database.yml.sample #{fetch :shared_path}/config/database.yml"
|
|
|
|
run "cp -n #{fetch :release_path}/config/application.yml.sample #{fetch :shared_path}/config/application.yml"
|
2011-12-06 18:35:19 +00:00
|
|
|
run "ln -nfs #{fetch :shared_path}/config/database.yml #{fetch :release_path}/config/database.yml"
|
|
|
|
run "ln -nfs #{fetch :shared_path}/config/application.yml #{fetch :release_path}/config/application.yml"
|
2011-12-06 14:45:20 +00:00
|
|
|
|
2011-12-06 19:33:35 +00:00
|
|
|
run "mkdir -p #{fetch :shared_path}/downloads"
|
2011-12-06 18:35:19 +00:00
|
|
|
run "ln -nfs #{fetch :shared_path}/downloads/ #{fetch :release_path}/public/downloads"
|
2011-03-29 17:35:42 +01:00
|
|
|
end
|
2011-03-29 18:06:21 +01:00
|
|
|
end
|
2011-11-29 22:23:09 +00:00
|
|
|
|
2011-12-06 18:35:19 +00:00
|
|
|
after "deploy:update_code", "deploy:symlink_all", "deploy:migrate"
|
2011-12-13 21:48:25 +00:00
|
|
|
after "deploy:update", "bluepill:quit", "bluepill:start"
|
2011-12-06 14:45:20 +00:00
|
|
|
after "deploy:restart", "delayed_job:restart", "deploy:cleanup"
|
2011-12-06 18:35:19 +00:00
|
|
|
|
|
|
|
require 'cape'
|
|
|
|
namespace :rake_tasks do
|
|
|
|
Cape do
|
|
|
|
# mirror_rake_tasks
|
|
|
|
mirror_rake_tasks 'db:seeds'
|
|
|
|
end
|
|
|
|
end
|