stop double loading, dont start drb server in tests
[god.git] / examples / gravatar.god
blob0d7492df0dd403b6d0cca9f80aefbe60593b53aa
1 # This is the actual config file used to keep the mongrels of
2 # gravatar.com running.
4 RAILS_ROOT = "/var/www/gravatar2/current"
6 God.meddle do |god|
7   god.interval = 30 # seconds
9   %w{8200 8201 8202}.each do |port|
10     god.watch do |w|
11       w.name = "gravatar2-mongrel-#{port}"
12       w.cwd = RAILS_ROOT
13       w.start = "mongrel_rails cluster::start --only #{port}"
14       w.stop = "mongrel_rails cluster::stop --only #{port}"
15       
16       pid_file = File.join(RAILS_ROOT, "log/mongrel.#{port}.pid")
18       w.start_if do |start|
19         start.condition(:process_not_running) do |c|
20           c.pid_file = pid_file
21         end
22       end
23       
24       w.restart_if do |restart|
25         restart.condition(:memory_usage) do |c|
26           c.pid_file = pid_file
27           c.above = (150 * 1024) # 150mb
28           c.times = [3, 5] # 3 out of 5 intervals
29         end
30       
31         restart.condition(:cpu_usage) do |c|
32           c.pid_file = pid_file
33           c.above = 50 # percent
34           c.times = 5
35         end
36       end
37     end
38   end
39 end