简体   繁体   中英

Rails 3 in production mode (apache and thin) can't find rubygems

I apologize in advance if this question is a duplicate, but I've done a lot of searching and I haven't found any answers that help with my issue. I'm running a Rails 3 app on an Ubuntu server with Apache proxying to thin. I can run a single instance of thin or WebBrick, and my application loads on port 3000. I am using the instructions from Slicehost on how to do Apache and Thin to serve Rails (which I had working in the past), but whenever I try to start the daemonized thin processes, the logs for each thin server look like this:

/[ my application's location]/config/boot.rb:2:in `require': no such file to load -- rubygems (LoadError)
        from /home/geoff/ldb/doubleday/config/boot.rb:2
        from /home/geoff/ldb/doubleday/config/application.rb:1:in `require'
        from /home/geoff/ldb/doubleday/config/application.rb:1
        from /home/geoff/ldb/doubleday/config/environment.rb:2:in `require'
        from /home/geoff/ldb/doubleday/config/environment.rb:2
        from /usr/lib/ruby/1.8/rack/adapter/rails.rb:43:in `require'
        from /usr/lib/ruby/1.8/rack/adapter/rails.rb:43:in `load_application'
        from /usr/lib/ruby/1.8/rack/adapter/rails.rb:23:in `initialize'
        from /usr/lib/ruby/1.8/rack/adapter/loader.rb:36:in `new'
        from /usr/lib/ruby/1.8/rack/adapter/loader.rb:36:in `for'
        from /usr/lib/ruby/1.8/thin/controllers/controller.rb:163:in `load_adapter'
        from /usr/lib/ruby/1.8/thin/controllers/controller.rb:67:in `start'
        from /usr/lib/ruby/1.8/thin/runner.rb:174:in `send'
        from /usr/lib/ruby/1.8/thin/runner.rb:174:in `run_command'
        from /usr/lib/ruby/1.8/thin/runner.rb:140:in `run!'
        from /usr/bin/thin1.8:6

I'm running Ruby 1.9.2, RubyGems 1.5.0, and RVM. I can start the rails app as a non-daemonized process in the shell as root, myself, or www-data. It seems that whenever I try to run this as a daemon, it doesn't load paths properly. I've tried inserting environment variables into some files to help rails find Rubygems, but that doesn't seem to work. Any ideas as to how to help Rails find Rubygems when it's started by a daemon?

Thanks, Geoff

This looks like an RVM error. You should check how you're loading your thin server, it'll need to use an RVM wrapper or something similar to configure the right binaries and gemsets.

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