用USR2重新启动Unicorn似乎没有重新加载production.rb设置 [英] Restarting Unicorn with USR2 doesn't seem to reload production.rb settings

查看:133
本文介绍了用USR2重新启动Unicorn似乎没有重新加载production.rb设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



到目前为止,这是所有的棒棒糖,主进程分叉并启动了4名新员工,然后杀死旧的,每个人都很高兴。



我们的脚本发送以下命令重新启动独角兽:

  kill -s USR2`cat / www / app / shared / pids / unicorn.pid` 

表面上看起来都很棒,但事实证明独角兽没有重新加载production.rb。 (每次部署时,我们将$ code> config.action_controller.asset_host 值更改为新的CDN容器端点,其中包含预编译的资源)。



以这种方式重新启动独角兽后,资产主机仍然指向旧版本。执行真实重新启动(即:停止主进程,然后从头开始再次启动独角兽)选择新的配置更改。



preload_app 在我们的独角兽配置文件​​中设置为 true



任何想法?

解决方案

我的猜测是,您的独角兽在旧的生产目录中重新启动,而不是新的生产目录 - 换句话说,如果unicorn.rb中的工作目录为< capistrano_directory> / current ,则需要确保符号链接在您尝试重新启动独角兽之前发生。 / p>

这将解释为什么停止和启动他们手动工作:你正在做这个后部署,大概是这导致他们从正确的目录启动。



在部署过程中是否重新启动独角兽?您应该确保在新版本目录符号链接为当前后发送USR2信号。



如果没有帮助,请点击您的unicorn.rb并部署.RB;这将使调试这个问题变得更容易。


I'm running unicorn and am trying to get zero downtime restarts working.

So far it is all awesome sauce, the master process forks and starts 4 new workers, then kills the old one, everyone is happy.

Our scripts send the following command to restart unicorn:

kill -s USR2 `cat /www/app/shared/pids/unicorn.pid`

On the surface everything looks great, but it turns out unicorn isn't reloading production.rb. (Each time we deploy we change the config.action_controller.asset_host value to a new CDN container endpoint with our pre-compiled assets in it).

After restarting unicorn in this way the asset host is still pointing to the old release. Doing a real restart (ie: stop the master process, then start unicorn again from scratch) picks up the new config changes.

preload_app is set to true in our unicorn configuration file.

Any thoughts?

解决方案

My guess is that your unicorns are being restarted in the old production directory rather than the new production directory -- in other words, if your working directory in unicorn.rb is <capistrano_directory>/current, you need to make sure the symlink happens before you attempt to restart the unicorns.

This would explain why stopping and starting them manually works: you're doing that post-deploy, presumably, which causes them to start in the correct directory.

When in your deploy process are you restarting the unicorns? You should make sure the USR2 signal is being sent after the new release directory is symlinked as current.

If this doesn't help, please gist your unicorn.rb and deploy.rb; it'll make it a lot easier to debug this problem.

这篇关于用USR2重新启动Unicorn似乎没有重新加载production.rb设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆