문제

I have a RubyOnRails project, and deployed it with Unicorn on nginx on an Ubuntu server.

I need to restart Unicorn if I change one of configuration files, but it makes my site shut down when I kill Unicorn's master process and start it again with bundle exec.

Is there any way to make Unicorn work with new files without killing the process and going down?

도움이 되었습니까?

해결책

In my capistrano deploy.rb I have:

desc "Zero-downtime restart of Unicorn"
task :restart, :except => { :no_release => true } do
  run "kill -s USR2 unicorn_pid"
end

This is well documented in "Lighting fast, zero-downtime deployments with git, capistrano, nginx and Unicorn".

다른 팁

Both answers, including the accepted one, are bad.

http://unicorn.bogomips.org/SIGNALS.html says send a HUP to the master process.

desc "Zero-downtime restart of Unicorn"
task :restart, :except => { :no_release => true } do
  run "kill -s HUP `cat tmp/pids/unicorn.pid`"
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top