为什么在“bundle -deployment”之后无法在生产中发现宝石?

时间:2015-01-14 18:23:23

标签: ruby-on-rails capistrano bundler capistrano3 rubinius

以下是我的问题摘要: 我站了一台新服务器 我安装了Rubinius和其他一些东西as documented here。 我部署了。该网站已进行多次部署。 在某些时候,我遇到了问题并开始尝试随机解决方案。我遇到了捆绑包的问题,​​无法通过它。 沮丧,我站了一个全新的服务器。我还有问题。这表明我的代码或我的capistrano脚本存在问题...但我在开发过程中没有任何捆绑器问题,而且我回到了之前工作且没有快乐的capistrano脚本。所以我感到很困惑。任何想法都将不胜感激。

Xena是第二台机器。以下是部署后的结果:

production@xena:~/lexicon/current$ ruby -v
rubinius 2.4.1 (2.1.0 b332f133 2014-12-04 3.4 JI) [x86_64-linux-gnu]

Capistrano运行了这个命令,但是为了显示结果,我又做了一次:

production@xena:~/lexicon/current$ /usr/local/bin/chruby-exec rbx-2.4.1 -- bundle install --binstubs /home/production/lexicon/shared/bin --path /home/production/lexicon/shared/bundle --without development test --deployment
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.5
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.5
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.1
Using actionview 4.2.0
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.0
Using globalid 0.3.0
Using activejob 4.2.0
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.2.0
Using activemodel 4.2.0
Using arel 6.0.0
Using activerecord 4.2.0
Using bcrypt 3.1.9
Using climate_control 0.0.3
Using cocaine 0.5.5
Using commonjs 0.2.7
Using execjs 2.2.2
Using tilt 1.4.1
Using haml 4.0.6
Using hike 1.2.3
Using thor 0.19.1
Using railties 4.2.0
Using jquery-rails 4.0.3
Using jquery-ui-rails 5.0.3
Using less 2.6.0
Using less-rails 2.6.0
Using libv8 3.16.14.7
Using multi_json 1.10.1
Using mysql2 0.3.17
Using net-ssh 2.7.0
Using paperclip 4.2.1
Using polyamorous 1.1.0
Using psych 2.0.9
Using puma 2.10.2
Using bundler 1.7.11
Using sprockets 2.12.3
Using sprockets-rails 2.2.2
Using rails 4.2.0
  ing ransack 1.6.1
▽sing redcarpet 3.2.2
Using ref 1.0.5
Using rollbar 1.4.0
Using simple_form 3.1.0
Using therubyracer 0.12.1
Using twitter-bootstrap-rails 3.2.1 from https://github.com/seyhunak/twitter-bootstrap-rails.git (at master)
Using uglifier 2.7.0
Using valuable 0.9.9
Using warden 1.2.3
Using will_paginate 3.0.7
Using will_paginate-bootstrap 1.0.1
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into /home/production/lexicon/shared/bundle

然后我尝试运行rails:

production@xena:~/lexicon/current$ bin/rails c
Could not find i18n-0.7.0 in any of the sources
Run `bundle install` to install missing gems.

也许是通过bundler?:

production@xena:~/lexicon/current$ bundle exec rails c
bundler: command not found: rails
Install missing gem executables with `bundle install`

我的捆绑包配置。我知道rubinius和psych有一些奇怪的问题,但这似乎没问题:

production@xena:~/lexicon/current$ vim .bundle/config
--- !ruby/hash-with-ivars
elements:
  BUNDLE_FROZEN: '1'
  BUNDLE_PATH: "/home/production/lexicon/shared/bundle"
  BUNDLE_BIN: "/home/production/lexicon/shared/bin"
  BUNDLE_WITHOUT: development:test
  BUNDLE_DISABLE_SHARED_GEMS: '1'
ivars:
  :@capacity: 16
  :@max_entries: 12
  :@entries: !ruby/object:Rubinius::Tuple {}
  :@state: &1 !ruby/object:Hash::State
    tail: &5 !ruby/object:Hash::Bucket
      link:
      state: *1
      value: '1'
      previous: &2 !ruby/object:Hash::Bucket
        link:
        state: *1

好吧,让我们确保那里有一些宝石:

production@xena:~/lexicon/current$ ls /home/production/lexicon/shared/bundle/rbx/2.1/bin/
erubis  lessc     puma     rackup  rake       sprockets  tilt
haml    nokogiri  pumactl  rails   redcarpet  thor

这似乎是正确的......

production@xena:~/lexicon/current$ ls /home/production/lexicon/shared/bundle/rbx/2.1/gems

actionmailer-4.2.0            net-ssh-2.7.0
actionpack-4.2.0              nokogiri-1.6.5
actionview-4.2.0              paperclip-4.2.1
activejob-4.2.0               polyamorous-1.1.0
activemodel-4.2.0             psych-2.0.9
activerecord-4.2.0            puma-2.10.2
activesupport-4.2.0           rack-1.6.0
arel-6.0.0                    rack-test-0.6.3
bcrypt-3.1.9                  rails-4.2.0
builder-3.2.2                 rails-deprecated_sanitizer-1.0.3
climate_control-0.0.3         rails-dom-testing-1.0.5
cocaine-0.5.5                 rails-html-sanitizer-1.0.1
commonjs-0.2.7                railties-4.2.0
erubis-2.7.0                  rake-10.4.2
execjs-2.2.2                  ransack-1.6.1
globalid-0.3.0                redcarpet-3.2.2
haml-4.0.6                    ref-1.0.5
hike-1.2.3                    rollbar-1.4.0
i18n-0.7.0                    simple_form-3.1.0
jquery-rails-4.0.3            sprockets-2.12.3
jquery-ui-rails-5.0.3         sprockets-rails-2.2.2
json-1.8.2                    therubyracer-0.12.1
less-2.6.0                    thor-0.19.1
less-rails-2.6.0              thread_safe-0.3.4
libv8-3.16.14.7-x86_64-linux  tilt-1.4.1
loofah-2.0.1                  tzinfo-1.2.2
mail-2.6.3                    uglifier-2.7.0
mime-types-2.4.3              valuable-0.9.9
mini_portile-0.6.2            warden-1.2.3
minitest-5.5.1                will_paginate-3.0.7
multi_json-1.10.1             will_paginate-bootstrap-1.0.1
mysql2-0.3.17

任何帮助,找出为什么捆绑商无法找到它刚才放置的文件,我们将不胜感激。

2 个答案:

答案 0 :(得分:2)

在brixen和yorickpeterse的帮助下,#rubinius,我们发现这种混乱的根本原因是心理上超过2.0.8。

#with rbx 2.4.1 and psych 2.0.8
rbx-2.4.1 :003 > YAML.dump({fu: 'bar'})
=> "---\n:fu: bar\n"

但更新版本时会出现问题:

rbx-2.4.1 :005 > YAML.dump({fu: 'bar'})
=> "--- !ruby/hash-with-ivars\nelements:\n  :fu: bar\nivars:\n  :@entries: !ruby/object:Rubinius::Tuple {}\n  :@capacity: 16\n  :@size: 1\n  :@max_entries: 12\n  :@state: &1 !ruby/object:Hash::State\n    compare_by_identity: false\n    head: &2 !ruby/object:Hash::Bucket\n      key_hash: 2112643688174279348\n      value: bar\n      link: \n      state: *1\n      key: :fu\n    tail: *2\n  :@mask: 15\n"

Capistrano在创建.bundle/config时会发出YAML。似乎Capistrano无法阅读"创意"其配置文件的版本,因此它返回默认值。

一旦我在生产机器上安装了psych 2.0.6并更正了我的gemfile,我就能够成功部署。

参考

答案 1 :(得分:1)

添加到您的Gemfile:gem 'i18n', '~> 0.7.0'

然后运行bundle update i18n