Chef cookbook which installs pre-built rbenv Ruby version tarballs in a system install. Works with chef-ruby_build and chef-rbenv.
Installs pre-built rbenv Ruby version tarballs in a system
install. It does this by subscribing to an rbenv post-init hook resource in
the rbenv cookbook and extracting the tarball packages into the
versions/
directory before rbenv tries to build any Ruby versions. With
the directory pre-existing a source compile will not be initiated. This
cookbook only supports rbenv installed system-wide because the install path
is known and likely to not break (since the build target path and extraction
path match).
Include recipe[rbenv_system_pkgs]
in your run_list and override the defaults
you want changed. See below for more details.
Note if you use the default tarball package location frequently, please consider making a local or alternative mirror.
You can mirror some or all of the tarball pacakges on your own webserver by
placing all tarball packages directly under the root_url
attribute URL.
You can use the ruby_build and rbenv cookbooks
to compile your desired Ruby versions into a system-wide installation. Next
create a tarball of the directory under the versions/
directory. For example:
cd /usr/loca/rbenv/versions
tar cpf $tarball_name.tar 1.9.3-p194
gzip -9 $tarball_name.tar
The tarball package name is of the following form:
rbenv-system-<platform>-<platform_version>-<ruby_version>-<arch>.tar.gz
Where:
<platform>
is the lowercase operating system name such as ubuntu. Thisnode['platform']
in ohai.<platform_version>
is the version number of the operating system releasenode['platform_version']
in ohai.<ruby_version>
is the name of the Ruby version directory that will be<arch>
is the machine's architecture such as x86_64. This is the valuenode['kernel']['machine']
in ohai.For example, the following are valid tarball package filenames:
rbenv-system-ubuntu-10.04-1.9.3-p194-x86_64.tar.gz
rbenv-system-ubuntu-10.10-ree-1.8.7-2012.02-i686.tar.gz
rbenv-system-ubuntu-11.10-jruby-1.7.0-dev-x86_64.tar.gz
Check out the rbenvinator project as a way to automate package building across multiple platoforms.
Tested on 0.10.8 but newer and older version should work just fine. File an issue if this isn't the case.
The following platforms have been tested with this cookbook, meaning that the recipes and LWRPs run on these platforms without error:
Please report any additional platforms so they can be added.
This cookbook depends on the following external cookbooks:
If you are installing JRuby then a Java runtime will need to be installed. The Opscode java cookbook can be used on supported platforms.
Depending on the situation and use case there are several ways to install this cookbook. All the methods listed below assume a tagged version release is the target, but omit the tags to get the head of development. A valid Chef repository structure like the Opscode repo is also assumed.
Librarian-Chef is a bundler for your Chef cookbooks.
Include a reference to the cookbook in a Cheffile and run
librarian-chef install
. To install Librarian-Chef:
gem install librarian
cd chef-repo
librarian-chef init
To reference the Git version:
cat >> Cheffile <<END_OF_CHEFFILE
cookbook 'rbenv_system_pkgs',
:git => 'https://github.com/fnichol/chef-rbenv_system_pkgs', :ref => 'v0.1.0'
END_OF_CHEFFILE
librarian-chef install
The knife-github-cookbooks gem is a plugin for knife that supports installing cookbooks directly from a GitHub repository. To install with the plugin:
gem install knife-github-cookbooks
cd chef-repo
knife cookbook github install fnichol/chef-rbenv_system_pkgs/v0.1.0
If the cookbook needs to downloaded temporarily just to be uploaded to a Chef Server or Opscode Hosted Chef, then a tarball installation might fit the bill:
cd chef-repo/cookbooks
curl -Ls https://github.com/fnichol/chef-rbenv_system_pkgs/tarball/v0.1.0 | tar xfz - && \
mv fnichol-chef-rbenv_system_pkgs-* rbenv_system_pkgs
A dated practice (which is discouraged) is to add cookbooks as Git submodules. This is accomplishes like so:
cd chef-repo
git submodule add git://github.com/fnichol/chef-rbenv_system_pkgs.git cookbooks/rbenv_system_pkgs
git submodule init && git submodule update
Note: the head of development will be linked here, not a tagged release.
This cookbook is not currently available on the site as it relies on a cookbook (rbenv) not available on the community site.
Downloads and extracts each Ruby tarball if it exists under the root_url.
Use this recipe if you hate waiting for your Ruby version to build.
The base URL from which all tarball packages are available.
The default is "http://s3.amazonaws.com/rbenv-system-pkgs"
.
The resource which occurs after rbenv is installed and intitialized. This resource will be subscribed to, ensuring that tarball packages are installed before a source compile is attempted.
The default is "log[rbenv-post-init-system]"
.
There are no resources and providers in this cookbook.
Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make.
Author:: Fletcher Nichol ([email protected])
Copyright 2012, Fletcher Nichol
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.