ruby-on-rails – 重启Unicorn问题(capistrano)
发布时间:2020-12-16 21:27:03 所属栏目:百科 来源:网络整理
导读:我在deploy.rb中有以下设置来重启我的服务器: namespace :deploy do task :restart do run "if [ -f #{unicorn_pid} ] [ -e /proc/$(cat #{unicorn_pid}) ]; then kill -USR2 `cat #{unicorn_pid}`; else cd #{deploy_to}/current bundle exec unicorn -c
我在deploy.rb中有以下设置来重启我的服务器:
namespace :deploy do task :restart do run "if [ -f #{unicorn_pid} ] && [ -e /proc/$(cat #{unicorn_pid}) ]; then kill -USR2 `cat #{unicorn_pid}`; else cd #{deploy_to}/current && bundle exec unicorn -c #{unicorn_conf} - E #{rails_env} -D; fi" end end 但它不起作用.我的意思是该命令执行(它询问密码并且没有错误),但是配置文件中的所有更改仍然被忽略(即工作进程数或数据库设置). 解决方法
也许这是因为独角兽重启的方式.并非每个工人都立即重新启动.这样可以实现零停机和无任何请求.如果您想确定看到更改,请尝试停止然后启动应用程序.我有时不得不这样做.当然,你可能会失去一些要求.
以下任务是我用于重启,停止和启动我的unicorn服务器的任务. desc "Zero-downtime restart of Unicorn" task :restart,:except => { :no_release => true } do run "kill -s USR2 `cat #{shared_path}/pids/unicorn.pid`" end desc "Start unicorn" task :start,:except => { :no_release => true } do run "cd #{current_path} ; bundle exec unicorn_rails -c config/unicorn.rb -D -E production" end desc "Stop unicorn" task :stop,:except => { :no_release => true } do run "kill -s QUIT `cat #{shared_path}/pids/unicorn.pid`" end 希望这对你有所帮助. 也许this文章很感兴趣. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |