we need to restart things if they go too crazy

This commit is contained in:
John Bintz 2014-02-01 19:19:16 -05:00
parent 8c771f7efb
commit 083193ca9d
2 changed files with 28 additions and 0 deletions

View File

@ -1,12 +1,21 @@
<% engine.procfile.entries.each do |process| %>
<% 1.upto(concurrency[process.name]) do |num| %>
<% p process.name %>
God.watch do |w|
w.name = "<%= "#{process.name}-#{num}" %>"
w.start = "<%= process.command %>"
w.env = { 'RAILS_ENV' => <%= ENV['RAILS_ENV'] %> }
w.keepalive
w.group = "<%= app %>"
w.dir = "<%= engine.directory %>"
<%= extension(process.name) %>
w.restart_if do |restart|
restart.condition(:memory_usage) do |c|
c.above = 500.megabytes
c.times = [5, 10] # 3 out of 5 intervals
end
end
end
<% end %>
<% end %>

View File

@ -0,0 +1,19 @@
# delayed_job specific
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
w.restart_if do |restart|
restart.condition(:memory_usage) do |c|
c.above = 300.megabytes
c.times = [3, 5] # 3 out of 5 intervals
end
restart.condition(:cpu_usage) do |c|
c.above = 50.percent
c.times = 5
end
end