1

I wanted to know if anyone is using rbenv with ruby-build in production, and if people can shed some light on any gotchas or insights on their experience.

Many thanks.

4

1 回答 1

3

There does appear to be people using rbenv in production. The rbenv documentations says:

Rock-solid in production. Your application's executables are its interface with ops. With rbenv and Bundler binstubs you'll never again need to cd in a cron job or Chef recipe to ensure you've selected the right runtime. The Ruby version dependency lives in one place—your app—so upgrades and rollbacks are atomic, even when you switch versions

However, rbenv really excels in development by making it easy to use many versions of Ruby.

For production I often skip rbenv and use ruby-build directly.

This script will get you a good Ruby on Ubuntu using ruby-build without rbenv:

# The version of Ruby to be installed
ruby_ver="1.9.3-p392"

# The base path to the Ruby
ruby_home="/usr/local"

# Packages needed to build Ruby
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev

# Use ruby-build to install Ruby
clone_dir=/tmp/ruby-build-$$
git clone https://github.com/sstephenson/ruby-build.git $clone_dir
$clone_dir/bin/ruby-build "$ruby_ver" "$ruby_home"
rm -rf $clone_dir
unset clone_dir
于 2013-03-30T06:46:02.490 回答