capistrano changes

This commit is contained in:
jomo
2015-03-23 00:50:13 +01:00
parent b1e32fdedd
commit 2237a5f510
7 changed files with 109 additions and 150 deletions
+23 -12
View File
@@ -1,15 +1,26 @@
root = "/home/www-data/apps/redstoner/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.log"
stdout_path "#{root}/log/unicorn.log"
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
listen "/tmp/unicorn.redstoner.sock"
worker_processes 2
timeout 30
# Force the bundler gemfile environment variable to
# reference the capistrano "current" symlink
before_exec do |_|
ENV["BUNDLE_GEMFILE"] = File.join(root, 'Gemfile')
stderr_path "/home/www-data/apps/redstoner/shared/log/unicorn.stderr.log"
stdout_path "/home/www-data/apps/redstoner/shared/log/unicorn.stdout.log"
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end