Mongrel_cluster and sudo to new user/group

I’m having trouble getting my mongrel_cluster to start up as a specified
user/group.

If I don’t have a user/group specified in mongrel_cluster.yml, I can
start up my app with ‘mongrel_rails cluster::start’, no problem.

As soon as I put a user and group in, and I do ‘sudo mongrel_rails
cluster::start’, my process does NOT start up. And I get this in my
mongrel log:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_requi re': no such file to load -- /home/rochkind/U2/config/environment (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequi
re’
from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:155:
in rails' [... omitted middle of stack trace -jrochkind ...] from /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243 from /usr/bin/mongrel_rails:18:inload’
from /usr/bin/mongrel_rails:18

Here’s what my mongrel_cluster.yml looks like:


user: umlaut
group: umlaut
prefix: /utest
cwd: /home/rochkind/U2/
log_file: log/mongrel.log
port: “3001”
environment: production
pid_file: tmp/pids/mongrel.pid
servers: 1

Any ideas? I’m at my wits end here.

Jonathan R. wrote:

I’m having trouble getting my mongrel_cluster to start up as a specified
user/group.

[…]

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’: no such file to load – /home/rochkind/U2/config/environment (LoadError)

Answering my own question, cause I can find this question on google, but
not an answer: My apps directory was not properly accessible from the
account I was trying to run it under. The app directories parent dir
needed ‘x’ permissions for the account I was telling mongrel_cluster to
run as.

As a result, mongrel_cluster couldn’t properly ‘cd’ to the app
directory. I figured that out by actually manually 'su’ing to the
account in question, and trying to start with mongrel_rails
cluster:start without a ‘user:/group:’ configured in the
mongrel_cluster.yml. Under that scenario, I got an accurate error
message warning me of the problem. Under the other scenario where you
use ‘sudo’ and put account/group in mongrel_cluster.yml, for some reason
instead of getting the informative error message you get that weird
misdirected one that looks like a (weird) gem loading error. But at any
rate, I have solved my problem.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs