![]() |
Ruby Rack adapter request
Rack [ http://rack.rubyforge.org/ ] - provides an minimal interface between webservers supporting Ruby and Ruby frameworks. Almost all recently releazed ruby frameworks (Ramaze, Sinatra etc.) using it. Creating LSAPI adapter for it will enable all of them (and the new onces comming) to run on litespeed.
What need to be done: 1. Rack Litespeed handler - {rack_path}/lib/rack/handler/litespeed.rb - i tryed to patch the CGI handler with: Code:
def self.run(app, options=nil)2. {lsws}/fcgi-bin/RackRunner.rb , similar to the RailsRunner.rb one. It will call the Rack::Handler::Litespeed directly or via {project_home}/start.rb 3. EasyRackWithSuEXEC VH Template |
have you added "require lsapi" ?
other changes need to be made are rack.run_once=false LSAPI uses hash to store ENV, so need to do env=ENV.to_hash, just env=ENV |
What i've done until now:
1. Handler modified: Code:
require 'lsapi'Code:
module HandlerCode:
Name rbLsapiCode:
rb LiteSpeed API [Server Level]: rbLsapiCode:
require 'rubygems'In the error.log: Code:
2008-01-11 12:54:47.088 [INFO] [rbLsapi] add child process pid: 3094 |
2 Attachment(s)
There is already a rack handler in the repo. I should know because I submitted it. I'm including my code that I know it works. I only changed one line in rack.rb and created lsws.rb myself. I changed the .rb extensions to .txt to upload.
Hope this helps, AEM |
Do not use lsruby_runner.rb, just run simple.rb directly by changing the command configuration, use a LSAPI context instead of *.rb script handler to invoke the app.
AEM's code should work. And if you want to make your code works, I think you need a little more changes need to Hanlder::LiteSpeed, All references to STDIN, STDOUT should be changed to use the object return by LSAPI.accept. |
Thanks a lot mistwang and aemadrid. Problem solved - i used the aemadrid code. Working + no need to reinvent the wheel ;). Just a small question (or maybe i need to repost it in the usual RoR forum, not here):
Need I to create different socket for every external application I started in that way (LSAPI Ext App + Context)? Best regards and thanks again |
Glad to help. Let me know if you find something to improve.
AEM |
Quote:
If you guys can make it into the official rack package, it will be great. |
Seems it's already in the official repository ( see http://chneukirchen.org/repos/rack/lib/rack/handler/ ), maybe thanks to aemadrid.
|
Sorry to resurrect a slightly old thread but how well was this working for you guys as currently, being a bit green when it comes to the whole rack thing, the only way I've managed to run a merb app on my server is by starting a thin or mongrel instance and then setting up a webserver proxy as an external app in my vhost.
It feels like more of a hack than anything (although it does offer remarkably good performance) so I'd like to be able to serve it via lsapi/rack but after playing around with the configuration used in here and trying numerous other things I've yet to have any success. |
| All times are GMT -7. The time now is 02:23 AM. |