Nginx/Passenger runs a Rails app owned by another user. How do i prevent doing "bundle install" for both users?
Environment
I used passenger-install-nginx-module to install Nginx/Passenger for user nginxer.
I uploaded a Rails project and owned it to user projecter.
Then i followed the RVM integration with Passenger manual and created the .rvmrc
file, editing the paths so that they point to projecter's .rvm. I also created the config/setup_load_paths.rb
file and uncommented the two lines for Bundler 1.x.
I did bunlde install
from user projecter and successfully performed migrations.
Problem
But the project wouldn't start unless i do bundle install
from the nginxer user:
no such file to load -- bundler/setup
Backtrace:
/home/nginxer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
I thought that Nginx/Passenger should run the app with the user who owns the project.
Some environment info
Here's an rvm gemset list
run by nginxer in the project folder:
$ rvm gemset list
gemsets for ruby-1.9.2-p290 (found in /home/redminer/.rvm/gems/ruby-1.9.2-p290)
global
=> redmine
Here's an rvm info
run by nginxer in the project folder:
$ rvm info
ruby-1.9.2-p290@redmine:
system:
uname: "Linux li308-242 3.0.4-linode37 #1 SMP Mon Sep 12 12:00:58 EDT 2011 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.8.3 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p290"
date: "2011-07-09"
platform: "i686-linux"
patchlevel: "2011-07-09 revision 32553"
full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]"
homes:
gem: "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine"
ruby: "/home/projecter/.rvm/rubies/ruby-1.9.2-p290"
binaries:
ruby: "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
irb: "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
gem: "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
rake: "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine/bin/rake"
environment:
PATH: "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine/bin:/home/projecter/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin:/home/projecter/.rvm/bin:/home/projecter/.rvm/gems/ruby-1.9.2-p290/bin:/home/nginxer/.rvm/gems/ruby-1.9.2-p290/bin:/home/nginxer/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/nginxer/.rvm/rubies/ruby-1.9.2-p290/bin:/home/nginxer/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
GEM_HOME: "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine"
GEM_PATH: "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine:/home/projecter/.rvm/gems/ruby-1.9.2-p290@global"
MY_RUBY_HOME: "/home/projecter/.rvm/rubies/ruby-1.9开发者_如何学Python.2-p290"
IRBRC: "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/.irbrc"
RUBYOPT: ""
gemset: "redmine"
So the question is…
Is it normal that i have to do "bundle install" both for nginxer and for projecter?
If not, how do i make Nginx/Passenger use projecter's gemset?
You can specify which user the passenger server runs as, are you doing that?
http://modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_user_lt_username_gt
精彩评论