Adding Bundler to Passenger Hosted Apps
We upgraded one of our applications to manage dependencies with bundler at PatientsLikeMe. When we deployed the new version of the application on a Passenger app server, we saw errors loading our bundle:
rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
Some quick googling show this is a problem with rubygems on the system, with the fix being to upgrade rubygems as follows:
$> sudo gem update --system $> gem -v 1.3.7
We restarted the application via:
However, we still experienced the same bundler problem – as if the wrong gem system were being used in an RVM or multi-ruby environment.
This is an easy gotcha, as tmp/restart.txt only re-loads the application via the Passenger Spawn process, it doesn’t reload Passenger or the configuration.
When you’re changing system gems or other configuration loaded by Passenger, you need to restart the entire Apache stack hosting Passenger:
sudo /usr/sbin/apachectl restart
This resolved the problem.