Share
Embed
Using rbenv in Production
Quick overview of the installation process for RVM and rbenv, including how we use puppet-rbenv to manage Ruby at New Relic.
Nic Benders
July 04, 2012
Transcript
10 slides
-
New Relic • Development on Mac laptops • CI, Staging
and Production on Linux • REE-1.8.7-2010.02 and Ruby 1.9.3-p125 Wednesday, July 4, 12 -
• Developer laptops • MacOS 10.7 • osx-gcc-installer • Many
apps all running as the developer Development Wednesday, July 4, 12 -
$ curl -L https://get.rvm.io | bash -s stable $ source
/Users/newrelic/.rvm/scripts/rvm $ rvm install ree-1.8.7-2010.02 There has been an error while trying to run the ree installer. Halting the installation. Oh that’s right, the old REE doesn’t build with the new LLVM compiler! Manually specify the compiler and try again. $ CC=/usr/bin/gcc-4.2 rvm reinstall ree-1.8.7-2010.02 RVM Wednesday, July 4, 12 -
$ ruby -v ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin11.3.0], MBARI
0x6770, Ruby Enterprise Edition 2010.02 $ which ruby /Users/newrelic/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby $ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]' '--prefix=/Users/newrelic/.rvm/rubies/ree-1.8.7-2010.02' '-- enable-mbari-api' 'CFLAGS=-g -O2 ' 'CC=/usr/bin/gcc-4.2' RVM Wednesday, July 4, 12 -
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/ mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" $ brew update
$ brew install rbenv $ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.profile $ brew install ruby-build $ rbenv install ree-1.8.7-2010.02 rbenv + ruby-build (with Homebrew) Wednesday, July 4, 12 -
$ rbenv shell ree-1.8.7-2010.02 $ ruby -v ruby 1.8.7 (2010-04-19
patchlevel 253) [i686-darwin11.3.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02 $ which ruby /Users/newrelic/.rbenv/shims/ruby $ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]' '--prefix=/Users/newrelic/.rbenv/versions/ree-1.8.7-2010.02' '-- enable-mbari-api' 'CFLAGS=-g -O2 ' 'CC=/usr/bin/gcc-4.2' 'LDFLAGS=-L'\\''/Users/newrelic/.rbenv/versions/ree-1.8.7-2010.02/ lib'\\'' ' 'CPPFLAGS=-I'\\''/Users/newrelic/.rbenv/versions/ ree-1.8.7-2010.02/include'\\'' ' rbenv + ruby-build (with Homebrew) Wednesday, July 4, 12 -
• Linux (CentOS) • One user per application • Puppet
• Different Rubies for system and application • Try it out in Vagrant first! Production Wednesday, July 4, 12 -
• Install VirtualBox and Vagrant (vagrantup.com) • Example config https://gist.github.com/
3044552 • Code, run, repeat! Trying it with Vagrant Wednesday, July 4, 12 -
Using https://github.com/alup/puppet-rbenv class { "rbenv": user => "newrelic", compile =>
true, version => "ree-1.8.7-2010.02" } rbenv + ruby-build (with Puppet) Wednesday, July 4, 12 -
$ ruby -v ruby 1.8.7 (2010-04-19 patchlevel 253) [x86_64-linux], MBARI
0x6770, Ruby Enterprise Edition 2010.02 $ which ruby ~/.rbenv/shims/ruby $ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]' '--prefix=/home/vagrant/.rbenv/versions/ree-1.8.7-2010.02' '-- enable-mbari-api' 'CFLAGS=-g -O2 ' 'CC=/usr/bin/gcc' 'LDFLAGS=-L'\ \''/home/vagrant/.rbenv/versions/ree-1.8.7-2010.02/lib'\\'' ' 'CPPFLAGS=-I'\\''/home/vagrant/.rbenv/versions/ree-1.8.7-2010.02/ include'\\'' ' rbenv + ruby-build (with Puppet) Wednesday, July 4, 12