make the god config actually good

This commit is contained in:
John Bintz 2012-08-20 11:29:26 -04:00
parent b71b00b512
commit 4563d9de26

View File

@ -1,8 +1,3 @@
# since we're running god via bundler, we need to un-bundle any commands executed
def wrap_command(*args)
"bash -c 'unset BUNDLE_GEMFILE ; unset BUNDLE_BIN_PATH ; cd <%= current_path %> && #{args.join(' ')}'"
end
# a default email contact for when a service dies and needs to be restarted # a default email contact for when a service dies and needs to be restarted
God.contact(:email) do |c| God.contact(:email) do |c|
c.name = "john" c.name = "john"
@ -19,21 +14,17 @@ end
w.group = "<%= application %>" w.group = "<%= application %>"
w.name = "<%= application %>-thin-#{port}" w.name = "<%= application %>-thin-#{port}"
pid = "<%= shared_path %>/pids/thin.#{port}.pid" w.dir = '<%= current_path %>'
command = "bundle exec thin -P #{pid} -p #{port}" w.env = {
'BUNDLE_GEMFILE' => '',
'BUNDLE_BIN_PATH' => '',
'RAILS_ENV' => '<%= stage %>',
'RACK_ENV' => '<%= stage %>'
}
w.pid_file = pid
w.log = "<%= shared_path %>/god.log" w.log = "<%= shared_path %>/god.log"
start = "#{command} -e <%= stage %> -d start" w.start = "bundle exec thin -e <%= stage %> -p #{port} start"
w.start = wrap_command(start)
w.start_grace = 20.seconds
stop = "#{command} stop"
w.stop = wrap_command(stop)
w.restart = wrap_command("#{stop} && #{start}")
w.restart_grace = 20.seconds
w.start_if do |start| w.start_if do |start|
start.condition(:process_running) do |c| start.condition(:process_running) do |c|