Solved

Rails site down - deprecated with 2.1.1 upgrade

Posted on 2008-10-08
15
963 Views
Last Modified: 2013-11-13
My host upgraded Rails to 2.1.1 recently, which deprecated my Rails site done with 1.2.5.

My site died at a crucial time and I managed to get the local debug version running again on my machine, thanks to some changes in environment.rb and boot.rb, as well as changing some deprecated stuff that had been removed in 2.1.

I've uploaded the new files but am still crashing. My site is at www.chillisoft.co.za. I tried uploading a sitedown.html to help customers, but that won't show either.

At least in the short-term I need to do two things. Redirect these errors to www.chillisoft.co.za/sitedown.html and/or display errors so I can see what is causing the continued crashing. Do I need to restart the webserver and how do I do this? I'm a little new at this stuff.

My .htaccess file is as follows:

------------------------

# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]


RewriteCond %{REQUEST_URI} ^/blog.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/habanero/forum.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/habanero/wiki.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/support/mantis.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/sitedown.html
RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp


RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be r$
#
# Example:
# ErrorDocument 500 /500.html

# ErrorDocument 500 "<h2>Application error</h2>Rails application failed to
start properly"
# ErrorDocument 500 sitedown.html
0
Comment
Question by:corebiz
  • 9
  • 6
15 Comments
 
LVL 14

Accepted Solution

by:
wesgarrison earned 500 total points
Comment Utility
You can freeze to a specific version of Rails.

If you've got shell access and subversion, the easiest way is to export the version you want into /vendor/rails:

svn export http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-5/ ./vendor/rails
Run that command from the root of your project.

Or, download it locally and upload it.

When the rails server starts up, it looks for that folder and uses the rails version in it if it exists.

0
 

Author Comment

by:corebiz
Comment Utility
I have upgraded my site to 2.1.1 and uploaded the affected files, so would rather be live with the latest version.   (And I'm not using subversion here)

My conclusion is that I either have missed something that needs to be changed, or that something needs to refreshed or rebooted, and I'm not really sure where to start.

The worst of it is that I'm not getting any useful errors on the screen or in the log files.
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
Also, if you'll let me know who your host is, I might be able to help you out a little better since every host is different.

Specifically, I don't know how you restart your webserver.  It depends on what webserver you're using!
0
 

Author Comment

by:corebiz
Comment Utility
I'm using Dreamhost and am getting a 500 Internal Server Error, which is worse than what I was getting before.

We were just getting a TCP Error, while others on other continents were getting the error message from the htaccess file (Rails application failed to start).  Now we're getting the 500, which I half-imagine is from my fiddling with htaccess.
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
Well, you don't need subversion on your computer, but on the host.
However, since you're getting it working with the new version, that's a moot point.

Are you running in production mode?  If so, less errors get sent to the screen.  Try development mode.

If you want to zip and email your project to me (without the rails files!), I'll check it out for you so you can get back up asap.

Did this not work in your .htaccess?
ErrorDocument 500 sitedown.html
You might need to preface it with a / => /sitedown.html
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
Here's the link to ErrorDocument:
http://httpd.apache.org/docs/2.0/mod/core.html#errordocument

But, here's what you really need to know:
URLs can begin with a slash (/) for local web-paths (relative to the DocumentRoot), or be a full URL which the client can resolve. Alternatively, a message can be provided to be displayed by the browser. Examples:

ErrorDocument 500 http://foo.example.com/cgi-bin/tester
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 /subscription_info.html
ErrorDocument 403 "Sorry can't allow you access today"
So, you need a slash, or you can put a file on another host, or you can just put a short message directly in the file.  
0
 

Author Comment

by:corebiz
Comment Utility
Thanks, I managed to find the error log on my host and sorted out the ErrorDocument line.  The non-Rails pages are working correctly again.

However, I'm back to my old problem of the site just loading and loading and then showing a "Network Error"/TCP error:

-----------------

Network Error (tcp_error)

A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.

For assistance, contact your network support team.

-------------------

This is what is showing in error.log:

[Wed Oct 08 01:36:41 2008] [error] [client 195.137.103.229] FastCGI: comm with (dynamic) server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi" aborted: (first read) idle timeout (60 sec), referer: http://www.chillisoft.co.za/blog/?p=46
[Wed Oct 08 01:36:41 2008] [error] [client 195.137.103.229] FastCGI: incomplete headers (0 bytes) received from server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi", referer: http://www.chillisoft.co.za/blog/?p=46
[Wed Oct 08 01:36:46 2008] [error] [client 196.35.158.184] FastCGI: comm with (dynamic) server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi" aborted: (first read) idle timeout (60 sec)
[Wed Oct 08 01:36:46 2008] [error] [client 196.35.158.184] FastCGI: incomplete headers (0 bytes) received from server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi"
[Wed Oct 08 01:37:46 2008] [error] [client 196.35.158.184] FastCGI: comm with (dynamic) server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi" aborted: (first read) idle timeout (60 sec)
[Wed Oct 08 01:37:46 2008] [error] [client 196.35.158.184] FastCGI: incomplete headers (0 bytes) received from server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi"
[Wed Oct 08 01:40:15 2008] [error] [client 82.208.151.135] FastCGI: comm with (dynamic) server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi" aborted: (first read) idle timeout (60 sec), referer: http://backend.softpedia.com:5050/index.php?module=windows&submodule=Program&cmd=EditProgram&prog_id=87866
[Wed Oct 08 01:40:15 2008] [error] [client 82.208.151.135] FastCGI: incomplete headers (0 bytes) received from server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi", referer: http://backend.softpedia.com:5050/index.php?module=windows&submodule=Program&cmd=EditProgram&prog_id=87866
[Wed Oct 08 01:41:25 2008] [error] [client 82.208.151.135] FastCGI: comm with (dynamic) server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi" aborted: (first read) idle timeout (60 sec), referer: http://www.chillisoft.co.za/habanero/changes_log
[Wed Oct 08 01:41:25 2008] [error] [client 82.208.151.135] FastCGI: incomplete headers (0 bytes) received from server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi", referer: http://www.chillisoft.co.za/habanero/changes_log
[Wed Oct 08 01:42:27 2008] [error] [client 196.35.158.184] FastCGI: comm with (dynamic) server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi" aborted: (first read) idle timeout (60 sec)
[Wed Oct 08 01:42:27 2008] [error] [client 196.35.158.184] FastCGI: incomplete headers (0 bytes) received from server "/home/eric_chilli/chillisoft.co.za/http/dispatch.fcgi"
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
I'm using Dreamhost and am getting a 500 Internal Server Error, which is worse than what I was getting before.
 
 We were just getting a TCP Error, while others on other continents were getting the error message from the htaccess file (Rails application failed to start).  Now we're getting the 500, which I half-imagine is from my fiddling with htaccess.
 
 That's probably a startup error or a function that you're calling that's been deprecated and removed.
 
 Assuming you've got the code locally, I could post the correct rails files as a zip so that you could download them and extract them locally.  That way you could start it up locally and see what error you're getting.

Another option would be to change the configuration so that errors are shown.  Change this in your config/environments/production.rb:



# make this true to show full errors
 

# Full error reports are disabled 

config.action_controller.consider_all_requests_local = false  

Open in new window

0
 

Author Comment

by:corebiz
Comment Utility
No luck there - still timing out.  Do I need to refresh or reboot to get the new production.rb working?

You don't get the error messages or site down page on your side do you?  (www.chillisoft.co.za)
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
Still seems like your rails app isn't running.  The dispatch.fcgi can't return anything because the app isn't started up.

Can you check the rails log?  It's in:
"/home/eric_chilli/chillisoft.co.za/http/log/production.log

That might give you more information on the rails problem you're having.
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
Yes, I get your temp page (after the timeout).

Yes, you have to restart after changing the production.rb file.

Here's one way to restart your app:
http://www.goodbyehelicopter.com/2007/08/23/rails-on-dreamhost-how-to-restart-your-app-after-a-change/

You could also use mod_rails, which is an easier way to run Rails apps:
http://wiki.dreamhost.com/Passenger
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
I knew there was a better way to show errors in production mode.
Switch that line back to false, and add this to your application.rb (in /app/controllers)

def local_request?
  request.remote_ip == "XXX.X.X.1"
end  

Set that to your IP (www.whatismyip.com if you don't know it) and it'll send the error messages to you but no-one else.  Sorry I couldn't think of this earlier!
0
 

Author Comment

by:corebiz
Comment Utility
My production.log stopped updating sometime early yesterday, so I renamed it (47 megs) and put a blank one in yesterday, which is still 0 bytes now.

I'm busy downloading the renamed old one right now to see if it has anything useful.

Horrible when you can't see your errors!  Like getting "object reference not set" in .net :)
0
 

Author Comment

by:corebiz
Comment Utility
After hours of fruitless fiddling, I decided to go back to what was working, namely freezing to 1.2.5 using your first suggestion.  It's a pity because it's going to throw out future site maintenance, but I must have a working site right now.

Thanks for your help!
0
 
LVL 14

Expert Comment

by:wesgarrison
Comment Utility
Yeah, I figured you could freeze and get up and running, then fix it locally on the new version and upgrade at your convenience.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now