Using rbenv in Production

2,968 views
2,774 views

Published on

Quick overview of the installation process for RVM and rbenv, including how we use puppet-rbenv to manage Ruby at New Relic.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,968
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Using rbenv in Production

    1. 1. New Relic• Development on Mac laptops• CI, Staging and Production on Linux• REE-1.8.7-2010.02 and Ruby 1.9.3-p125
    2. 2. Development• Developer laptops• MacOS 10.7• osx-gcc-installer• Many apps all running as the developer
    3. 3. RVM$ curl -L https://get.rvm.io | bash -s stable$ source /Users/newrelic/.rvm/scripts/rvm$ rvm install ree-1.8.7-2010.02There 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! Manuallyspecify the compiler and try again.$ CC=/usr/bin/gcc-4.2 rvm reinstall ree-1.8.7-2010.02
    4. 4. RVM$ ruby -vruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin11.3.0], MBARI0x6770, 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
    5. 5. rbenv + ruby-build (with Homebrew)$ /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
    6. 6. rbenv + ruby-build (with Homebrew)$ rbenv shell ree-1.8.7-2010.02$ ruby -vruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin11.3.0], MBARI0x6770, 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.2LDFLAGS=-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
    7. 7. Production• Linux (CentOS)• One user per application• Puppet• Different Rubies for system and application• Try it out in Vagrant first!
    8. 8. Trying it with Vagrant• Install VirtualBox and Vagrant (vagrantup.com)• Example config https://gist.github.com/ 3044552• Code, run, repeat!
    9. 9. rbenv + ruby-build (with Puppet)Using https://github.com/alup/puppet-rbenvclass { "rbenv": user => "newrelic", compile => true, version => "ree-1.8.7-2010.02"}
    10. 10. rbenv + ruby-build (with Puppet)$ ruby -vruby 1.8.7 (2010-04-19 patchlevel 253) [x86_64-linux], MBARI0x6770, 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

    ×