Ruby on Rails: Wiki install Tutorial

Discussion in 'Ruby/Rails' started by clung, Jul 7, 2006.

  1. clung

    clung New Member

  2. xing

    xing LiteSpeed Staff

  3. jmillr

    jmillr New Member

    multiple instances?

    Thanks for posting these instructions. However, it isn't clear how to map different rails apps to different urls. For example:

    server.host.com/typo serves 127.0.0.1:4000
    server.host.com/tracks serves 127.0.0.1:4001

    (Well, the instructions don't say anything about different port numbers. I'm coming from a Mongrel context. Also, the directions there mention Mongrel under Requirements:

    If you want to use mongrel as the backend, it should have been installed and working properly on its own.

    but then don't mention Mongrel again. How does Mongrel fit into the instructions that follow the Requirements? But the basic question remains: )

    The instructions posted seem to allow only one app which is mapped to the root of the server. How can I instantiate several different apps located in different directories and publicly differentiate them by url rather than by port number?

    Thanks for your help.

    John Miller
    Last edited: Jul 12, 2006
  4. xing

    xing LiteSpeed Staff

    When using Mongrel with LiteSpeed, just think of Mongrel as a http proxy server. So create "proxy" external apps, and create "contexts" to map url to the correct "proxy"/mongrel backend.

    There is a litespeed how-to on mongrel's website:

    http://mongrel.rubyforge.org/docs/litespeed.html

    Two things to note:

    1) In the above how-to, initial request timeout is way too low. 1 second is not practical. 15-30 seconds is more like it unless you entire db is ram based.

    2) Understand that Mongrel is a http server and much slower http server than litespeed. With this in mind, you do not want Mongrel to handle static images/css/etc. Create a static context in lsws with higher priority (lower number) context in lsws to point to the static files/folders so that LiteSpeed handle all static content while only dynamic rail requests is routed to Mongrel backend.

    We will update our wiki for sure.
  5. mistwang

    mistwang LiteSpeed Staff

    To mount a Rails application at a URL other than the document root, using /typo/ as an example, you need to define a static context /typo/ pointing to <railapp>/public/ folder, define a LSAPI context with URI /typo/dispatch.lsapi, instead of using it as a 404 handler, you have to add context level rewrite rules, you can just copy those rules in the .htaccess under public folder of that application, replace "dispatch.rb" or "dispatch.fcgi" with "dispatch.lsapi".

    Also, you need to change the route configuration for the Rails application to fix the "unknow route" error if any.
  6. xing

    xing LiteSpeed Staff

    John,

    We have thoroughly revamped our Ruby wiki:

    a) updated the current ruby lsapi how-to with single/multiple rail app installation within a single vhost.

    b) added a new how-to page geared toward Mongrel users.

    http://www.litespeedtech.com/community/wiki/

    Enjoy!

Share This Page