Topic: Production Log only contains

The app is working perfectly in Development but when I visit the root URL in Production, it throws 500 (We're sorry, but something went wrong.). To be able to solve this, I opened the production.log file but it only contains details about migrations.
Something like,

Migrating to CreateUsers (20120315052321)
Migrating to CreateCompanies (20120315052437)
Migrating to CreateUsers (20120315052321)

I have set the log level to debug in production.rb,
config.log_level = :debug

The production.log file is writable as well.

What could be the issue?

Besides, why does it throw 500 in production environment? The database is working, migrations are all updated and bundle is all set. I tried commenting out the 'root to: ..' line routes.rb. The app does show the contents of public/index.html after that in production.

What could be the problem here?

P.S. Rails version: 3.2.2

Last edited by gauravmc (2012-04-07 14:45:39)

Re: Production Log only contains

on your production environment run:

rails console production

It should tell you what is going wrong.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Production Log only contains

Hey, thanks for the tip. 'rails console production' was showing a readline error. I solved it by reinstalling ruby 1.9.3 with readline. It works smoothly now and I can play around the models in rails console.
The logging has started working as well. But I still get 500 at the root URL.
Production log is showing a template error which I'm trying to resolve,

ActionView::Template::Error (Permission denied - path_to_app/releases/20120408102634/tmp/cache)

Could you help with this?

Re: Production Log only contains

It's (as it says) a permission problem.  How are you deployed in production? Which web server,  what server platform OS, etc.

Usually it's because the web server, (say apache)  runs as a specific user id (say it runs a user web),  and you uploaded your rails app while logged in as some other user id,  and the user web doesn't have permission to write into your rails app directories.

Typically it's solved with  chmod, chown and or chgrp commands,  i.e.

chown - R web /path_to_your_rails_app/*

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Production Log only contains

You're right, the error is self explanatory, but I did all the chown/chmod on the required folders. It's not working yet. Showing the same error. I've deployed the app on apache server, CentOS 5.6.
I have another rails app on the same server at a differey subdomain and that one works smoothly. Not able to solve the problem with this one.

You said about apache running with a different user? Anyway I could find this user id and its group for the same?

Re: Production Log only contains

Okay, checked out httpd.conf
User nobody
Group nobody

Does it matter if the user is 'nobody' and not 'web' or 'apache'? Would changing it break other things?

Re: Production Log only contains

That depends,  but it's probably best to leave the httpd.conf alone and change the permissions on your rails app to match.

Are you using VirtualHosts's in the apache config?

can you log into the host as nobody?

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Production Log only contains

Yes, I'm using VirtualHosts for different apps. I cannot log into the host as 'nobody'.
Forgot to mention, the app started working,
chown -R nobody /path_to_your_rails_app/ did the trick I guess.

Both of your tips helped. Thanks. smile