2011-12-13 21:48:25 +00:00
|
|
|
#! /usr/bin/env ruby
|
|
|
|
|
2011-12-14 13:04:16 +00:00
|
|
|
app_name = ENV['APP_NAME'] || 'rosa_build'
|
2011-12-13 21:48:25 +00:00
|
|
|
Bluepill.application(app_name) do |app|
|
|
|
|
app.uid = app.gid = 'rosa'
|
|
|
|
app.working_dir = "/srv/#{app_name}/current"
|
|
|
|
app.process("delayed_job") do |process|
|
|
|
|
process.start_grace_time = 10.seconds
|
|
|
|
process.stop_grace_time = 10.seconds
|
|
|
|
process.restart_grace_time = 10.seconds
|
|
|
|
|
2011-12-14 14:47:32 +00:00
|
|
|
process.start_command = "/usr/bin/env RAILS_ENV=production script/delayed_job start"
|
|
|
|
process.stop_command = "/usr/bin/env RAILS_ENV=production script/delayed_job stop"
|
2011-12-14 12:34:44 +00:00
|
|
|
process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'delayed_job.pid')
|
2011-12-13 21:48:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
app.process("unicorn") do |process|
|
|
|
|
process.start_grace_time = 8.seconds
|
|
|
|
process.stop_grace_time = 5.seconds
|
|
|
|
process.restart_grace_time = 13.seconds
|
|
|
|
|
2011-12-14 13:24:58 +00:00
|
|
|
process.start_command = "bundle exec unicorn -l /tmp/#{app_name}_unicorn.sock -E production -c config/unicorn.rb -D"
|
2011-12-13 21:48:25 +00:00
|
|
|
process.stop_command = "kill -QUIT {{PID}}"
|
|
|
|
process.restart_command = "kill -USR2 {{PID}}"
|
2011-12-14 12:34:44 +00:00
|
|
|
process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'unicorn.pid')
|
2011-12-13 21:48:25 +00:00
|
|
|
|
|
|
|
process.monitor_children do |child_process|
|
|
|
|
child_process.stop_command = "kill -QUIT {{PID}}"
|
|
|
|
|
|
|
|
child_process.checks :mem_usage, :every => 10.seconds, :below => 150.megabytes, :times => [3,4], :fires => :stop
|
|
|
|
child_process.checks :cpu_usage, :every => 10.seconds, :below => 20, :times => [3,4], :fires => :stop
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|