2015-02-09 79 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的方法來確定服務器狀態和啓動/重新啓動適當的獨角獸。