Created
March 21, 2015 08:39
Revisions
-
trkrameshkumar created this gist
Mar 21, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ RAILS_ROOT = File.expand_path('../', __dir__) def default_process_monitoring(w, w.name) # 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 c.notify = {:contacts => ['rameshkumar', 'developers'], :priority => 1, :category => "#{w.name}"} 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 c.notify = {:contacts => ['rameshkumar', 'developers'], :priority => 1, :category => "#{w.name}"} end end end #################################### God for sidekiq starts here ###################################### God.watch do |w| w.group = "godlist" w.name = "sidekiq" w.interval = 30.seconds w.log = "#{RAILS_ROOT}/log/#{w.name}.log" w.dir = RAILS_ROOT w.pid_file = "#{RAILS_ROOT}/tmp/pids/#{w.name}.pid" w.start = "RAILS_ENV=production bundle exec sidekiq -P #{RAILS_ROOT}/tmp/pids/sidekiq.pid >> #{RAILS_ROOT}/log/sidekiq.log 2>&1 &" w.stop = "kill -9 `cat #{RAILS_ROOT}/tmp/pids/sidekiq.pid`" default_process_monitoring(w, w.name) end #################################### God for sidekiq ends here ###################################### #################################### Email notification configuration starts here ################# require 'tlsmail' Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) God::Contacts::Email.defaults do |d| d.from_email = "[email protected]" d.from_name = "GOD" d.delivery_method = :smtp d.server_host = 'smtp.gmail.com' d.server_port = 587 d.server_auth = :plain d.server_domain = 'gmail.com' d.server_user = '[email protected]' d.server_password = 'password' end God.contact(:email) do |c| c.name = 'rameshkumar' c.to_email = '[email protected]' c.group = 'developers' end #################################### Email notification configuration ends here #################