Phil
Phil

Reputation: 3994

Knowledge gap when setting up Passenger and Rails

I am trying to set up Passenger, Rails and Nginx. Nginx correctly routes to Passenger but when I load the page I get the following error:

cannot load such file -- bundler/setup (LoadError)
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:219:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:333:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:217:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:96:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:150:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'

What I don't understand is:

I have installed bundler basically everywhere I can, but must have missed something important.

I feel I am close to grasping the entire thing now but haven't been able to read myself to the solution.

If you go to http://privateering.me:8000/ you can see the rest of the error dump.

Upvotes: 0

Views: 576

Answers (1)

colinm
colinm

Reputation: 4288

It's morning! I've had my coffee! Let's go!

What I don't understand is why there are a bunch of references to ruby 1.9.1?

As tessi mentioned, 1.9.1 in the path is normal for some builds of Ruby 1.9.3. It's weird and confusing, but it is what it is. This is not immediately concerning by itself.

Furthermore, how can I change which user passenger runs on?

Phusion has some very good documentation for Phusion/Nginx which includes all of the configuration parameters. But it's probably not necessary because, as the user-related docs will tell you, Passenger by default will attempt to run each application as the user that owns it.

Am I supposed to install a bunch of gems on passenger's user as well?

Maybe. Probably not. See above. Whenever possible, there is no one "Passenger user". Only if user switching is unavailable will Passenger fall back to operating as a single user (whatever nginx is configured for).

Why isn't this setup during installation of the nginx passenger bundle?

Because Passenger is simply a multitenant, polyglot application server. It doesn't know if you're running one application or a hundred, Ruby or Python, Rails or Sinatra or Merb or something home-brewed. Passenger's job is to run the application once you tell it what that is; your job is to get each application into a runnable state.

How does RVM complicate things? What do I need to be aware of when using RVM? Does every user in the system get the ruby version I set in RVM? How can I make it so if not?

RVM complicates things sufficiently. By default, it's installed on a single-user basis and affects only a single user. This is its exact intended use case: when I'm logged in, I want a different Ruby and don't want to pollute the system. There are additional complications due to the particular way RVM works.

But Phusion realizes some people are going to be using RVM in production for whatever reason and covers that situation in the installation documentation.

Most pain involving RVM and Passenger is easily avoided by cutting RVM out of the picture. Unless you're on an extremely exotic platform, building a modern Ruby is a matter of ./configure && make && make install. One line and you've got a stable, system-wide Ruby in /usr/local, easily accessible by you, Passenger, and everything else.

Upvotes: 3

Related Questions