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'
|
2012-06-06 15:36:13 +01:00
|
|
|
Bluepill.application(app_name, :log_file => "/srv/rosa_build/shared/log/bluepill.log") do |app|
|
2011-12-13 21:48:25 +00:00
|
|
|
app.uid = app.gid = 'rosa'
|
|
|
|
app.working_dir = "/srv/#{app_name}/current"
|
2012-06-06 15:36:13 +01:00
|
|
|
#%w(hook default).each do |queue|
|
|
|
|
# app.process("delayed_job_#{queue}_queue") do |process|
|
|
|
|
# process.start_grace_time = 10.seconds
|
|
|
|
# process.stop_grace_time = 10.seconds
|
|
|
|
# process.restart_grace_time = 10.seconds
|
|
|
|
|
|
|
|
# process.start_command = "/usr/bin/env ruby script/delayed_job --queue=#{queue} -p #{queue} --pid-dir=/srv/#{app_name}/current/tmp/#{queue}_pids start"
|
|
|
|
# process.stop_command = "/usr/bin/env ruby script/delayed_job --pid-dir=/srv/#{app_name}/current/tmp/#{queue}_pids stop"
|
|
|
|
# process.pid_file = File.join(app.working_dir, 'tmp', "#{queue}_pids", 'delayed_job.pid')
|
|
|
|
# end
|
|
|
|
#end
|
|
|
|
|
|
|
|
app.process("resque") do |process|
|
|
|
|
process.group = "resque"
|
|
|
|
pid_path = File.join(app.working_dir, 'tmp', 'pids', 'resque.pid')
|
2012-06-06 19:57:45 +01:00
|
|
|
process.start_command = "bundle exec rake resque:work QUEUE=fork_and_import PIDFILE=#{ pid_path } BACKGROUND=yes"
|
2012-06-06 15:36:13 +01:00
|
|
|
process.pid_file = pid_path
|
2011-12-13 21:48:25 +00:00
|
|
|
process.stop_command = "kill -QUIT {{PID}}"
|
2012-06-06 15:36:13 +01:00
|
|
|
process.daemonize = true
|
2011-12-13 21:48:25 +00:00
|
|
|
|
2012-06-06 15:36:13 +01:00
|
|
|
process.monitor_children do |c|
|
|
|
|
c.stop_command = "kill -USR1 {{PID}}" # TODO: Are we really need this?
|
|
|
|
c.checks :mem_usage, :every => 30.seconds, :below => 80.megabytes, :fires => :stop
|
|
|
|
c.checks :running_time, :every => 30.seconds, :below => 10.minutes, :fires => :stop
|
2011-12-13 21:48:25 +00:00
|
|
|
end
|
|
|
|
end
|
2012-06-06 15:36:13 +01:00
|
|
|
|
|
|
|
#app.process("newrelic") do |process|
|
|
|
|
# process.start_grace_time = 10.seconds
|
|
|
|
# process.stop_grace_time = 10.seconds
|
|
|
|
# process.restart_grace_time = 10.seconds
|
|
|
|
|
|
|
|
# path = File.join(app.working_dir, 'tmp', 'pids', 'newrelic.pid')
|
|
|
|
# process.start_command = "/usr/bin/env /usr/local/bin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p #{path}"
|
|
|
|
# process.pid_file = path
|
|
|
|
#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 -E production -c config/unicorn.rb -D"
|
|
|
|
# process.stop_command = "kill -QUIT {{PID}}"
|
|
|
|
# process.restart_command = "kill -USR2 {{PID}}"
|
|
|
|
# process.pid_file = File.join(app.working_dir, '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
|
2011-12-13 21:48:25 +00:00
|
|
|
end
|