简体   繁体   中英

Do I need to install passenger as a regular gem even though my app uses bundler?

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 (ie require 'passenger' ), so that's not a concern either.

(Personally, I prefer using bundle install --deployment on the server, and RVM locally).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM