Skip to content

Instantly share code, notes, and snippets.

@oleander
Created April 20, 2011 00:16
Show Gist options
  • Save oleander/930048 to your computer and use it in GitHub Desktop.
Save oleander/930048 to your computer and use it in GitHub Desktop.
RAILS_ROOT ||= File.expand_path("../..", __FILE__)
God.watch do |w|
w.name = "list_parser"
w.group = "movify"
w.interval = 30.seconds
w.dir = File.dirname(__FILE__)
w.env = {
"BUNDLE_GEMFILE" => "#{RAILS_ROOT}/Gemfile",
"RAILS_ENV" => "production",
"BEANSTALK_URL" => "beanstalk://127.0.0.1:54132"
}
w.start = "/usr/local/rvm/bin/webmaster_bundle exec stalk #{RAILS_ROOT}/config/jobs.rb"
# Delay for X seconds on start/stop
w.start_grace = 5.seconds
w.stop_grace = 5.seconds
w.uid = 'webmaster'
w.gid = 'webmaster'
# Monitoring:
w.start_if do |start|
start.condition(:process_running) { |c| c.running = false }
end
w.restart_if do |restart|
restart.condition(:memory_usage) do |c|
c.above = 200.megabytes
c.times = [3, 5]
end
restart.condition(:cpu_usage) do |c|
c.above = 95.percent
c.times = 5
end
end
w.lifecycle do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = 5
c.within = 5.minute
c.transition = :unmonitored
c.retry_in = 10.minutes
c.retry_times = 5
c.retry_within = 2.hours
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment