Code Monkey home page Code Monkey logo

puppetlabs-ruby's Introduction

Ruby Module

This module manages Ruby and Rubygems on Debian and Redhat based systems.

Ruby

Parameters

  • version: (default installed) - Set the version of Ruby to install

  • gems_version: (default installed) - Set the version of Rubygems to be installed

  • rubygems_update: (default true) - If set to true, the module will ensure that the rubygems package is installed but will use rubygems-update (same as gem update --system but versionable) to update Rubygems to the version defined in $gems_version. If set to false then the rubygems package resource will be versioned from $gems_version

  • ruby_package: (default ruby) - Set the package name for ruby

  • rubygems_package: (default rubygems) - Set the package name for rubygems

Usage

For a standard install using the latest Rubygems provided by rubygems-update on CentOS or Redhat use:

    class { 'ruby':
      gems_version  => 'latest'
    }

On Redhat this is equivilant to

$ yum install ruby rubygems
$ gem update --system

Specify Version

To install a specific version of ruby and rubygems but not use rubygems-update use:

    class { 'ruby':
      version         => '1.8.7',
      gems_version    => '1.8.24',
      rubygems_update => false
    }

On Redhat this is equivilant to

$ yum install ruby-1.8.7 rubygems-1.8.24

Alternative Ruby Packages

If you need to use different packages for either ruby or rubygems you can. This could be for different versions or custom packages. For instance the following installs ruby 1.9 on Ubuntu 12.04.

    class { 'ruby':
      ruby_package     => 'ruby1.9.1-full',
      rubygems_package => 'rubygems1.9.1',
      gems_version     => 'latest',
    }

This parameter will be particularly important if an alternative package repository is defined with yumrepo or apt::source.

Ruby Configuration

Ruby Enterprise Edition, Ruby versions later than 1.9.3-preview1, and some patched Ruby distributions allow some tuning of the Ruby memory heap and garbage collection. These features will not work with the standard Ruby distributions prior to 1.9.3.

The ruby::config class sets global environment variables that tune the Ruby memory heap and it's garbage collection as per the Ruby Enterprise Edition documentation. This should allow the configuration of Ruby to better suit a deployed application and reduce the memory overhead of long-running Ruby processes (e.g. the Puppet daemon). The memory overhead issue can be further reduced by upgrading Ruby to a distribution using a bitmap marked garbage collection patch (e.g. as provided by BrightBox) or to Ruby 2.x.

Parameters

All the parameters are not set by default, which will revert to the default values for Ruby.

  • gc_malloc_limit : Sets RUBY_GC_MALLOC_LIMIT, which is the amount of memory that can be allocated without triggering garbage collection. The default is 8000000.
  • heap_free_min : Sets RUBY_HEAP_FREE_MIN, which is the number of heap slots that should be available after garbage collection is run. If fewer slots are available, new heap slots will be allocated. The default is 4096.
  • heap_slots_growth_factor : Sets RUBY_HEAP_SLOTS_GROWTH_FACTOR, which is the multiplier for how many new slots to be created if fewer slots than RUBY_HEAP_FREE_MIN remain after garbage collection. The default is 1.8.
  • heap_min_slots : This sets RUBY_HEAP_MIN_SLOTS, which is intial number of heap slots. The default is 10000.
  • heap_slots_increment : This sets RUBY_HEAP_SLOTS_INCREMENT, which is the number of additional slots allocated the first time addtional slots are required. The default is 10000.

Usage

It should be possible to set any number of parameters, but setting no parameters is a special case that removes any modification to the Ruby environment settings.

No Parameters

If ruby::config is given with no parameters it removes the environment settings from the system, which restores the default Ruby settings.

include ruby::config

With Parameters

class {'ruby::config':
  heap_min_slots            => 500000,
  heap_slots_increment      => 250000,
  heap_slots_growth_factor  => 1,
  gc_malloc_limit           => 50000000,
}

Which should result with the following environment variables set:

RUBY_HEAP_MIN_SLOTS=500000
RUBY_HEAP_SLOTS_INCREMENT=250000
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_GC_MALLOC_LIMIT=50000000

puppetlabs-ruby's People

Contributors

garethr avatar crayfishx avatar hunner avatar nanliu avatar bodepd avatar ghoneycutt avatar vjt avatar inkblot avatar

Watchers

 avatar James Cloos avatar  avatar  avatar  avatar  avatar Gerald Taylor avatar

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.