Rails Passenger Connection Refused Issue Solved
You can still read and search them, but for help, please post a question on Stack Overflow.
I guess that most of you have seen that error in their logs. At first I started wondering what was it all about.
/opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-scripts/prespawn:105:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
It often results in the following message being displayed on your page, and which is the only debugging info which you are going to get from your browser.
We are sorry, but something went wrong!
It turn out that it has to do something with assets. I started digging on it I found that it is generated when Rails can't find the assets you are looking for because of either they are missing or they are not compiled or they are are not included in a manifest (directly by name or indirectly via require_tree).
The first case is clear. You should include them in your app's code or you should add them to your gear. The second case shouldn't be a problem for you, because OpenShift does that for you. But if you do have a problem with that, search the forum for issues regarding not compiling your assets.
The third case has two solutions. There is a right one and quick one. I'll need an expert's opinion about the second one. Here they are: You need to add the asset (usually a stylesheet and/or some third-party tool) to the list of items to precompile in the environment application.rb.
config.assets.precompile += ['960sm.css']
Or the quick way I found, which will work universally for all your assets:
There is a setting in the
config.assets.compile = true
Set it to true like that and this should solve the problem.
This is a copy of the originally logged error:
/opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-scripts/prespaw n:105:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED) from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-sc ripts/prespawn:105:in `new' from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-sc ripts/prespawn:105:in `connect' from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-sc ripts/prespawn:86:in `socket' from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-sc ripts/prespawn:90:in `head_request' from /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.12/helper-sc ripts/prespawn:145:in `<main>'
I hope this helps. I spent two weeks digging on the same problem.