Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


sk_ruby (4) Versions 1.0.5

LWRPs for installing source-built rubies. Automatically uploads built s3 binaries. Subsequent runs will download instead of rebuilding.

cookbook 'sk_ruby', '= 1.0.5'
cookbook 'sk_ruby', '= 1.0.5', :supermarket
knife cookbook site install sk_ruby
knife cookbook site download sk_ruby

Chef sk_ruby Cookbook

Build Status


LWRP to build and install ruby binaries from source into /opt. Uses fpm to package into RPMs or deb files. Will download a prebuilt cached package from a URL instead of source-compiling. If given s3 credentials, after source compiling it will upload the pacakge to s3 to avoid the build step for other servers (and to completely automate the compile-package-upload-to-s3 process).

This does not use rbenv/rvm/chruby. It just builds a package and install it into /opt. There is a helper RPM to wire up all the binaries into /usr/bin if you want the package to replace the system ruby packages (otherwise you probably want to either be specific with the full path to ruby in your shebangs, or else you want to get the /opt installed ruby into the PATH where it needs to be used).


  • Ubuntu 13.04
  • Ruby >= 1.9
  • Chef >= 11.6.0 (sk_s3_file dependency)

Cookbook Dependencies

  • build-essential
  • apt
  • sk_s3_file



This resource source compiles ruby and uses s3 as a cache for the deb/rpm artifact that it produces.


This will compile ruby-2.1.0 with rubygems 2.2.1 and the listed gems pre-installed. It will use the "mybucket" s3 bucket to store and retrieve the compiled rubygems package. The resultant package will install in /opt/ruby-2.1.0/bin/ruby. I've pulled the AWS creds out of an encrypted data bag as a best-practices example.

my_gems = %w{ bundler rake fpm pry thor puma unicorn thin webrick }

creds = Chef::EncryptedDataBagItem.load("encrypted", "creds")

sk_ruby "2.1.0" do
  rubygems "2.2.1"
  gems my_gems
  cache_uri_base ""
  pkg_version "0.0.1"
  aws_access_key_id creds["ec2_access_key"]
  aws_secret_access_key creds["ec2_secret_key"]
  aws_bucket "mybucket"
  aws_path "ruby"


  • :install - install the ruby package, build and upload if required


  • version - Ruby version, must be of the form "1.9.3-p484" or "2.1.0" (NAME ATTRIBUTE)
  • rubygems - Version of rubygems to install
  • pkg_version - Iteration of the package (previous iterations will be upgraded)
  • gems - Additional gems to install
  • cache_uri_base - The base of the URI to find the cached package at
  • install_path - Path to install the ruby to (defaults to /opt/ruby-<version>)
  • ruby_url - URI to download ruby from (defaults to correct URI)
  • deb_file - Name of the package to build/install (defaults to ruby-<version>-<pkg_version>_<platform>_<platform_version>_<arch>.deb)

Excluding any of these will avoid publishing to s3, but compile+install will still work:

  • aws_access_key_id - Access key for uploading to s3
  • aws_secret_key_id - Secret key for uploading to s3
  • aws_bucket - Bucket for uploading to s3
  • aws_path - Path inside the bucket for uploading to s3

This is a mini-alternatives system. It will look in the directory you specify and symlink all the binaries into /usr/bin. By default it skips chef binaries to not conflict with omnibus-installed chef. You probably only want to use one of these resources.


This will setup symlinks in /usr/bin for the ruby-2.1.0 installed by the previous sk_ruby resource.

sk_ruby_symlinks "/opt/ruby-2.1.0/bin"


  • :install - Setup the symlinks


  • bin_path - Path to the ruby binary directory (NAME ATTRIBUTE)
  • exclude - List of binaries not to link into /usr/bin (defaults to chef-client, knife, chef-solo, chef-shell, chef-apply, ohai, shef)


  • default - Installs build depdendencies for building ruby based on the platform of the host (OPTIONAL)




Put 'depends sk_ruby' in your metadata.rb to gain access to the LWRPs in your code.

Similar Cookbook

License and Author

Copyright:: 2014 Lamont Granquist

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

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

sk_s3_file >= 0.0.0
apt >= 0.0.0
build-essential >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

No quality metric results found