• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Ruby on Rails - WORKING

Out of frustration and desperation, I tried running the script/server script to see what I could see.

Now I get:

Action Controller: Exception caught
Routing Error
Recognition failed for "/"


Apparently, Apache and fcgid are choking on this and dumping out with a 500 error.

So this is starting to look like a Rails thing, and I have no clue where to go from here.
 
And another clue... when run from the local server I get this in development.log:


Processing Base#index (for 127.0.0.2 at 2007-03-14 00:37:55) [GET]
Session ID: ace7eb86acd583d21799354c14fbe4cf
Parameters: {}


ActionController::RoutingError (Recognition failed for "/"):
/usr/lib/ruby/site_ruby/1.8/action_controller/routing.rb:522:in `recognition_failed'
/usr/lib/ruby/site_ruby/1.8/action_controller/routing.rb:512:in `recognize!'
/usr/lib/ruby/site_ruby/1.8/dispatcher.rb:38:in `dispatch'
/usr/lib/ruby/site_ruby/1.8/webrick_server.rb:115:in `handle_dispatch'
/usr/lib/ruby/site_ruby/1.8/webrick_server.rb:81:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/site_ruby/1.8/webrick_server.rb:67:in `dispatch'
/usr/lib/ruby/site_ruby/1.8/commands/servers/webrick.rb:59
/usr/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/site_ruby/1.8/active_support/dependencies.rb:147:in `require'
/usr/lib/ruby/site_ruby/1.8/commands/server.rb:30
/usr/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3


Rendering /usr/lib/ruby/site_ruby/1.8/action_controller/templates/rescues/layout.rhtml (404 Page Not Found)




The interesting thing about that is that the file it claims to not be able to find is in fact there (the layout.rhtml file)

Obviously, when running this way, I get nothing in the apache httpd error log.
 
No problem. I've spent a few hours on it myself, and I know it's frustrating.

The socket should be in your server's default location - I didn't mean to imply that it should be changed. Sorry about that.

Make sure that the log files for your domain have permissions set to 777. See if that helps.

Did you add the IPCConnectTimeout & IPCCommTimeout settings to your module configuration? Have you enabled the fcgid apache2 module (not just installed)? Did you try accessing your site at http://www.yoursite.com/app/public or http://www.yoursite.com/app/public/your_controller_name? Is your vhost.conf file included in your domain's conf/httpd.include file? Let me know

OSS is great when you get it running. Usually there's no problem. For instance, using the gem install on my local server, I had everything up and running in under an hour. If you want to pay like it's a proprietary application, why not pay the money for SWSoft to troubleshoot for an hour? You'll end up keeping more of your hair, and you might fix the problem for someone else. $75 :)
 
Post your config/routes.rb file (without the commented out portions) and I'm sure we can figure it out.
 
The angst in the stuff below isn't directed at you zero, it's just my opinion on OSS and Plesk so you can understand where I am coming from. (And I honestly, truthfully appreciate the time you have taken to help me).

As to why I don't spend the money for Plesk support, I am doing this for a non-profit organization and it is not my account nor my money to spend. I am trying to help them so they don't have to spend money they can't afford to spend. Call it my martyr syndrome if you must.

I am of the opinion this should work out of the box. Plesk's component list says it has a "rails-configurator" whatever that is supposed to mean. I think it should mean that Rails is supported, it works, and there should be a nice little checkbox on the domain page that says "Enable Rails support". Apparently, I am expecting too much.

Everything is where it is supposed to be as far as I can tell. I do a server restart after changing anything.

FastCGI support is enabled according to Plesk. I even short-circuited that by taking the configuration directives from their file and inserting them into my vhost.conf file so it should be enabled and it appears to be because when I look at the main apache log (not just the domain log) I see things like:

[Wed Mar 14 00:56:36 2007] [notice] mod_fcgid: server /var/www/vhosts/example.org/httpdocs/fighter/public/dispatch.fcgi(4183) started
[Wed Mar 14 00:57:59 2007] [notice] mod_fcgid: process /var/www/vhosts/example.org/httpdocs/fighter/public/dispatch.fcgi(4214) exit(communication error), terminated by calling exit(), return code: 120
[Wed Mar 14 00:56:58 2007] [notice] mod_fcgid: process /var/www/vhosts/example.org/httpdocs/fighter/public/dispatch.fcgi(4195) exit(server exited), terminated by calling exit(), return code: 120


So it definitely looks like it is trying to do its thing. But I have no idea what any of those errors mean.

I've been developing software in the Windows environment since 3.1 and I have never had so much heartburn with making things work as I have under several flavors of Solaris, Linux and BSD.

My prejudice against OSS is that there is NO consistency. Everyone has their own idea of how things should be done and they often clash with other things. Every distribution of Linux has stuff in different locations. Stuff that should be easy is frustrating and difficult. I guess some people like the challenge and take pride in making it work through a bunch of hacking, I don't. I find it tedious and a real impediment to making OSS more acceptable. Yes, I want to have things install nice and clean and just work, quite like an OS that many people denigrate just because they don't like the fact that it isn't OSS and they charge money for it (we all know what I am referring to).

I really don't want to get under the hood but I am forced to. It's an awful lot like if you had to do a major repair on your car every time you wanted to drive to the grocer to pick up something.
 
Contents of the routes.rb file:

ActionController::Routing::Routes.draw do |map|

map.connect ':controller/service.wsdl', :action => 'wsdl'
map.connect ':controller/:action/:id'
end
 
I know your angst isn't directed at me - don't worry. I'm also with you on non-profit org's. We had to limit ourselves to one project per year because they took up so much of our time.

It should work out of the box, but unfortunately it doesn't. SWSoft should write better documentation, or ANY documentation, rewrite the default configs, but they haven't as far as I can tell.

The thing is, it turned out that with the exception of the fcgi conf and the ruby->ruby1.8 issue that I had, everything was actually set up correctly on my machine. All of the other configuration issues were RoR issues, and had nothing to do with Plesk. Mind you, I still blame them for plenty, and I think they would have been better off writing a how-to than me :)

Anyway, you may be better off finding help from a RoR forum or wiki than from me. But I'll do what I can.

Does your app run in Webrick?
Code:
ruby script/server

http://www.yourdomain.com:3000
or
http://www.yourdomain.com:3000/Your_Controller

Maybe you can get more detailed error messages there?

Also, I think there should be more info in your routes file. Perhaps something to tell which controller is the default?

Code:
map.connect '', :controller => "{your_default_controller}"
 
If you go back up a few posts, you will see that I tried running it using the script/server thing (though I had to bind it to a different address to get that to work).

That's where I got this (and the subsequent post with the stuff from development.log):

Action Controller: Exception caught
Routing Error
Recognition failed for "/"



I'm using the application as it was developed on another platform with the exception that I stripped all carriage returns from all of the files (as we discussed yesterday) and I have changed the shebang lines in the dispatch.* files to point to where ruby actually lives on this system.

So what is in the routes.rb file is what was there when it supposedly worked before (I suppose I ought to find out from the guy who did this if it ever really worked at all).

I did create a blank application for testing, but I have not tried to set it up and link it to a database. When I go to its welcome page and click the about your application environment link, it bombs too and says that the Rails application failed to start correctly.
 
Yeah - that error that says that the application did not start properly is normal for Rails 1.1.6. I noted it in the first post. Don't worry about that.

Try a really simple application - no database or weird configs.

In your domain's httpdocs folder:

Code:
rails railstest

Code:
script/generate controller Say

Code:
nano app/controllers/say_controller.rb

Enter the following:

Code:
class LanguageController < ApplicationController
  def hello
  end
end

Edit the view:

Code:
nano app/views/say/hello.rhtml

And just type in "Hello" or some other message.

Now:
Code:
ruby script/server

And visit:

http://www.yourdomain.com:3000/say/hello

Let me know if that works.
 
Sorry - I forgot to say that you need to go in and make the changes in .htaccess for the test app, as well as making sure the ownership of the files is correct.

Hope it works - my fingers are crossed!
 
I will give that a try tomorrow, have some other things I need to work on this evening.

BTW, I have Rails 1.2.2 installed, the app was developed on 1.1.6. I have no idea if this is going to be a problem or not.
 
Hey Zero,

Now we are making some progress. At least to the point of eliminating a couple of variables.

Using the WEBrick server to test, and the very basic "application" configuration that you posted yesterday, it is now serving the test application. I temporarily bound the server to the external IP at port 3000 so I could test it in something other than lynx in an ssh terminal.

So it looks like Rails is working and I've known Ruby was working because gems works, etc.

There is still a problem with Apache running the Rails application.

I am back to not having a clue why the FastCGI or even the regular cgi methods are not working using Apache.

It also appears that the app code I was give to install may not have correct routing. Then agian, I am not sure but now that I have a test application that does something useful other than reporting an error, I can try to get it going now.

So I need to focus on getting the cgi calls to work. I've tried removing, re-installing, yadda, yadda. I'm not sure what else to do at this point.
 
Congrats on getting something working! The fcgid issues plague everyone, it seems. Why SWSoft didn't include the correct configuration by default for each OS they support is beyond me.

Have you taken a look at this?

http://wiki.rubyonrails.com/rails/pages/HowtoSetupApacheWithFastCGIAndRubyBindings

There's a test .fcgi file in there you can run, as well as several tips. That may give you some clues. I haven't used Fedora at all. I think I used RedHat 5.1, but that was a LONG time ago!
 
Yeah, I saw that one.

It seemed overly complicated and overblown so I tried other things first...

I will look at the Apache config stuff to see how it compares to what is on my box.

I am also thinking I may need to jump over to an Appache forum to see if I can get some guidance there.

Thanks for all your help, it has been a bit of a pain so far but at least I know where the problem lies. No solution yet, but it is certainly better than not knowing what exactly is causing the problem.

BTW, this doesn't work with the standard "slow" CGI handler either. I have no idea why that is.

I've also seen some stuff about a module called SCGI that supposedly works. I may give that a try if I am still at a roadblock here.
 
No thanks necessary - I'm learning as I go as well. Be sure to post back if you find a solution.

I think you may be better off sticking with fcgi rather than scgi - I seem to remember having some issues with that.
 
Pb with permissions (I think)

Hi there,

Thanks for your info, it's awesome.

I'd like to know if it's possible to run Rails under the "development" mode with Apache (and not Webrick) in order to see the Error messages while I'm developing.

Thanks!
Vincent
 
No thanks necessary! ;)

You edited out the other part of your question - so a lot of my response will make no sense to anyone but you and me. Let me know what happened! :)

If you are logged in as root then the files generated by the rails command will be owned by root:root. You can set up your domain to have shell (terminal) access to the server through the Plesk control panel. Or you should be able to chown user:group {railsapp} -R

You should have access to every file as the root user, so I don't understand what you mean when you say
And now I cannot access Rails anymore!

Do you mean through the browser, or through the terminal? If you can't edit or see the files anymore, you have bigger problems! Describe the problem a little more, please.

As for running in development mode, you can do that easily. Change environment.rb from
Code:
ENV['RAILS_ENV'] = "production"
To
Code:
ENV['RAILS_ENV'] = "development"

Then you need to alter the database.yml development settings in config/ to match your development database.
 
For my first question, I erased it because I solved the problem.

Firefox didn't like my change and I just add to restart it to make it work.

You were just too fast replying :)

I tried to switch to "development" but I don't think it made any difference.

What's the difference between "development" and "production"

To my understanding, "development" allows you to see the Error Messages, right?

Is there an easy way to try it and to see if it actually works?

Thanks again for your help.
I know you don't want them but I'll say it anyway!

Vincent
 
I decided to try another approach, mod_ruby.

It is installed, I set what I think are proper configuration directives...

And now I get this in the Apache error log:

[Thu Mar 15 13:48:31 2007] [error] mod_ruby: /usr/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': Insecure operation - gem_original_require (SecurityError)

I swear, I simply can't win. This project is going to make me insane.
 
Originally posted by Dragon93
I decided to try another approach, mod_ruby.

It is installed, I set what I think are proper configuration directives...

And now I get this in the Apache error log:

[Thu Mar 15 13:48:31 2007] [error] mod_ruby: /usr/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': Insecure operation - gem_original_require (SecurityError)

I swear, I simply can't win. This project is going to make me insane.

It will, or I will :)

Do you have a similar configuration in Apache as this?

http://wiki.rubyonrails.com/rails/pages/mod_ruby
 
Back
Top