rosa-build/config/production.pill

35 lines
1.4 KiB
Plaintext
Raw Normal View History

#! /usr/bin/env ruby
app_name = ENV['APP_NAME'] rescue 'rosa_build'
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
process.start_command = "bundle exec script/delayed_job -e production start"
process.stop_command = "bundle exec script/delayed_job -e production stop"
process.pid_file = File.join('tmp', 'pids', 'delayed_job.pid')
end
app.process("unicorn") do |process|
process.start_grace_time = 8.seconds
process.stop_grace_time = 5.seconds
process.restart_grace_time = 13.seconds
process.start_command = "bundle exec unicorn -l /tmp/#{app_name}_unicorn.sock -c config/unicorn.rb -D"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.pid_file = File.join('tmp', 'pids', 'unicorn.pid')
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