Heroku上的Errbit与RVM& Capistrano的

时间:2013-10-29 04:38:10

标签: ruby-on-rails heroku capistrano airbrake errbit

我尝试使用Errbit为我的RoR应用程序设置Heroku(Airbrake),跟随以下网站:

Heroku上的部署工作得很好。我可以正常登录并创建应用程序,所有设置似乎都没问题。

在应用程序方面,我按照指南中的描述创建了文件:

*Gemfile:*
gem 'airbrake'

*config/initializers/errbit.rb:*    
Airbrake.configure do |config|
  config.api_key = 'eb81f59f77778865464da97f0e1ce5951'
  config.host    = 'myproject-errbit.herokuapp.com'
  config.port    = 80
  config.secure  = config.port == 443
end

我运行“bundle install”并在localhost中尝试命令:

rake airbrake:test

好的,它有效(heroku应用程序中存在的信息)。接下来,我在生产环境中部署(通过capistrano), 然后再试一次:

 ssh app@xx.xxx.xxx.xxx
 cd /u/myapp/path/current/
 rake airbrake:test

我收到此错误消息:

/home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find i18n-0.6.5 in any of the sources (Bundler::GemNotFound)
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/rubygems-bundler-1.3.4/lib/rubygems-bundler/noexec.rb:74:in `setup'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/rubygems-bundler-1.3.4/lib/rubygems-bundler/noexec.rb:103:in `check'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/rubygems-bundler-1.3.4/lib/rubygems-bundler/noexec.rb:109:in `<top (required)>'
        from /home/app/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
        from /home/app/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
        from /home/app/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/rubygems-bundler-1.3.4/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/executable-hooks-1.2.3/lib/executable-hooks/hooks.rb:50:in `call'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/executable-hooks-1.2.3/lib/executable-hooks/hooks.rb:50:in `block in run'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/executable-hooks-1.2.3/lib/executable-hooks/hooks.rb:49:in `each'
        from /home/app/.rvm/gems/ruby-2.0.0-p0@global/gems/executable-hooks-1.2.3/lib/executable-hooks/hooks.rb:49:in `run'
        from /home/app/.rvm/gems/ruby-2.0.0-p0/bin/ruby_executable_hooks:10:in `<main>'

(我已经使用“app”用户(部署用户)输入了命令。)

令人印象深刻的是,红宝石设置是错误的:

ruby version
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]

rvm list
rvm rubies

=* ruby-2.0.0-p0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

可以想象,当发生错误时,数据不会保存在Errbit(Heroku)项目中。

如果有人可以帮助我,我将不胜感激〜

感谢您的阅读。

1 个答案:

答案 0 :(得分:2)

这是因为您需要在捆绑器环境中启动rake。试试:

bundle exec rake airbrake:test