Skip to content

Commit

Permalink
Merge pull request #63 from dlackty/god-example
Browse files Browse the repository at this point in the history
Add god example configuration file.
  • Loading branch information
nevans committed Oct 23, 2012
2 parents 61ba598 + 17f8fc8 commit 96218b2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/resque-pool.god
@@ -0,0 +1,43 @@
rails_env = ENV['RAILS_ENV'] || 'production'
rails_root = ENV['RAILS_ROOT'] || "YOUR-APP-PATH"

God.watch do |w|
w.dir = "#{rails_root}"
w.name = "resque-pool"
w.group = 'resque'
w.interval = 30.seconds
w.env = { "RAILS_ENV" => rails_env }
w.start = "bundle exec resque-pool -d -o #{rails_root}/log/resque-pool.stdout -e #{rails_root}/log/resque-pool.stderr -p #{rails_root}/tmp/pids/resque-pool.pid"

w.pid_file = "#{rails_root}/tmp/pids/resque-pool.pid"
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
c.interval = 5.seconds
end

# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
c.interval = 5.seconds
end
end

# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_running) do |c|
c.running = false
end
end
end

0 comments on commit 96218b2

Please sign in to comment.