简体   繁体   中英

unicorn fails when started by capistrano

When I start unicorn via capistrano task and try to access my app I get this

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)
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...
I've tried to set root user on capistrano and deploy user, both with use_sudo true and 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. 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. I would suggest looking at line 5 application_controller.rb and seeing if that variable is present in both production and development.

Also, make sure that your bugsnap api key is available in your production.rb file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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