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
God.contact(:email) do |c|
c.name = "john"
@ -19,21 +14,17 @@ end
w.group = "<%= application %>"
w.name = "<%= application %>-thin-#{port}"
pid = "<%= shared_path %>/pids/thin.#{port}.pid"
command = "bundle exec thin -P #{pid} -p #{port}"
w.dir = '<%= current_path %>'
w.env = {
'BUNDLE_GEMFILE' => '',
'BUNDLE_BIN_PATH' => '',
'RAILS_ENV' => '<%= stage %>',
'RACK_ENV' => '<%= stage %>'
}
w.pid_file = pid
w.log = "<%= shared_path %>/god.log"
start = "#{command} -e <%= stage %> -d 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 = "bundle exec thin -e <%= stage %> -p #{port} start"
w.start_if do |start|
start.condition(:process_running) do |c|