Phusion Passenger is throwing errors after upgrading Ruby and Rails using rvm
You're not using the RVM ruby in the Apache config, in your apache conf your pointing to the old system versions
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby1.8
You need to use the 1.9.3 that RVM has installed, easiest way is to install the passenger gem again and look at the output, when it's compiled it'll give you the correct conf, mine looks something like:
LoadModule passenger_module /Users/admin/.rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /Users/admin/.rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.9
PassengerRuby /Users/admin/.rvm/wrappers/ruby-1.9.3-p0/ruby
Deploying RoR App on Shared Host fails due to Ruby version error on Phusion Passenger
Does anybody have an idea why passenger has the wrong ruby versions besides that PassengerRuby in the Apache config file is wrong?
Passenger author here. The fact that PassengerRuby in the config file is wrong, is the only reason why you're having this problem. The only solution is to set PassengerRuby to the right instance.
If your shared host doesn't allow you to set PassengerRuby, then I recommend that you switch to a different. Try Digital Ocean for example. They're cheap, gives you full control, and we have a full end-to-end deployment walkthrough for Digital Ocean.
Rails on Passenger not recognizing RVM
You need to instruct Passenger to load RVM and then setup the environment for your gemset. The easiest way to go about this involves three steps:
Create a
.rvmrc
file: In the root of your rails project, create a file called.rvmrc
that contains the RVM command you would use to load up your gemset. For example:rvm use ree@gemset
Trust the
.rvmrc
file: Once you've deployed your new.rvmrc
file to your server, change directories into your rails project. RVM should ask you if you want to trust your.rvmrc
file; simply follow the instructions and typeyes
when asked. If the prompt does not appear, use the following command to trust your.rvmrc
:rvm rvmrc trust
Note: If you wish to automatically trust all
.rvmrc
s, it is a simple matter of adding:rvm_trust_rvmrcs_flag=1
to your personal or system wide rvmrc (
~/.rvmrc
and/etc/rvmrc
, respectively).Instruct passenger to set up the RVM environment: Instruct passenger to load up RVM and use the gemset in your
.rvmrc
file by creating a new file in your Railsconfig
directory calledsetup_load_paths.rb
(soconfig/setup_load_paths.rb
in all). The file should contain the contents of https://gist.github.com/870310:if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
raise "RVM ruby lib is currently unavailable."
end
end
# This assumes Bundler 1.0+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'Now when you restart your app (
touch tmp/restart.txt
) you should be good to go.
You should note that Passenger can only run one version of Ruby at a time; if Passenger was set up under something other than ree, you will probably have to reinstall Passenger and/or redo the wrapper script it generates.
Compile Passenger Native Support with RVM for different Ruby versions
Simple run 'passenger-config build-native-support' using the Ruby you wish to compile for.
For example:
rvm use 2.3.0
ruby /path-to-passenger-config build-native-support
Passenger doesn't care which Ruby you used to install Passenger. You can use Passenger with any Ruby, no matter which Ruby you used to install Passenger. https://www.phusionpassenger.com/library/indepth/ruby/multiple_rubies.html
Passenger throws Bundler::GemfileError after gem update --system
I was able to fix this by rolling back rubygems-update to the previously installed version by running
gem update --system 1.8.11
At which point all of my apps began working again. I'm still not sure what the problem was, and will gladly switch the accepted answer from my own to someone who can provide more insight into why updating rubygems-update would break Passenger integration.
Phusion passenger code being cached?
Looks like a stupid error on my part. Had an app folder sitting under app. So it was picking up the other helper file with the bad code, not the one i had updated. Happy i fixed it at least.
Related Topics
Are There Better Ways to Prevent 'Yield' When No Block Is Passed In
Missing a Template for This Request Format and Variant
Ruby: "&& Return" VS "And Return"
Verb-Agnostic Matching in Sinatra
How to Run Ruby 2.0 with Jruby 1.7
What Is a Worker in Ruby/Rails
How to Force One Field in Ruby's CSV Output to Be Wrapped with Double-Quotes
How to Find a Model's Relationships
Using the Value of a Variable as Another Variables Name in Ruby
Heroku: How to Push Seeds.Rb to Existing Rails App
Spork 0.9.2 and Rspec 3.0.0 = Uninitialized Constant Rspec::Core::Commandline (Nameerror)
Named Parameters in Ruby Structs
How to Convert Character Encoding with Ruby 1.9
Rails Console Not Working on Server
Run Delayed Jobs and Sidekiq at the Same Time
What Are the Advantages of Mocha Over Rspec's Built in Mocking Framework