lib/negroku/tasks/unicorn.rake in negroku-2.0.0.pre5 vs lib/negroku/tasks/unicorn.rake in negroku-2.0.0.pre6
- old
+ new
@@ -13,10 +13,12 @@
## capistrano3/unicorn variables
# Defines where the unicorn pid will live.
set :unicorn_pid, -> { "#{shared_path}/tmp/pids/unicorn.pid" }
+ set :unicorn_log, -> { "#{shared_path}/log/unicorn.log" }
+
set :unicorn_config_path, -> { "#{shared_path}/config/unicorn.rb" }
###################################
## unicorn.rb template variables
@@ -44,11 +46,11 @@
###################################
## capistrano3/nginx variables
# Set the app server socket if nginx is being used
- set :app_server_socket, -> { fetch(:unicorn_socket) } if was_required? 'capistrano/nginx'
+ set :app_server_socket, -> { fetch(:unicorn_socket) } if required? 'capistrano/nginx'
end
end
# Adds some task on complement the capistrano3-unicorn tasks
@@ -76,10 +78,16 @@
end
# Reload or restart unicorn after the application is published
after 'deploy:publishing', 'restart' do
invoke 'negroku:unicorn:setup'
- invoke fetch(:unicorn_preload)? 'unicorn:restart' : 'unicorn:reload'
+ invoke 'unicorn:restart'
+ end
+
+ before 'env:changed', 'hard-restart' do
+ invoke 'unicorn:stop'
+ sleep 5
+ invoke 'unicorn:start'
end
# Ensure the folders needed exist
after 'deploy:check', 'deploy:check:directories' do
on release_roles fetch(:unicorn_roles) do