Amazon OpsWorks RVM Custom Cookbook

I am trying to install RVM using Amazon OpsWorks using the following cooking https://github.com/fnichol/chef-rvm . I want rvm to run as user tomcat6, so I included the rvm :: user recipe with the correct attributes.

The error I am getting is:

Wed, 06 March 2013 20:05:05 +0000 ERROR: Starting exception handlers Wed, 06 Mar 2013 20:05:05 +0000 ERROR: exception handlers completed Wed, 06 March 2013 20:05:05 +0000 DEBUG: Rising exception : LoadError - there is no such file to load - rvm / opt / aws / opsworks / current / site-cookies / rvm / recipes / default.rb: 29: in require' /opt/aws/opsworks/current/site-cookbooks/rvm/recipes/default.rb:29:in from_file '

And a piece of code throwing an exception:

 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 receiving the error, I registered the instance with ssh and checked if rvm gem was installed. I could not see the rvm specified in the * LOCAL GEMS * section.

Then I replaced the chef_gem method with gem_package and still got the same error. But this time, when I checked the gem list, the rvm list was specified.

Any help? Thanks in advance.

+4
source share
2 answers

The problem stands out here: https://forums.aws.amazon.com/thread.jspa?threadID=118646

The implementation of the OpsWorks chef is rather limited by Amazon. When a chef runs on node, it actually runs through a bunch. Since the rvm cookbook installs a new gem system (rvm) into the system and tries to use it, it fails because the rvm gem is not yet part of the package (specified in the Gemfile).

The current workaround at the time of this writing is that opsworks has implemented a method to support the use of its own gems.

I was able to update the lines you mentioned:

 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!

+4
source

Are you sure you used the latest rvm cookbook? See recipes / default.rb for the error message: the contents of this file are different from what you posted in your description.

0
source

Source: https://habr.com/ru/post/1469365/


All Articles