Mongrel Cluster fails to start

867 views Asked by At

I have an issue with Mongrel cluster start-up, when I start the cluster I am getting the following error: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in 'gem_original_require': no such file to load -- /home/admin/test-project/test-app/config/environment (LoadError)

log file link

I am using this command to start the server (as root):

  • cd rails_app_path
  • mongrel_rails cluster::start

For mongrel set-up I did the following (as root):

  1. sudo gem install mongrel --include-dependencies
  2. sudo gem install mongrel_cluster --include-dependencies
  3. create mongrel user useradd -r mongrel
  4. groupadd www-data
  5. chown -R mongrel:www-data
  6. mongrel_rails cluster::configure -e production -p 3007 -N 2 -c -a 127.0.0.1 --user mongrel --group www-data

I have checked the permissions on the files in the config folder and they are as follows:

  • -rw-r--r-- 1 mongrel www-data 2795 Aug 10 03:24 boot.rb
  • -rw-r--r-- 1 mongrel www-data 255 Aug 24 13:01 database.yml
  • -rw-r--r-- 1 mongrel www-data 319 Aug 24 12:51 database.yml.bak
  • -rw-r--r-- 1 mongrel www-data 2086 Aug 27 11:22 environment.rb
  • drwxr-xr-x 2 mongrel www-data 4096 Aug 27 08:46 environments
  • drwxr-xr-x 2 mongrel www-data 4096 Aug 10 03:24 initializers
  • drwxr-xr-x 2 mongrel www-data 4096 Aug 10 03:24 locales
  • -rw-r--r-- 1 mongrel www-data 278 Aug 27 12:09 mongrel_cluster.yml
  • -rw-r--r-- 1 mongrel www-data 4037 Aug 22 09:49 routes.rb

Other details:

  1. OS - CentOS release 5.4
  2. Ruby - v 1.8.7
  3. Gem - v 1.3.7
  4. Rails - v 2.3.8
  5. Mongrel - v 1.1.5
  6. Mongrel Cluster - v 1.0.5

"mongrel_rails start" works fine.

Any help would be appreciated.

Thank you.

Govind Naroji

2

There are 2 answers

1
Daniel O'Hara On

Why are you doing cd /config/environment? You should start your server from the root directory of your application.

0
Govind N On

I suppose that I was getting this error due to permissions issue. all the files in the app/config folder were owned by mongrel user and I was trying to start it with root user.

I had switched to passenger and I was getting the same issue with passenger. The issue is now resolved - I made the admin user as the owner of all the files in the app and then started the server with user as admin.

We have decided to use passenger instead of mongrel as mongrel_cluster does seem to be broken in 2.3.8 - we are getting an ActionController::InvalidAuthenticityToken error with mongrel which we don't get on passenger or webrick.

So finally its passenger+nginx for us.

Cheers!

Govind Naroji