Giter VIP home page Giter VIP logo

chef-chruby-build's Introduction

Chruby Build Chef Cookbook

Build Status Cookbook Version

Chef cookbook to install chruby and build rubies from source with Google Perftools / TCMalloc : Thread-Caching Malloc and LibYAML options.

Requirements

supports

  • ubuntu >= 12.04

depends

version

  • chef >= 13.4

Installation

Use the knife command:

$ knife supermarket install chruby-build

Edit Berksfile

source "https://supermarket.chef.io"

cookbook 'chruby-build', '~> 1.0.2'

Install the cookbooks you specified in the Berksfile and their dependencies:

$ berks install

Attributes

See attributes/default.rb

Usage

Rubies attributes

  • id - required id and must be split by a dash (eg. ruby-2.3.4)
  • url - required ruby source
  • checksum - optional sha256 package checksum
  • gems - optional gems to install
  • environment - optional compilation environment variables

With node attributes

{
  "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"
        }
      }
    ]
  }
}

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.

Recipes

chruby-build::default

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]"
  ]
}

chruby-build::rubies

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]"
  ]
}

Development

Dependencies

Installation

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

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License

Written by Vincent Durand.

Released under the terms of the MIT License. For further information, please see the file LICENSE.txt.

chef-chruby-build's People

Contributors

madwork avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

chef-chruby-build's Issues

checksum issues

I am unable to find all the checksums needed for all various versions and honestly that stuff isn't for me. Is there a way to turn that off somehow or can you point me to the various places to find the checksums or lastly could you update everything to the latest and greatest?

Data bag exception not being rescued

Discovered during a Kitchen run:

$ chef-client --version
Chef: 11.14.2
$ berks list | grep chruby
  * chruby-build (0.3.1)
$ kitchen --version
Test Kitchen version 1.2.1

Run the recipe chruby-build::rubies without any data bags, and the error raised will be a Net::HTTPServerException:

Recipe Compile Error in /tmp/kitchen/cache/cookbooks/static-sites/recipes/default.rb       
================================================================================       

Net::HTTPServerException       
------------------------       
404 "Not Found "       

Cookbook Trace:       
---------------       
  /tmp/kitchen/cache/cookbooks/chruby-build/recipes/rubies.rb:32:in `from_file'       
  /tmp/kitchen/cache/cookbooks/static-sites/recipes/default.rb:56:in `from_file'       

Relevant File Content:       
----------------------       
/tmp/kitchen/cache/cookbooks/chruby-build/recipes/rubies.rb:       

 25:  #       
 26:  require 'ostruct'       
 27:         
 28:  include_recipe "chruby-build::default"       
 29:  include_recipe "apt"       
 30:         
 31:  begin       
 32>>   rubies = data_bag('rubies').map{ |rubie| data_bag_item('rubies', rubie) }       
 33:  rescue Chef::Exceptions::InvalidDataBagPath, Chef::Exceptions::InvalidDataBagName       
 34:    Log.info "Missing data bags directory data_bags/rubies, try with node attributes."       
 35:  end       
 36:         
 37:  rubies ||= node['chruby_build']['rubies']       
 38:         
 39:  if rubies.any?       
 40:         
 41:    node['chruby_build']['rubies_libs'].each do |lib|       

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.