2015-02-09 84 views
2

我一直试图解决这个问题,我自己有一段时间没有任何运气。当我在10%的时间内重新部署我的Rails应用程序时,就会发生这种情况。另外90%的时间部署顺利进行。独角兽在部署后定期无法重启 - 陈旧的PID

我试了一遍,但没有成功。所以我转向SO群众寻求帮助。

有关我的堆栈:我使用大厨在Ubuntu 14.04上运行vagrant生成我的实例,并使用upstart到海外独角兽。

错误:

srv/www/rails/releases/ef6a792a19f8bb9d36ef4d0ab15ee38ca91a0cd1/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:206:in `pid=': Already running on PID:17694 (or pid=/srv/www/rails/shared/pids/unicorn.pid is stale) (ArgumentError) 
from /srv/www/rails/releases/ef6a792a19f8bb9d36ef4d0ab15ee38ca91a0cd1/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:135:in `start' 
from /srv/www/rails/releases/ef6a792a19f8bb9d36ef4d0ab15ee38ca91a0cd1/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>' 
from /srv/www/rails/releases/ef6a792a19f8bb9d36ef4d0ab15ee38ca91a0cd1/vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `load' 
from /srv/www/rails/releases/ef6a792a19f8bb9d36ef4d0ab15ee38ca91a0cd1/vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `<main>' 

我的麒麟新贵脚本是here。我的独角兽配置文件​​可以查看here

如果您需要更多信息,请让我知道。以上感谢您的帮助和时间。

回答

1

我也遇到过这个。在尝试运行Unicorn之前,您需要在新贵脚本中清除旧的PID文件。

rm /srv/www/rails/shared/pids/unicorn.pid 

或者,看看https://github.com/tablexi/capistrano3-unicorn的方法来确定服务器状态和启动/重新启动适当的独角兽。