we need to restart things if they go too crazy
This commit is contained in:
parent
8c771f7efb
commit
083193ca9d
@ -1,12 +1,21 @@
|
|||||||
<% engine.procfile.entries.each do |process| %>
|
<% engine.procfile.entries.each do |process| %>
|
||||||
<% 1.upto(concurrency[process.name]) do |num| %>
|
<% 1.upto(concurrency[process.name]) do |num| %>
|
||||||
|
<% p process.name %>
|
||||||
God.watch do |w|
|
God.watch do |w|
|
||||||
w.name = "<%= "#{process.name}-#{num}" %>"
|
w.name = "<%= "#{process.name}-#{num}" %>"
|
||||||
w.start = "<%= process.command %>"
|
w.start = "<%= process.command %>"
|
||||||
|
w.env = { 'RAILS_ENV' => <%= ENV['RAILS_ENV'] %> }
|
||||||
w.keepalive
|
w.keepalive
|
||||||
w.group = "<%= app %>"
|
w.group = "<%= app %>"
|
||||||
w.dir = "<%= engine.directory %>"
|
w.dir = "<%= engine.directory %>"
|
||||||
<%= extension(process.name) %>
|
<%= 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 %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
19
data/templates/extensions/delayed_job.god.erb
Normal file
19
data/templates/extensions/delayed_job.god.erb
Normal 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
|
Loading…
Reference in New Issue
Block a user