LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   Ruby/Rails (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=20)
-   -   Will there be official support for Rails >= 2.3 (http://www.litespeedtech.com/support/forum/showthread.php?t=2657)

tdinkins 01-26-2009 09:08 AM

Will there be official support for Rails >= 2.3
 
My company is developing some new Rails (2.3) applications and deploying on litespeed.

I know there are currently incompatibilities, but was wondering if the new Rails versions will get the same kind of support that the old versions do.

Being able to configure a rails app in just a few steps is a lot nicer than trying to work out how to get Rack and Litespeed to play nice.

mistwang 01-26-2009 08:55 PM

add to our to-do list.

russ816 01-26-2009 09:06 PM

I work with Tim and these are some of the errors that I've been running into.

This is the config for the external app for the vhost that the context is hooked to:
Code:

Name                rails
Address        uds://tmp/lshttpd/lsruby.sock
Command        /opt/local/bin/ruby /opt/lsws/vhosts/rails/script/lsws.rb

This is the the contents of that file:
Code:

Dir.chdir(File.join(File.dirname(__FILE__), '..'))

require 'rubygems'
require 'lsapi'
require 'rack'

require 'config/environment'

Rack::Handler::LSWS.run(ActionController::Dispatcher.new)

When I request a page from the app I get the following error:
Code:

no such file to load -- /opt/local/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/handler/lsws.rb (MissingSourceFile)
Also, I'm not sure if this is related but I get an error when trying to load up the lsapi gem in irb:
Code:

irb(main):006:0> require 'lsapi'
LS=> true
LSD/opt/local/lib/ruby/1.8/irb/input-method.rb:97:in `readline'LS
: LS1wrong argument type LSAPI (expected File)LS
 (LSTypeErrorLS
)
LSG        from /opt/local/lib/ruby/1.8/irb/input-method.rb:97:in `gets'
LSA        from /opt/local/lib/ruby/1.8/irb.rb:132:in `eval_input'
LSD        from /opt/local/lib/ruby/1.8/irb.rb:263:in `signal_status'
LSA        from /opt/local/lib/ruby/1.8/irb.rb:131:in `eval_input'
LSD        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:189:in `call'
LSI        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:189:in `buf_input'
LSD        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:104:in `getc'
LSD        from /opt/local/lib/ruby/1.8/irb/slex.rb:206:in `match_io'
LS@        from /opt/local/lib/ruby/1.8/irb/slex.rb:76:in `match'
LSE        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:287:in `token'
LSC        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:263:in `lex'
LSX        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:234:in `each_top_level_statement'
LSD        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'
LSX        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'
LSE        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'
LSX        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'
LSA        from /opt/local/lib/ruby/1.8/irb.rb:146:in `eval_input'
LS;        from /opt/local/lib/ruby/1.8/irb.rb:70:in `start'
LS;        from /opt/local/lib/ruby/1.8/irb.rb:69:in `catch'
LS;        from /opt/local/lib/ruby/1.8/irb.rb:69:in `start'
LS$        from /opt/local/bin/irb:13

I've tried getting Rails 2.3 running with Rack on 3 different machine (CentOS, ArchLinux and Mac OSX), all with the same results.

russ816 01-26-2009 09:08 PM

Quote:

Originally Posted by mistwang (Post 13446)
add to our to-do list.

Sorry, I was writing my post as you posted yours.
Thanks for the info.

sniperd 02-27-2009 09:16 AM

Hi Mistwang,

Any update on getting lsws rails 2.3 complaint? I have a bunch of licenses purchased through you guys and plan on maybe even getting more with a large deployment of a new rails app, but if theirs no support on this we cannot use your product.....

mistwang 02-27-2009 08:42 PM

Have taken some time to investigate it tonight, I think a piece of code similar to

rails-2.3.0/lib/commands/server.rb

should work, the main change is to use our Rack handler instead of Mongrel or WEBrick for the server object

server = Rack::Handler::LSWS

Might need some tweaks like our RailsRunner.rb

Due our tight schedule and Ruby programming skills, if any experienced Ruby/Rails developer would to take this project, please contact us. we will pay your time.

russ816 03-01-2009 06:22 PM

I'm willing to give it a shot, but I'm running into strange errors when trying to include the Rack:LSWS handler.

When trying to include it from IRB I get:
Code:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rack'
=> true
irb(main):003:0> require 'rack/handler/lsws'
LS=> true
LSD/opt/local/lib/ruby/1.8/irb/input-method.rb:97:in `readline'LS
: LS1wrong argument type LSAPI (expected File)LS
 (LSTypeErrorLS
)
LSG        from /opt/local/lib/ruby/1.8/irb/input-method.rb:97:in `gets'
LSA        from /opt/local/lib/ruby/1.8/irb.rb:132:in `eval_input'
LSD        from /opt/local/lib/ruby/1.8/irb.rb:263:in `signal_status'
LSA        from /opt/local/lib/ruby/1.8/irb.rb:131:in `eval_input'
LSD        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:189:in `call'
LSI        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:189:in `buf_input'
LSD        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:104:in `getc'
LSD        from /opt/local/lib/ruby/1.8/irb/slex.rb:206:in `match_io'
LS@        from /opt/local/lib/ruby/1.8/irb/slex.rb:76:in `match'
LSE        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:287:in `token'
LSC        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:263:in `lex'
LSX        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:234:in `each_top_level_statement'
LSD        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'
LSX        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'
LSE        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'
LSX        from /opt/local/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'
LSA        from /opt/local/lib/ruby/1.8/irb.rb:146:in `eval_input'
LS;        from /opt/local/lib/ruby/1.8/irb.rb:70:in `start'
LS;        from /opt/local/lib/ruby/1.8/irb.rb:69:in `catch'
LS;        from /opt/local/lib/ruby/1.8/irb.rb:69:in `start'
LS$        from /opt/local/bin/irb:13

I just don't understand the error messages it's giving.

russ816 03-01-2009 08:26 PM

1 Attachment(s)
I think I got it. Just took some time to find the right combination of settings. I've attached the file that needs to be run. It uses the same setup you would use as a normal rack app with lsws. I'll post full details on the setup tomorrow.

mistwang 03-03-2009 07:35 AM

Maybe it need updates on the LSAPI object definition. Make it derive from "File" object could make irb happy.
It is in ruby-lsapi/ext/lsapi/lsruby.c inside Init_lsapi() function.

mistwang 03-03-2009 08:23 AM

Quote:

Originally Posted by russ816 (Post 13922)
I think I got it. Just took some time to find the right combination of settings. I've attached the file that needs to be run. It uses the same setup you would use as a normal rack app with lsws. I'll post full details on the setup tomorrow.

Thanks! It is very close what I thought.
Some code are not necessary, could clear it up a little bit.
Only one concern, our RailsRunner.rb takes care of the DB connection problem caused by fork(), so it close DB connection then reopen it after fork().

The default Rack::Handler::LSWS does not have this logic, so it may not work properly.

I am thinking about a dedicate Rack handler for Rails, maybe call it Rack::Handler::LSRAILS, it should be similar to Rack::Handler::LSWS, just add logic like the what we have in RailsRunner.rb . All the code could be in one file.


All times are GMT -7. The time now is 09:27 AM.