简体   繁体   English

由capistrano启动时,独角兽失败

[英]unicorn fails when started by capistrano

When I start unicorn via capistrano task and try to access my app I get this 当我通过capistrano任务启动独角兽并尝试访问我的应用程序时,我得到了这个

tarted GET "/" for xx.xxx.xxx at 2012-08-11 01:38:31 +0000
Processing by HomeController#index as HTML
  Rendered home/index.html.erb within layouts/application (0.1ms)
Completed 500 Internal Server Error in 87ms
** [Bugsnag] No API key configured, couldn't notify

ActionView::Template::Error (undefined method `split' for nil:NilClass):
    32:               </form>
    33:             </ul>
    34:           <ul class="nav pull-right">
    35:             <% if user_signed_in? %>
    36:               <li class="dropdown">
    37:                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">
    38:                   <%= current_user.name %>
  app/controllers/application_controller.rb:5:in `current_user'
  app/controllers/application_controller.rb:9:in `user_signed_in?'
  app/views/layouts/application.html.erb:35:in `_app_views_layouts_application_html_erb__3931886679734892787_26070680'

in addition of ActionView::Template::Error , unicorn says that no busgnag API key configured, but I've already set the key on my root's .bashrc and deploy's .bashrc (deploy is a user too) 除了ActionView::Template::Error ,独角兽还说没有配置busgnag API密钥,但是我已经在根的.bashrc和deploy的.bashrc上设置了密钥(部署也是用户)
but when I access the server via ssh like ssh root@server and try to start unicorn with the same command the capistrano's task issued, everythin works fine... 但是当我通过像ssh root@server这样的ssh root@server访问ssh root@server并尝试使用capistrano发出的任务相同的命令启动独角兽时,一切都可以正常工作...
I've tried to set root user on capistrano and deploy user, both with use_sudo true and false... 我已经尝试在capistrano上设置root用户并部署用户,两者都具有use_sudo true和false。
What am I missing here? 我在这里想念什么?
Thanks 谢谢

Are you sure when you run it manually you are running in production mode? 您确定在手动运行时是否以生产模式运行? undefined method xxxx' for nil:NilClass` happens when you have an nil variable. 当您有nil变量时,会发生nil:NilClass`的undefined method xxxx'。 Often times code like... 通常,代码像...

Articles.each do |article|
  article.title
end

Will fails with the same error because the db is populated differently in each environment. 由于在每个环境中数据库的填充方式不同,Will会失败并显示相同的错误。 I would suggest looking at line 5 application_controller.rb and seeing if that variable is present in both production and development. 我建议查看第5行application_controller.rb ,看看该变量在生产和开发中是否都存在。

Also, make sure that your bugsnap api key is available in your production.rb file. 另外,请确保您的bugsnap api密钥在production.rb文件中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM