Litespeed + Ruby/RoR + cPanel, problems installing Redmine

Discussion in 'General' started by tracktor1, Jun 5, 2012.

  1. tracktor1

    tracktor1 New Member

    Problem installing RoR app in Litespeed (no such file to load -- lsapi)

    Hi guys!

    I am having some problems installing Redmine (as an example of RoR app) in Litespeed (cPanel 11.32/CloudLinux)

    We are installing Redmine from a test cPanel account (logged as a normal user for redmine installation steps), the goal is document the process and make a tutorial to teach our clients about how to use Litespeed + Ruby / RoR.

    Its a shared hosting server with cPanel, to complete the installation of Redmine 1.4 I used several resources:

    http://www.asyndetic.com/blog/2012/04/22/deploying-redmine-in-a-cpanel-hosting-environment/
    http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:ruby_rails
    http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:rails_hosting
    http://www.geekstorage.com/blog/index.php/2010/05/09/setting-up-redmine-aamp-ruby-on-rails-with-litespeed-at-geekstorage

    Finally we achieve the installation of Redmine but does not run properly, get this error:

    Code:
    503 Service Unavailable 
    Checking the logs I see:

    Code:
    2012-06-05 18:22:09.558 [STDERR] /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require': no such file to load -- lsapi (MissingSourceFile)
    	from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
    	from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
    	from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
    	from /usr/local/lsws/fcgi-bin/RailsRunner.rb:29

    We have installed ruby-lsapi, restarted the app, restarted LiteSpeed and nothing... always have the same error.


    Other info:
    Code:
    # gem list --local | grep lsapi
    ruby-lsapi (4.0)
    # ruby -v
    ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
    # gem -v
    1.8.24
    # rails -v
    Rails 2.3.14
    
    Litespeed 4.1.12
    cPanel 11.32
    I would appreciate any help

    Thanks
    Last edited: Jun 6, 2012
  2. mistwang

    mistwang LiteSpeed Staff

    I think you need to update cagefs to include ruby lsapi. it only installed at server level, but not included in cagefs for each user account.
  3. tracktor1

    tracktor1 New Member

    Hi mistwang,

    First, thanks for the reply.

    The problem is I do not use cagefs (disabled).

    I found other user with (apparently) the same problem:

    http://www.question-defense.com/2010/12/09/litespeed-stderr-usrlibrubysite_ruby1-8-rubygemscustom_require-rb31in-gem_original_require-no-such-file-to-load-lsapi-missingsourcefile

    But this no work for me, ruby-lsapi is installed.

    Code:
    # gem install ruby-lsapi
    Building native extensions.  This could take a while...
    Successfully installed ruby-lsapi-4.0
    1 gem installed
    Installing ri documentation for ruby-lsapi-4.0...
    Installing RDoc documentation for ruby-lsapi-4.0...
    
    
    # service lsws restart
    
    # touch /home/user_cpanel/.ls_rails_config
    
    
    We're a little desperate ... any ideas would be appreciated.

    Thanks!
  4. tracktor1

    tracktor1 New Member

    Problem solved! I reinstalled ruby-lsapi manually and now work fine... but I have other problem.

    Redmine appear to work fine if I access for example to:

    subdomain.domain.com/admin
    subdomain.domain.com/projects
    subdomain.domain.com/my/account
    etc...

    But when I try access to:

    subdomain.domain.com

    I see the public directory content (listing)

    I tried with this rules but dont work:

    Code:
    RewriteRule ^$ index.html [QSA]
    RewriteRule ^([^.]+)$ $1.html [QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ dispatch.lsapi [QSA,L]
    
    Please some help! with this

    Thanks!
  5. mistwang

    mistwang LiteSpeed Staff

    is .htaccess enabled?
    Do you have "RewriteEngine on" in the .htaccess?
  6. tracktor1

    tracktor1 New Member

    >is .htaccess enabled?

    Yes, is enabled.

    >Do you have "RewriteEngine on" in the .htaccess?

    Yes.

    In this moment the .htaccess appear to work (I think this was a browser cache problem) but the main problem continues :(

    The problem now is the same comented in the last reply but I see a strange behavior:

    When the rules are added in the .htaccess, redmine stop working, all petitions redirect to "dispatch.lsapi" but instead run, it displays the contents of this file (permissions 755 in this file):

    Code:
    #!/usr/bin/ruby
    
    if GC.respond_to?(:copy_on_write_friendly=)
        GC.copy_on_write_friendly = true
    end
    
    require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
    
    # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
    # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
    require "dispatcher"
    require "lsapi"
    
    while LSAPI.accept != nil
            Dispatcher.dispatch
    end
    When I remove the .htaccess, Redmine work fine without using rules or dispatch.lsapi (strange?) but the first problem appear again, access to index dont work, appear the directory listing.
  7. mistwang

    mistwang LiteSpeed Staff

    You can just turn off directory indexing from .htaccess, it should be direct to rails automatically.
    right now, no need to create dispatch.lsapi file.
  8. tracktor1

    tracktor1 New Member

    no luck...

    I put "Options -Indexes" (now this file only contains this directive) in .htaccess (inside public folder of redmine) and is showing the tipical 403 Forbidden error.

    Internal pages like /login, /projects, etc work perfect but the start page continue without work...

    Thanks
  9. marcelruhf

    marcelruhf New Member

    Rewrite rule

    Maybe try this in your .htaccess:

    RailsBaseURI /

Share This Page