我有一个安装GitLab 7.2的NameError。更准确地说,在初始化数据库时:
$ bundle exec rake gitlab:setup RAILS_ENV=production --trace
rake aborted!
NameError: uninitialized constant Rack::Attack
/home/[user]/gitlab/config/application.rb:67:in `<class:Application>'
/home/[user]/gitlab/config/application.rb:9:in `<module:Gitlab>'
/home/[user]/gitlab/config/application.rb:8:in `<top (required)>'
/home/[user]/gitlab/Rakefile:5:in `require'
/home/[user]/gitlab/Rakefile:5:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
是的,我找到了这个answer discussing the error with an older version of GitLab,其中config / application.rb中的以下行必须取消注释
config.middleware.use Rack::Attack
在7.2。这条线从一开始就没有注释。它就在那里。它显然是耙子窒息的地方。
我也将config / initializers / rack_attack.rb.example重命名为config / initializers / rack_attack.rb。
安装捆绑宝石就像魅力一样。
bundle install --deployment --without development test postgres aws
机架攻击在bundle的gems文件夹中:
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb
有谁知道可能导致此问题的原因?非常感谢!
我在config / application.rb中添加了以下行,并且它正在运行:
require '/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb'
为什么这样有效?怎么了?谢谢!
答案 0 :(得分:0)
我无法添加评论,因此我需要将其作为答案发布:您需要更新您的ruby&amp;宝石:看看https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md#2-ruby。
GitLab需要Ruby(MRI)2.0或2.1你必须使用 Ruby的标准MRI实现。我们喜欢JRuby和Rubinius)但是 GitLab需要几个具有原生扩展的Gems。