- From: John Merrells <
>
- To:
- Subject: [chef] Re: chef & rvm
- Date: Wed, 14 Jul 2010 18:49:20 -0700
Just for the record, I've got this working quite nicely. Here's what I did...
I wrote a simple cookbook to install rvm and some rubies.
============================================================
include_recipe("zlib") # for rvm
package 'curl' # for ree
package 'libreadline5-dev' # for ree
cookbook_file "/root/.bashrc" do
source "bashrc"
mode "0644"
end
cookbook_file "/root/.profile" do
source "profile"
mode "0644"
end
# to update
# rvm update --head
bash "install rvm" do
environment "HOME"=>"/root"
code <<-EOH
bash < <( curl
http://rvm.beginrescueend.com/releases/rvm-install-head )
EOH
not_if { ::FileTest.exists?("/usr/local/rvm") } # JCM check version
end
bash "install ruby 1.8.7" do
environment "HOME"=>"/root"
code <<-EOH
source '/usr/local/rvm/scripts/rvm'
rvm install ruby-1.8.7-p299
rvm 1.8.7 gem install bundler --no-ri --no-rdoc
EOH
not_if { ::FileTest.exists?("/usr/local/bin/rvm/rubies/ruby-1.8.7-p299") }
end
bash "install ruby enterprise edition 1.8.7" do
environment "HOME"=>"/root"
code <<-EOH
source '/usr/local/rvm/scripts/rvm'
rvm install ree-1.8.7-2010.02
rvm ree gem install bundler --no-ri --no-rdoc
EOH
not_if { ::FileTest.exists?("/usr/local/bin/rvm/rubies/ree-1.8.7-2010.02") }
end
============================================================
Since I'm using bundler I did't really have any gem_package calls,
which I thought would be the biggest challenge here. So, now I call
bundler like this....
============================================================
execute "bundle_install" do
command "rvm ree;bundle install"
end
============================================================
...and then I'm using runit to spin up my ruby daemon, so the run
script changed to....
============================================================
#!/bin/bash
source '/usr/local/rvm/scripts/rvm'
rvm use ree
exec 2>&1
exec /usr/bin/env my_ruby_daemon
============================================================
...now I can switch between rubies super easily, and all the ruby install and
setup work is done by rvm, rather than chef, so those {ruby|rails|passenger}
_enterprise cookbooks can go away, and now I can play with rubinious,
1.9.2, rails30, without worrying about messing up my environment.
John
On Jul 14, 2010, at 2:21 PM, John Merrells wrote:
>
>
Is anyone using chef with rvm to install and manage multiple rubies and
>
gemsets on their servers?
>
>
John
>
>
--
>
John Merrells
>
http://johnmerrells.com
>
+1.415.244.5808
>
>
>
>
>
>
--
John Merrells
http://johnmerrells.com
+1.415.244.5808
- [chef] chef & rvm, John Merrells, 07/14/2010
- [chef] Re: chef & rvm, John Merrells, 07/14/2010
Archive powered by MHonArc 2.6.16.