Chef cookbook to install chruby and build rubies from source with Google Perftools / TCMalloc : Thread-Caching Malloc and LibYAML options.
ubuntu >= 12.04
apt
- Opscode Cookbook aptark
- Opscode Cookbook ark
From the Community Site
Use the knife command:
$ knife cookbook site install chruby-build
With librarian-chef
Edit Cheffile
site "https://supermarket.chef.io/api/v1"
cookbook 'chruby-build', '~> 0.4.0'
Resolves and installs all of the dependencies:
$ librarian-chef install
With berkshelf
Edit Berksfile
source "https://supermarket.getchef.com"
cookbook 'chruby-build', '~> 0.4.0'
Install the cookbooks you specified in the Berksfile and their dependencies:
$ berks install
Description | Type | Default |
---|---|---|
['chruby_build']['version'] | ||
chruby version | String | "0.3.9" |
['chruby_build']['checksum'] | ||
chruby checksum (SHA256) | String | "7220a96e355b8a613929881c091ca85ec809153988d7d691299e0a16806b42fd" |
['chruby_build']['auto_switching'] | ||
chruby auto switching | Boolean | true |
['chruby_build']['rubies'] | ||
rubies to install | Array | [] |
['chruby_build']['rubies_path'] | ||
path to install rubies | String | "/opt/rubies" |
['chruby_build']['rubies_libs'] | ||
usefull libraries to install | Array | ["libssl-dev", "libreadline-dev", "zlib1g-dev"] |
['chruby_build']['google_perftools']['enable'] | ||
compile rubies with google_perftools (tcmalloc) | Boolean | true |
['chruby_build']['google_perftools']['url'] | ||
google_perftools url | String | "https://github.com/gperftools/gperftools/archive/gperftools-2.7.tar.gz" |
['chruby_build']['google_perftools']['version'] | ||
google_perftools version | String | "2.7" |
['chruby_build']['google_perftools']['checksum'] | ||
google_perftools checksum | String | "3a88b4544315d550c87db5c96775496243fb91aa2cea88d2b845f65823f3d38a" |
['chruby_build']['libyaml']['enable'] | ||
compile libyaml (latest release) | Boolean | true |
['chruby_build']['libyaml']['url'] | ||
libyaml url | String | "https://pyyaml.org/download/libyaml/yaml-0.2.1.tar.gz" |
['chruby_build']['libyaml']['version'] | ||
libyaml version | String | "0.2.1" |
['chruby_build']['libyaml']['checksum'] | ||
libyaml checksum | String | "78281145641a080fb32d6e7a87b9c0664d611dcb4d542e90baf731f51cbb59cd" |
id
- required id and must be split by a dash (eg. ruby-2.3.4)url
- required ruby sourcechecksum
- optional sha256 package checksumgems
- optional gems to installenvironment
- optional compilation environment variables
{
"ark": {
"prefix_root": "/usr/local/src"
},
"chruby_build": {
"rubies": [
{
"id": "ruby-2.5.3",
"url": "https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.gz",
"checksum": "9828d03852c37c20fa333a0264f2490f07338576734d910ee3fd538c9520846c",
"gems": ["bundler 1.17.1"],
"environment": {
"ARCHFLAGS": "-arch x86_64",
"CFLAGS": "-g -O2",
"CPPFLAGS": "-I/usr/include -I/usr/local/include"
}
}
]
}
}
With data bags
Data bag name must be rubies
$ knife data bag create rubies ruby-2.5.3
Edit data bag ruby-2.5.3.json
{
"id": "ruby-2.5.3",
"url": "https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.gz",
"checksum": "9828d03852c37c20fa333a0264f2490f07338576734d910ee3fd538c9520846c",
"gems": ["bundler 1.17.1"],
"environment": {
"ARCHFLAGS": "-arch x86_64",
"CFLAGS": "-g -O2",
"CPPFLAGS": "-I/usr/include -I/usr/local/include"
}
}
If you are using knife solo as provisioner, try knife-solo_data_bag.
Data bags have higher precedence.
This recipe only installs chruby.
Just include chruby-build::default
in your node's run_list
:
{
"name":"my_node",
"run_list": [
"recipe[chruby-build::default]"
]
}
This recipe installs chruby and compile rubies from source.
Just include chruby-build::rubies
in your node's run_list
:
{
"name":"my_node",
"run_list": [
"recipe[chruby-build::rubies]"
]
}
Ensure the gem dependencies are installed:
$ bundle install
$ bundle exec berks install
Running unit tests:
$ bundle exec rspec
Running integration tests:
$ bundle exec kitchen test rubies-data-bags-ubuntu-1404
Different test suites are available:
$ bundle exec kitchen list
$ bundle exec kitchen setup default-ubuntu-1404
$ bundle exec kitchen verify default-ubuntu-1404
$ bundle exec kitchen destroy default-ubuntu-1404
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Written by Vincent Durand.
Released under the terms of the MIT License. For further information, please see the file LICENSE.txt.