Not stop and restart Unicorn #117

Open
misteral opened this Issue Nov 8, 2012 · 1 comment

Projects

None yet

2 participants

@misteral
misteral commented Nov 8, 2012

god -v 0.13.1

I have config. Why did not god, it stops and does not restart???? And not send to jabber. Please help.
manual kill and restart ok/

RAILS_ENV = ENV['RAILS_ENV'] = 'production'
RAILS_ROOT = ENV['RAILS_ROOT'] = '/home/ror/projects/sund/current'
PID_DIR = RAILS_ROOT + "/tmp/pids"
pid_file = #{PID_DIR}/unicorn.pid
BIN_PATH = "/home/ror/.rvm/bin"

God.log_file = "#{RAILS_ROOT}/log/god.log"
God.log_level = :info

God.watch do |w|
w.log = "#{RAILS_ROOT}/log/god.log"
w.name = "sund"
w.interval = 30.seconds # default

unicorn needs to be run from the rails root

w.start = "cd #{RAILS_ROOT} && #{BIN_PATH}/boot_unicorn -c #{RAILS_ROOT}/config/unicorn.rb -E #{RAILS_ENV}"

QUIT gracefully shuts down workers

w.stop = "kill -s QUIT $(cat #{pid_file})"

USR2 causes the master to re-create itself and spawn a new worker pool

w.restart = "kill -s HUP $(cat #{pid_file})"

w.start_grace = 20.seconds
w.restart_grace = 20.seconds
#w.stop_grace = 10.seconds

w.pid_file = pid_file

w.uid = 'ror'
w.gid = 'ror'

w.behavior(:clean_pid_file)

w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end

w.restart_if do |restart|
restart.condition(:memory_usage) do |c|
c.above = 200.megabytes
c.times = [3, 5] # 3 out of 5 intervals
end

restart.condition(:cpu_usage) do |c|
c.above = 50.percent
c.times = 5
end
end

w.transition(:up, :start) do |on|
on.condition(:process_exits) do |c|
c.notify = 'devteam'
end
end

lifecycle

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

God::Contacts::Jabber.defaults do |d|
d.host = "jabber.org"
d.from_jid = "xxxx.bot@jabber.org"
d.password = "xxxxxx"
end

God.contact(:jabber) do |c|
c.to_jid = "xxxxxx@xxxx.xx"
c.name = 'dxxxxx'
c.group = 'devteam'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment