Im trying to setup a new server to host a Rails app and want a clean installation of all the components so i decided to use rvm+bundler. Its my first time setting up a Rails server.
I've used bundler with an app before and I understand how it manages the App's dependencies... but since Im installing Passenger and since this is the hosting environment's dependency, I need to do a 'gem install passenger' on the box itself instead of bundling this dependency, right? Or should I be putting passenger in the Gemfile of the app ?
The application itself would run without having passenger installed (unicorn, webrick, mongrel, thin, etc.), therefore passenger shouldn't really be in the Gemfile. Installing passenger as a gem separately would be the correct choice in this instance.
Look at the Gemfile as a list of the gems that your application is using. Passenger is using your application to serve data to the user, rather than your application using it. Down the road, you may consider using another application server, and you shouldn't have to change any portion of your application, even the Gemfile, to make that change.
However, if your application is actually using passenger-specific features or portions of the passenger gem internally, then you should include it. For example, if you were using a class declared in passenger, then you would be depending on it, and should include it in your Gemfile.
You should read RVM's guide to using Passenger with RVM.
In short, since your web server can only use one version of Ruby and one version of Passenger at a time, you need only install Passenger once, but it shouldn't hurt if it's installed for individual gemsets as well (and thus in your Gemfile). Rails also doesn't need to load passenger itself (i.e. require 'passenger'
), so that's not a concern either.
(Personally, I prefer using bundle install --deployment
on the server, and RVM locally).