make config even tighter
This commit is contained in:
parent
4563d9de26
commit
fbe92f2c88
@ -5,16 +5,24 @@ God.contact(:email) do |c|
|
|||||||
c.delivery_method = :sendmail
|
c.delivery_method = :sendmail
|
||||||
end
|
end
|
||||||
|
|
||||||
# example for a thin-powered app, which is what I use the most of
|
def notifies(condition)
|
||||||
<%= thin_servers %>.times do |port_id|
|
c.notify = "john"
|
||||||
port = <%= thin_port %> + port_id
|
end
|
||||||
|
|
||||||
God.watch do |w|
|
def keep_process_running(w)
|
||||||
# assign all watches to this group so personal_deity can stop/start them all at once
|
w.start_if do |start|
|
||||||
|
start.condition(:process_running) do |c|
|
||||||
|
c.running = false
|
||||||
|
c.interval = 5.seconds
|
||||||
|
notofies(c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def shared_config(w)
|
||||||
w.group = "<%= application %>"
|
w.group = "<%= application %>"
|
||||||
w.name = "<%= application %>-thin-#{port}"
|
|
||||||
|
|
||||||
w.dir = '<%= current_path %>'
|
w.dir = '<%= current_path %>'
|
||||||
|
|
||||||
w.env = {
|
w.env = {
|
||||||
'BUNDLE_GEMFILE' => '',
|
'BUNDLE_GEMFILE' => '',
|
||||||
'BUNDLE_BIN_PATH' => '',
|
'BUNDLE_BIN_PATH' => '',
|
||||||
@ -24,15 +32,20 @@ end
|
|||||||
|
|
||||||
w.log = "<%= shared_path %>/god.log"
|
w.log = "<%= shared_path %>/god.log"
|
||||||
|
|
||||||
|
keep_process_running(w)
|
||||||
|
end
|
||||||
|
|
||||||
|
# example for a thin-powered app, which is what I use the most of
|
||||||
|
<%= thin_servers %>.times do |port_id|
|
||||||
|
port = <%= thin_port %> + port_id
|
||||||
|
|
||||||
|
God.watch do |w|
|
||||||
|
# assign all watches to this group so personal_deity can stop/start them all at once
|
||||||
|
w.name = "<%= application %>-thin-#{port}"
|
||||||
|
|
||||||
w.start = "bundle exec thin -e <%= stage %> -p #{port} start"
|
w.start = "bundle exec thin -e <%= stage %> -p #{port} start"
|
||||||
|
|
||||||
w.start_if do |start|
|
shared_config(w)
|
||||||
start.condition(:process_running) do |c|
|
|
||||||
c.running = false
|
|
||||||
c.interval = 5.seconds
|
|
||||||
c.notify = "john"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user