Howto tell Apache that he should use the rvm ruby and gemset

I am installing a backup server for a Centos 7 machine. But this backup
machine is 32 bit, therefore no Centos 7, because Centos 7 exists only
for 64 bit machines. So I installed Centos 6.5 on the backup machine.

My problem is: on the primary machine I have ruby 2.0 installed which
comes with Centos 7, but on Centos 6.5 on the backup machine, there is
ruby 1.8.6. Therefore, I installed rvm on the backup machine and with
rvm I installed ruby 2.0 and declared it the default ruby version.

One of the major application on this pair of machines is a ruby
web-application running under apache web server. Unfortunately the
apache web server does not recognize the rvm default installation,
apache insists on using ruby 1.8.6 and its gemsets. The error message I
get from apache when invoking the web application is

[Wed Sep 03 09:02:44 2014] [error] [client
aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b
6] /usr/lib/ruby/gems/1.8/gems/gettext-3.1.4/lib/gettext/mo.rb:46,
referer: ht
tps://ns3.dyn.lan/?myuser
[Wed Sep 03 09:02:44 2014] [error] [client
aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b
6] : , referer: https://ns3.dyn.lan/?myuser
[Wed Sep 03 09:02:44 2014] [error] [client
aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b
6] undefined method force_encoding' for "\\225\\004\\022\\336":String, refere r: https://ns3.dyn.lan/?myuser [Wed Sep 03 09:02:44 2014] [error] [client aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b 6] (, referer: https://ns3.dyn.lan/?myuser [Wed Sep 03 09:02:44 2014] [error] [client aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b 6] NoMethodError, referer: https://ns3.dyn.lan/?myuser [Wed Sep 03 09:02:44 2014] [error] [client aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b 6] ), referer: https://ns3.dyn.lan/?myuser [Wed Sep 03 09:02:44 2014] [error] [client aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b 6] \tfrom /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_or
iginal_require’, referer: https://ns3.dyn.lan/?myuser
[Wed Sep 03 09:02:44 2014] [error] [client
aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b
6] \tfrom /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
requir e', referer: https://ns3.dyn.lan/?myuser [Wed Sep 03 09:02:44 2014] [error] [client aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b 6] \tfrom /usr/lib/ruby/gems/1.8/gems/gettext-3.1.4/lib/gettext/text_domain.rb :16, referer: https://ns3.dyn.lan/?myuser [Wed Sep 03 09:02:44 2014] [error] [client aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b 6] \tfrom /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_or
iginal_require’, referer: https://ns3.dyn.lan/?myuser
[Wed Sep 03 09:02:44 2014] [error] [client
aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b
6] \tfrom /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`requir
e’, referer: https://ns3.dyn.lan/?myuser
[Wed Sep 03 09:02:44 2014] [error] [client
aaaa:bbbb.cccc:0:92e6:baff:fe52:f4b
6] \tfrom
/usr/lib/ruby/gems/1.8/gems/gettext-3.1.4/lib/gettext/text_domain_ma

Apparently, apache does not recognize, that I have ruby 2.0 as default:

[cellino@newserv ~]$ rvm list

rvm rubies

=* ruby-2.0.0-p481 [ i686 ]

=> - current

=* - current && default

* - default

[cellino@newserv ~]$ rvm list gemsets

rvm gemsets

=> ruby-2.0.0-p481 [ i686 ]
ruby-2.0.0-p481@global [ i686 ]
ruby-2.0.0-p481@myapp [ i686 ]

[cellino@newserv ~]$

How can I tell apache to use the rvm default?

I you need more information, please tell me.

thanks in advance.

suomi

See if this helps:

http://rvm.io/integration/passenger

7stud – wrote in post #1156747:

See if this helps:

RVM: Ruby Version Manager - Phusion Passenger - Come on, ride the train, hey, ride it, woo woo...

Unfortunately, this does not help either…
Thanks anyway.

suomi

Thanks for coming back and posting your solution.

FYI:

The following helped (after searching 8 more hours):

In the apache config for the respective VirtualHost set:

<VirtualHost …>

SetEnv GEM_HOME /usr/local/rvm/gems/ruby-2.0.0-p481
SetEnv MY_RUBY_HOME /usr/local/rvm/rubies/ruby-2.0.0-p481
SetEnv GEM_PATH
/usr/local/rvm/gems/ruby-2.0.0-p481:/usr/local/rvm/gems/ruby-2.0.0-p481@global
SetEnv RUBY_VERSION ruby-2.0.0-p481