0

I'm currently digging deeper into Puppet and with several manifests I encounter problems regarding the installed ruby version or rubygems. I would guess that others probably also run in such problems. As I couldn't find the right pointers via Google, I'd like to ask if someone has a good example on using RVM with Puppet and run Bundler and Passenger inside a specific gemset provided by RVM.

I tried puppet-rvm from blt04 but it doesn't help running bundler inside a RVM gemset and I couldn't find information on configuring ruby applications to be run inside the RVM context (e.g. using a project .rvmrc)

Florian Feldhaus
  • 241
  • 2
  • 4
  • 11

2 Answers2

2
class rails::rvm {
    package { [ "autoconf",
                "bison",
                "curl",
                "libreadline-dev",
                "subversion",
                "zlib1g-dev" ]: ensure => installed }

file { "/usr/local/bin/rvm-install-system-wide":
    source => "puppet:///modules/rails/rvm-install-system-wide",
    mode => "700",
}

exec { "install-rvm":
    command => "/usr/local/bin/rvm-install-system-wide",
    creates => "/usr/local/bin/rvm",
    require => [ Package["curl"], Package["subversion"], File["/usr/ local/bin/rvm install-system-wide"] ],
    logoutput => on_failure,
    }

append_if_no_such_line { "setup-rvm-shell-environment":
    file => "/etc/bash.bashrc",
    line => "[[ -s /usr/local/rvm/scripts/rvm ]] && . /usr/local/ rvm/scripts/rvm",
}
}
  • I don't understand your answer. I guess the magic happens in `puppet:///modules/rails/rvm-install-system-wide` but I don't have that file. Which rails module do you use? How does this help running bundler or ruby applications within a RVM gemset? – Florian Feldhaus Aug 22 '12 at 16:39
0

What I do is add the users that will need to run rvm to the rvm group, and then prefix all execs with rvm do. Take a look at my gitorious module -- there's rvm stuff all over the place.

Daniel C. Sobral
  • 5,563
  • 5
  • 32
  • 48