I am trying to setup Rails environment on CentOS 6.3 64bit using Vagrant and Chef-Solo.
Rails cannot be installed when using chef, with error message,
Mixlib::ShellOut::CommandTimeout: rbenv_gem[rails] (main::default line 21) had an error: Mixlib::Shell Out::CommandTimeout: command timed out:
How do I solve this?
1.create vagrant VM
$ vagrant box add centos https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box`
$ vagrant init centos
$ vagrant up
2.create chef repository and install chef to VM
$ knife solo init chefrepo
$ knife solo prepare [email protected] # vagrant VMs IP
3.import public cookbook from OpsCode
$ knife cookbook site vendor rbenv
this imports rbenv cookbook to chefrepo/cookbooks/rbenv
4.create my cookbook and modify default.rb
$ knife cookbook create main -o site-cookbooks
$ vi site-cookbooks/main/recipes/default.rb
include_recipe 'rbenv::default'
include_recipe 'rbenv::ruby_build'
rbenv_ruby "2.0.0-p0" do
global true
end
rbenv_gem "rails" do
ruby_version "2.0.0-p0"
end
5.cook
$ knife solo cook [email protected]
then gets error as follows.
# Declared in /home/vagrant/chef-solo/site-cookbooks/main/recipes/default.rb:21:in `from_file'
rbenv_gem("rails") do
provider Chef::Provider::Package::RbenvRubygems
action :install
retries 0
retry_delay 2
cookbook_name :main
recipe_name "default"
ruby_version "2.0.0-p0"
package_name "rails"
gem_binary "/opt/rbenv/shims/gem"
version "3.2.13"
end
[2013-04-17T12:00:13+02:00] ERROR: Running exception handlers
[2013-04-17T12:00:13+02:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
[2013-04-17T12:00:13+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-04-17T12:00:13+02:00] FATAL: Mixlib::ShellOut::CommandTimeout: rbenv_gem[rails] (main::default line 21) had an error: Mixlib::Shell
Out::CommandTimeout: command timed out:
---- Begin output of /opt/rbenv/versions/2.0.0-p0/bin/gem install rails -q --no-rdoc --no-ri -v "3.2.13" ----
STDOUT:
STDERR:
---- End output of /opt/rbenv/versions/2.0.0-p0/bin/gem install rails -q --no-rdoc --no-ri -v "3.2.13" ----
ERROR: RuntimeError: chef-solo failed. See output above.
Rails can be installed by $ sudo gem install rails
on VM. This takes about 20mins or more.
I'm not sure what your environment restrictions are, but one potential solution is to use a different operating system. I had a very similar problem with CentOS 6.3 and Vagrant a few weeks ago and spent literally days on it. Once I switched to Ubuntu it was like cutting hot butter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With