lsapi with camping?

kuzb

New Member
#1
Has anyone configured the camping microframework with lsapi? I'm trying to figure out how to do it, but the lsapi docs are nearly non-existant.

Any help appreciated :)
 

mistwang

LiteSpeed Staff
#2
Please consult the README file and a few examples in our ruby-lsapi.
Ruby CGI/FCGI can be easily converted to use our LSAPI interface.
 
#3
Hi,

I'm in the same situation, trying to run a camping application on the litespeed server. I read the README and modified the application according to the lsapi recommendations. But I'm still not able to access the application. If I access the root url the server sends a 404 error message. But I can access all files which are part of the application, e.g. /application.rb .

So how do I need to configure litespeed? I think thats my problem.

Bye
 

mistwang

LiteSpeed Staff
#4
please checkout scripts/lsruby_runner.rb, creat a LSAPI external app, add a "script handler" to let it handle ".rb" files.
All the ".rb" file will be run inside the persistent Ruby Runner process as CGI script.
 
#5
I've added a LSAPI external application with the address "UDS://path/to/ruby-lsapi-2.5/scripts/lsruby_runner.rb" and added the ext app as a script handler with suffixes "rb".

But now I receive a 503 error message and I can't find any log information about that. Did I use the wrong parameter values for the ext app and script handler?

Thanks
 

mistwang

LiteSpeed Staff
#6
You configuration is wrong. Plase use our lsphp external app as a reference.
/path/to/ruby-lsapi-2.5/scripts/lsruby_runner.rb should be the command to be exeuted, not the socket path.

Please check error.log and stderr.log for error messages related.
 
#7
The following error is thrown:

from /usr/local/lib/ruby/gems/1.8/gems/ruby-lsapi-2.5/scripts/lsruby_runner.rb:3
/usr/local/lib/ruby/gems/1.8/gems/ruby-lsapi-2.5/scripts/lsruby_runner.rb:3:in `require': no such file to load -- lsapi (LoadError)

Is that a known bug or just a specific one on my side? I uninstalled and reinstalled the ruby-lsapi gem, but that didn't solve the problem. And I never installed ruby-lsapi manually before.

Thanks
 

mistwang

LiteSpeed Staff
#8
The gem install only works with Rails I guess, unless you explicitly include gem packages. You need to install ruby-lsapi manually.
 
#9
I installed ruby-lsapi manually and modify my application.rb a bit, and now I get 500 error messages. The server says "Premature end of response header.". There are no other error messages.

Is this a server configuration problem or something related to my application?

Thanks
 

mistwang

LiteSpeed Staff
#10
You should not modify your application.rb to use LSAPI directly if you use the ruby runner. ruby runner is the LSAPI application, which can only run plain CGI written in ruby.
If you convert your application.rb to LSAPI, then get rid of the ruby runner. And define a LSAPI context and use it as the handler.

Either way should work, just do not mix them together. Plase go through our documentation.
 
#11
Hi,

I didn't mix the two options. Because the scenario with thr ruby runner did not work, I've tried to use LSAPI directly. I changed my application accordiing to the documentation. Then I added a external app with my application.rb as command and defined a lsapi context using the ext app. No script handler anymore. But it still doesn't work. The following error messages are shown:

2007-07-15 21:03:24.241 [NOTICE] [127.0.0.1:50619-0#application] Premature end of response header.
2007-07-15 21:03:25.280 [NOTICE] [127.0.0.1:50621-0#application] Premature end of response header.

So what does that mean?

Thanks.
 

mistwang

LiteSpeed Staff
#12
That probably means that the application does not send back any response header. you should start with a simple hello world LSAPI application, or hello world CGI with the ruby runner. Once you get an idea about the configuration, you can try the complicate stuff.
 
Top