-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdeploy.rb.tmp
More file actions
63 lines (51 loc) · 2.13 KB
/
deploy.rb.tmp
File metadata and controls
63 lines (51 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require 'bundler/capistrano'
set :application, "drug"
set :repository, "git://github.com/drugpl/drug-site.git"
set :deploy_to, "/srv/#{application}"
set :user, "#{application}"
set :scm, :git
set :bundle_without, %w(test development)
set :ssh_options, {:forward_agent => true}
set :keep_releases, 5
set :use_sudo, false
set :unicorn_binary, "unicorn"
set :unicorn_config, "#{current_path}/config/unicorn.rb"
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
set :branch, :master
server "drug", :app, :web, :db, :primary => true
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} bundle exec #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} kill `cat #{unicorn_pid}`"
end
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
end
task :reload, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
stop
start
end
task :link_configuration_files do
%w(unicorn.rb database.yml email.yml facebook.yml google_maps.yml).each do |file|
run "if [ -f #{deploy_to}/shared/#{file} ] ; then ln -sf #{deploy_to}/shared/#{file} #{latest_release}/config/; fi"
end
end
task :link_dotenv do
run "if [ -f #{deploy_to}/shared/.env.production ]; then ln -sf #{deploy_to}/shared/.env.production #{latest_release}; fi"
end
task :link_secret_token do
run "if [ -f #{deploy_to}/shared/secret_token.rb ] ; then ln -sf #{deploy_to}/shared/secret_token.rb #{latest_release}/config/initializers/; fi"
end
end
after "deploy:finalize_update", "deploy:link_configuration_files"
after "deploy:finalize_update", "deploy:link_secret_token"
after "deploy:finalize_update", "deploy:link_dotenv"
after "deploy:finalize_update", "deploy:migrate"
after "deploy:restart", "deploy:cleanup"
require './config/boot'
require 'airbrake/capistrano'