LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > can't get rails app to run with lsapi

Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2006, 05:36 AM
Shelby Shelby is offline
Member
 
Join Date: Aug 2006
Location: Dallas, TX
Posts: 22
Default can't get rails app to run with lsapi

Hello. I am trying to get a rails app to run with lsapi as described in the litespeed wiki:
http://litespeedtech.com/community/w...iki:ruby_rails

When I try to run the app, I continually get a 503 Service Unavailable error.

Below I have listed everything I did in the install, and my configuration, as well as the errors from the log. I tried to follow the instructions precisely, but I cannot make it work. Can anyone help?

Thanks, Shelby
_________________________________________________

I am running Litespeed 2.1.18 std on Linux. It serves static pages fine.
I installed mysql, created the database, and set database.yaml in the rails app with the correct user name and password. I can use rake migrate successfully to create the tables, so I know that the database connection works.

I have installed ruby and rails. I have installed litespeed ruby lsapi via
gem install ruby-lsapi. I copied the dispatch.lsapi into my rails public directory and made it executable. All the files in the rails app are readable by the server. In order to try and keep it simple, I am setting it up to run only one rails app for this virtual host.

I created a virtual host just for this web app. its config:
virtual host root: /absolute/path/to/railsapp/ (note - directory above public)
config file: /absolute/path/to/railsapp/config.xml
enable script: yes
restrained: no
GENERAL TAB
document root: /absolute/path/to/railsapp/public/
enable gzip: yes
customized error pages: 404 not found -- /dispatch.lsapi
EXTERNAL APPS
I created a lsapi app...
name: RubyRailsLSAPI
address: uds://tmp/lshttpd/rubyrailslsapi.sock
max connections: 10
environment:RAILS_ENV=production
LSAPI_CHILDREN=10
initial request timeout: 5
retry timeout: 5
persistent connection: yes
response buffering: no
command: /absolute/path/to/railsapp/public/dispatch.lsapi
CONTEXT
I created a LiteSpeedAPI context
URI: /dispatch.lsapi
LSAPI App: [VHostLevel] RubyRailsLSAPI

other than these settings, I left everything else blank.
I saved everything and restarted the server. I try to access the railsapp like this:
http://test.virtualhostname.org/login/login
and receive a 503 service unavailable error
Here is what my log shows:

2006-08-05 23:59:57.674 INFO [192.168.0.101:57801-0#mta_pmta] File not found [/absolute/path/to/railsapp/public/login/login]
2006-08-05 23:59:57.675 INFO [uds://tmp/lshttpd/rubyrailslsapi.sock] Connection refused, restart!
2006-08-05 23:59:57.676 INFO [uds://tmp/lshttpd/rubyrailslsapi.sock] Connection refused, restart!
2006-08-05 23:59:57.676 INFO [uds://tmp/lshttpd/rubyrailslsapi.sock] Connection refused, restart!

It seems to be looking for an actual file at the URL, rather than executing the rails application at that controller and method.

Note that this webapp does run fine on my development machine under webrick with the url:
http://127.0.0.1/login/login
Reply With Quote
  #2  
Old 08-06-2006, 10:56 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Something wrong with the dispatch.lsapi, can you run it from command line?
Reply With Quote
  #3  
Old 08-06-2006, 12:07 PM
Shelby Shelby is offline
Member
 
Join Date: Aug 2006
Location: Dallas, TX
Posts: 22
Default dispatch.lsapi

I tried to run dispatch.lsapi from the command line. The first thing I realized is that dispatch.lsapi expects ruby to be in /usr/local..., but mine is in /usr, so I fixed that.

Then I ran it again, and I got this error, which I do not understand:
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- lsapi (MissingSourceFile)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'
from ./dispatch.lsapi:8

Pretty puzzled about what this means...

Thanks for your help.
Shelby
Reply With Quote
  #4  
Old 08-06-2006, 02:28 PM
Shelby Shelby is offline
Member
 
Join Date: Aug 2006
Location: Dallas, TX
Posts: 22
Default a bit of progress

I installed the ruby-lsapi by hand - downloaded version 1.4 and installed the tar.gz file manually.

Now when I run the dispatch.lsapi from the command line, the error in the above message is gone, and I see in the terminal:
/usr/local/lib/site_ruby/1.8/i486-linux/lsapi.so: warning: already initialized constant ENV

that looks better...

However, after a server restart, I still get a 503 error page and this in the logs:

2006-08-06 16:22:57.335 INFO [192.168.0.101:58535-0#mta_pmta] File not found [/absolute/path/to/railsapp/public/login/login]
2006-08-06 16:22:57.335 INFO [uds://tmp/lshttpd/rubyrailslsapi.sock] Connection refused, restart!
2006-08-06 16:22:57.336 INFO [uds://tmp/lshttpd/rubyrailslsapi.sock] Connection refused, restart!
2006-08-06 16:22:57.336 INFO [uds://tmp/lshttpd/rubyrailslsapi.sock] Connection refused, restart!

Still wondering what is wrong...

Shelby
Reply With Quote
  #5  
Old 08-06-2006, 05:55 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
At least, dispatch.lsapi works properly now. :-)
The "File not found" error is normal.
Have you set "Auto Start" to "yes" for the "RubyRailsLSAPI" application?
Your "initial request timeout" should be increased, maybe like "60".
Please check if the file "/tmp/lshttpd/rubyrailslsapi.sock" exists, do "ps -ef | grep ruby", see if any ruby instance is running, you should see two at least.
Reply With Quote
  #6  
Old 08-06-2006, 09:00 PM
Shelby Shelby is offline
Member
 
Join Date: Aug 2006
Location: Dallas, TX
Posts: 22
Default partial success

I think I did not know to turn on auto start. Now I can bring up the first web page of my site, which is a login page.

I changed the Rails environment in the server to development, so I could see the error messages...

There is some kind of problem with the routing of forms. When I submit a form, I get this:
Routing Error
Recognition failed for "/dispatch.lsapi"

Regular links seem to work correctly. For example, the opening login form fails with the above Routing Error. However, if I "fake it" by submitting a URL with the form attributes in the URL, like...
http://test.site.com/login/process_l...&password=test
then the login works fine. So something is wrong with form posts and the dispatch.lsapi. What could this be?

Running the app on the same machine under webrick works fine...
Thanks for your help...
Shelby
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup for Rails via Litespeed Ruby LSAPI Justin Ruby/Rails 2 12-08-2007 07:19 PM
rails lsapi wiki clarification dr_seus Ruby/Rails 3 07-11-2007 03:45 PM
Rails, LSAPI, Rewrites, Contexts, Authentication mabonyi Install/Configuration 2 02-11-2007 06:10 PM
Standard 2.2.5 + LSAPI + Rails uses up all processes dirkbj Bug Reports 7 12-01-2006 08:52 AM
Rails on LSAPI, db connection dropping.. marko Bug Reports 3 09-08-2006 01:23 PM


All times are GMT -7. The time now is 05:02 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.