puppet-rvm icon indicating copy to clipboard operation
puppet-rvm copied to clipboard

rvm::passenger::apache fails for ubuntu 12.04 / ruby-2.0.0-p195 / passenger 4.0.2

Open flipkick opened this issue 11 years ago • 5 comments

Using this as node config for a ubuntu 12.04 system;

rvm_system_ruby {
  'ruby-2.0.0-p195':
  ensure => 'present',
  default_use => true;
}

class {
  'rvm::passenger::apache':
    version => "4.0.2",
    ruby_version => "ruby-2.0.0-p195",
    mininstances => 3,
    maxinstancesperapp => 0,
    maxpoolsize => 30,
    spawnmethod => "smart-lv2";
}

fails with this exception on the node:

Notice: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/Exec[passenger-install-apache2-module]/returns:  * Checking for Zlib development headers...
Notice: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/Exec[passenger-install-apache2-module]/returns:       Found: yes
Notice: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/Exec[passenger-install-apache2-module]/returns:       Location: /usr/include/zlib.h
Notice: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/Exec[passenger-install-apache2-module]/returns: /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.2/lib/phusion_passenger/platform_info/ruby.rb:195:in `expand_path': non-absolute home (ArgumentError)

flipkick avatar May 15 '13 19:05 flipkick

Same here. But logging into the machine and running the passenger install command manually fixes it.

I'm running debian 6, ruby-1.9.3-p429, passenger-3.0.21 inside vagrant.

nlsrchtr avatar May 30 '13 20:05 nlsrchtr

I had this same issue on CentOS 6.4. Turns out it's caused by having an empty HOME environment variable. I fixed it using the following:

Exec { 
    environment => "HOME=/home/vagrant/" 
}

adamcohen avatar Jun 06 '13 07:06 adamcohen

Running the command manually works without any problems:

/usr/local/rvm/bin/rvm ruby-1.9.3-p429 exec passenger-install-apache2-module -a

Would be great if there would be a fix without managing the environment variables.

nlsrchtr avatar Jun 12 '13 11:06 nlsrchtr

I'm guessing it works when you run the command manually because you've logged in with an interactive shell that has $HOME set correctly.

I believe the issue is caused by this pull request: (#5224) Unset USER-related env vars during execs

The fix would be for phusion passenger to be careful about using File.expand_path with "~/.rvm" if the HOME environment variable hasn't been set. I don't think there's much we can do in this puppet rvm module to rectify this, other than my suggestion of setting the HOME environment variable in an Exec command as above.

adamcohen avatar Jun 13 '13 00:06 adamcohen

We can hack around it via su -c

  exec {
    'passenger-install-apache2-module':
      command     => "/bin/su - root -c \'${rvm::passenger::apache::binpath}rvm ${rvm::passenger::apache::ruby_version} exec passenger-install-apache2-module -a\'",
      creates     => "${rvm::passenger::apache::gempath}/passenger-${rvm::passenger::apache::version}/ext/apache2/mod_passenger.so",
      logoutput   => 'on_failure',
      require     => [Rvm_gem['passenger'], Package['httpd','httpd-devel','mod_ssl']];
  }

evilensky avatar Nov 11 '13 17:11 evilensky