Sha256: 30694cd20dfb7893f7fb01c6e94ae46d92e7ccd5f8326b765856df2be475f11f

Contents?: true

Size: 1.47 KB

Versions: 66

Compression:

Stored size: 1.47 KB

Contents

# run with:  god -c /path/to/gravatar.god
# 
# This is the actual config file used to keep the mongrels of
# gravatar.com running.

RAILS_ROOT = "/Users/tom/dev/gravatar2"

%w{8200 8201 8202}.each do |port|
  God.watch do |w|
    w.name = "gravatar2-mongrel-#{port}"
    w.interval = 30.seconds # default      
    w.start = "mongrel_rails start -c #{RAILS_ROOT} -p #{port} \
      -P #{RAILS_ROOT}/log/mongrel.#{port}.pid  -d"
    w.stop = "mongrel_rails stop -P #{RAILS_ROOT}/log/mongrel.#{port}.pid"
    w.restart = "mongrel_rails restart -P #{RAILS_ROOT}/log/mongrel.#{port}.pid"
    w.start_grace = 10.seconds
    w.restart_grace = 10.seconds
    w.pid_file = File.join(RAILS_ROOT, "log/mongrel.#{port}.pid")
    
    w.behavior(:clean_pid_file)

    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 = 150.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
    
    # lifecycle
    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
end

Version data entries

66 entries across 66 versions & 20 rubygems

Version Path
mojombo-god-0.7.11 examples/gravatar.god
mojombo-god-0.7.12 examples/gravatar.god
mojombo-god-0.7.13 examples/gravatar.god
mojombo-god-0.7.14 examples/gravatar.god
mojombo-god-0.7.15 examples/gravatar.god
mojombo-god-0.7.16 examples/gravatar.god
mojombo-god-0.7.20 examples/gravatar.god
mojombo-god-0.7.7 examples/gravatar.god
mojombo-god-0.7.9 examples/gravatar.god
obitum-god-0.7.14.1 examples/gravatar.god
obitum-god-0.7.14 examples/gravatar.god
pjhyett-god-0.7.12 examples/gravatar.god
relevance-god-0.7.12.1 examples/gravatar.god
relevance-god-0.7.12 examples/gravatar.god
saimonmoore-god-0.7.9 examples/gravatar.god
samhendley-god-0.7.13 examples/gravatar.god
strobemonkey-god-0.7.13 examples/gravatar.god
god-0.9.0 examples/gravatar.god
olgen-god-0.9.2 examples/gravatar.god
olgen-god-0.9.1 examples/gravatar.god