lsapi with camping?

Discussion in 'Ruby/Rails' started by kuzb, Jun 13, 2007.

  1. kuzb

    kuzb New Member

    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 :)
  2. mistwang

    mistwang LiteSpeed Staff

    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. plato

    plato Member


    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.

  4. mistwang

    mistwang LiteSpeed Staff

    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. plato

    plato Member

    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?

  6. mistwang

    mistwang LiteSpeed Staff

    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. plato

    plato Member

    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.

  8. mistwang

    mistwang LiteSpeed Staff

    The gem install only works with Rails I guess, unless you explicitly include gem packages. You need to install ruby-lsapi manually.
  9. plato

    plato Member

    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?

  10. mistwang

    mistwang LiteSpeed Staff

    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. plato

    plato Member


    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] [] Premature end of response header.
    2007-07-15 21:03:25.280 [NOTICE] [] Premature end of response header.

    So what does that mean?

  12. mistwang

    mistwang LiteSpeed Staff

    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.

Share This Page