简体   繁体   English

亚马逊OpsWorks定制食谱RVM

[英]Amazon OpsWorks custom cookbook RVM

I'm trying to install RVM with Amazon OpsWorks using the following cookbook https://github.com/fnichol/chef-rvm . 我正在尝试使用以下食谱https://github.com/fnichol/chef-rvm在Amazon OpsWorks上安装RVM。 I want rvm to run under the user tomcat6, so I included the recipe rvm::user with the correct attributes. 我希望rvm在用户tomcat6下运行,所以我将配方rvm :: user包含在正确的属性中。

The error I'm getting is: 我得到的错误是:

Wed, 06 Mar 2013 20:05:05 +0000 ERROR: Running exception handlers Wed, 06 Mar 2013 20:05:05 +0000 ERROR: Exception handlers complete Wed, 06 Mar 2013 20:05:05 +0000 DEBUG: Re-raising exception: LoadError - no such file to load -- rvm /opt/aws/opsworks/current/site-cookbooks/rvm/recipes/default.rb:29:in require' /opt/aws/opsworks/current/site-cookbooks/rvm/recipes/default.rb:29:in from_file' 2013年3月6日星期三20:05:05 +0000错误:运行异常处理程序2013年3月6日星期三20:05:05 +0000错误:异常处理程序完成2013年3月6日星期三20:05:05 +0000调试:重新引发异常:LoadError - 没有要加载的文件 - rvm /opt/aws/opsworks/current/site-cookbooks/rvm/recipes/default.rb:29:in require' /opt/aws/opsworks/current/site-cookbooks/rvm/recipes/default.rb:29:in from_file'

And the piece of code raising the exception is: 提出异常的代码是:

chef_gem 'rvm' do
action :install
version '>= 1.11.3.6'
end

ruby_block "require rvm" do
    block do
        require 'rvm'
        create_rvm_shell_chef_wrapper
        create_rvm_chef_user_environment
     end
     action :create
end

After getting the error I logged in the instance with ssh and checked whether or not the rvm gem was installed. 收到错误后,我使用ssh登录了实例,并检查是否安装了rvm gem。 I could not see rvm listed under * LOCAL GEMS * . 我看不到在* LOCAL GEMS *下列出的 rvm。

Then I replaced the method chef_gem with gem_package and still got the same error. 然后我用gem_package替换了方法chef_gem,但仍然遇到了同样的错误。 But this time when I checked gem list rvm was listed. 但是这次我检查了宝石列表rvm被列出了。

Any help? 有帮助吗? Thanks in advance. 提前致谢。

The problem is highlighted here: https://forums.aws.amazon.com/thread.jspa?threadID=118646 这里突出显示了这个问题: https//forums.aws.amazon.com/thread.jspa?threadID = 118646

OpsWorks' chef implementation is pretty restricted by Amazon. OpsWorks的主厨实施受亚马逊的限制。 When chef is run on the node, it is actually run via a bundle. 当chef在节点上运行时,它实际上是通过bundle运行的。 Since the rvm cookbook is installing a new gem (rvm) into the system and is attempting to make use of it, it fails since the rvm gem is not already part of the bundle (listed in the Gemfile). 由于RVM食谱正在安装新的宝石(RVM)进入系统,并试图利用它,因为它的RVM创业板是不是已经捆(在Gemfile中列出)的一部分失败。

The current workaround as of this writing is that opsworks has implemented a method to support the usage of custom gems. 在撰写本文时,目前的解决方法是opsworks已经实现了一种方法来支持自定义gem的使用。

I've been able to update the lines you mentioned with: 我已经能够更新你提到的行:

if defined?(OpsWorks) && defined?(OpsWorks::InternalGems)
  OpsWorks::InternalGems.internal_gem_package('rvm', :version => node['rvm']['chef_internal_rvm_gem_version'])
else
  chef_gem 'rvm' do
    action :install
    version '>= 1.11.3.6'
  end
end

Let me know if this works for you! 如果这对您有用,请告诉我!

Are you sure you used the most recent rvm cookbook? 你确定你使用过最新的rvm食谱吗? Look at recipes/default.rb that gave you an error - contents of this file is different from what you posted in your description. 查看给出错误的recipes / default.rb - 此文件的内容与您在说明中发布的内容不同。

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

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