Sha256: 4aa62245a62129970862f44b8b26d8f0495c1629a7717875ef5c6e975ba41555
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
# This example shows how you might keep a local development Rails server up # and running on your Mac. # Run with: # god -c /path/to/events.god RAILS_ROOT = "/Users/tom/dev/helloworld" God.watch do |w| w.name = "local-3000" w.interval = 5 # seconds w.start = "mongrel_rails start -P ./log/mongrel.pid -c #{RAILS_ROOT} -d" w.stop = "mongrel_rails stop -P ./log/mongrel.pid -c #{RAILS_ROOT}" w.pid_file = File.join(RAILS_ROOT, "log/mongrel.pid") # clean pid files before start if necessary w.behavior(:clean_pid_file) # determine the state on startup w.transition(:init, { true => :up, false => :start }) do |on| on.condition(:process_running) do |c| c.running = true end end # determine when process has finished starting w.transition([:start, :restart], :up) do |on| on.condition(:process_running) do |c| c.running = true end end # start if process is not running w.transition(:up, :start) do |on| on.condition(:process_exits) end # restart if memory or cpu is too high w.transition(:up, :restart) do |on| on.condition(:memory_usage) do |c| c.interval = 20 c.above = (50 * 1024) # 50mb c.times = [3, 5] end on.condition(:cpu_usage) do |c| c.interval = 10 c.above = 10 # percent c.times = [3, 5] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
god-0.3.0 | examples/events.god |
god-0.4.0 | examples/events.god |
god-0.4.1 | examples/events.god |
god-0.4.3 | examples/events.god |