Created
December 25, 2013 01:24
-
-
Save jtomaszewski/8119378 to your computer and use it in GitHub Desktop.
Watch websocket_rails server with God
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RAILS_ROOT = File.expand_path('../', File.dirname(__FILE__)) | |
RAILS_ENV = ENV['RAILS_ENV'] || 'production' | |
God.watch do |w| | |
w.name = "websocket_rails" | |
w.start = "cd #{RAILS_ROOT} && bundle exec rake websocket_rails:start_server" | |
w.stop = "cd #{RAILS_ROOT} && bundle exec rake websocket_rails:stop_server" | |
w.pid_file = "#{RAILS_ROOT}/tmp/pids/websocket_rails.pid" | |
w.behavior(:clean_pid_file) | |
# w.keepalive | |
w.log = "#{RAILS_ROOT}/log/god.log" | |
w.start_if do |start| | |
start.condition(:process_running) do |c| | |
c.interval = 30.seconds | |
c.running = false | |
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