lsapi and PLESK

Discussion in 'Ruby/Rails' started by eek, Oct 19, 2007.

  1. eek

    eek New Member

    Hi there,

    I was wondering whether it is possible to use ruby-lsapi (or respectfully php-lsapi) for domains managed via PLESK?

    thanks in advance for answer

    Andrej
  2. mistwang

    mistwang LiteSpeed Staff

    Yes, there should not be any problem. Actually, LSAPI is the only recommended option for RoR and PHP support.
  3. eek

    eek New Member

    Hi,

    is there anything specific that needs to be set up fore example: putting dispatch.lsapi into indexes etc.. except for these steps ?

    1. create domain in PLESK (check PHP support for PHP?)
    2. set LS to use apache config
    3. should I remove the default listener for port 80 ? since LS will create listeners for all vhosts_ip:port combinations.

    note that apache is not running.

    thank you!

    Andrej
  4. mistwang

    mistwang LiteSpeed Staff

  5. eek

    eek New Member

    mistwang,

    thank you!

    Andrej
  6. eek

    eek New Member

    mistwang,

    i can't seem to get the shared rails hosting to work.

    vhost config:
    Code:
    DocumentRoot /home/httpd/vhosts/....../httpdocs
    .ls_rails_config - location in the vhost root above
    Code:
    #RailsApp <name> <App Path> <Rails Evn> <Children Processes> <RunOnStart>
    RailsApp nlcman "/current" "development" 2 1
    
    #RailsAppMap <name> <domain> <URI>
    RailsAppMap nlcman "nlcman.newline-projects.com" "/"
    the shared rails hosting is enabled, with no values for the two Max variables

    Apache Port offset is 1 so LS is listening on 81.

    when i navigate to nlcman.newline-projects.com:81 i got a static page served

    do i need to setup any external apps, script handlers, or add mime type (like for php) ?

    there is not a sign of a rails host in the logs

    thank you for the help

    Andrej
  7. eek

    eek New Member

    forgot to add that the rails app is in the .../httpdocs/current/ directory
  8. mistwang

    mistwang LiteSpeed Staff

    With Apache configuration, the user's home directory set in /etc/password is used as vhost root, not the document root set in the httpd.conf.
  9. eek

    eek New Member

    by user you mean the user that was defined during setup?
  10. mistwang

    mistwang LiteSpeed Staff

    No, the user that owns httpdocs.
  11. eek

    eek New Member

    still nothing :( i'm clueless
  12. eek

    eek New Member

    vhost docroot:
    Code:
    /var/www/vhosts/newline-projects.com/subdomains/nlcman/httpdocs
    owner of the dir above:
    Code:
    nlcprojects:psaserv
    owners's home dir:
    Code:
    /var/www/vhosts/newline-projects.com
    .ls_rails_config location:
    Code:
    /var/www/vhosts/newline-projects.com/.ls_rails_config
    .ls_rails_config contents:
    Code:
    #RailsApp <name> <App Path> <Rails Evn> <Children Processes> <RunOnStart>
    RailsApp nlcman "/subdomains/nlcman/httpdocs/releases/20071018155320" "development" 2 1
    
    #RailsAppMap <name> <domain> <URI>
    RailsAppMap nlcman "nlcman.newline-projects.com" "/"
    this is the setup
  13. mistwang

    mistwang LiteSpeed Staff

    The configuration looks all right, anything logged into lsws/logs/error.log about "nlcman"?
  14. eek

    eek New Member

    hmmm this is weird.

    i tried to setup a rails vhost in the lsws admin. so i could see whether at least that works.

    the railsrunner is up and running but i only get 500 error..

    log dump:
    Code:
    2007-10-23 18:49:00.570 [DEBUG] [*:8088] 1 connections accepted!
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] HttpIOLink::handleEvents() events=1!
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] HttpConnection::onReadEx(), state: 0!
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] readToHeaderBuf().
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] Read from client: 669
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] read 669 bytes to header buffer
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] processHeader() return 0, header state: 3.
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0] readToHeaderBuf() return 0.
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] New request:
            Method=[GET], URI=[/],
            QueryString=[]
            Content Length=0
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] Find context with URI: [/], location: [/var/www/vhosts/newline-
    projects.com/subdomains/nlcman/httpdocs/releases/20071018155320/public/]
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] File not found [/var/www/vhosts/newline-projects.com/subdomains
    /nlcman/httpdocs/releases/20071018155320/public/index.html]
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] processContextPath() return 25
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] processNewReq() return 25.
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] HttpConnection::sendHttpError(),code=404 Not Found
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] redirect to:
            URI=[/dispatch.lsapi],
            QueryString=[]
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] Find context with URI: [/dispatch.lsapi], location: []
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] processContextPath() return 0
    2007-10-23 18:49:00.571 [DEBUG] [85.237.18.16:1559-0#testy-nlcman] run lsapi processor.
    2007-10-23 18:49:00.573 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] [ExtConn] reconnect()
    2007-10-23 18:49:00.573 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] [ExtConn] connecting to [uds://tmp/lshttpd/testy-nlcman:_
    .sock]...
    2007-10-23 18:49:00.573 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] ExtConn::onWrite()
    2007-10-23 18:49:00.573 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] request header is done
    2007-10-23 18:49:00.573 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] Request body done!
    2007-10-23 18:49:02.115 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] ExtConn::onRead()
    2007-10-23 18:49:02.115 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] LsapiConn::doRead()
    2007-10-23 18:49:02.115 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process packet header 8 bytes
    2007-10-23 18:49:02.115 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process packet header 0 bytes
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] ExtConn::onRead()
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] LsapiConn::doRead()
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process packet header 8 bytes
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process response header 8 bytes
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process packet header 8 bytes
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process response stream 1716 bytes, packet left: 1708
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] response header finished!
    2007-10-23 18:49:02.382 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] GZIP response body!
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] process packet header 8 bytes
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] [EXT] EndResponse( endCode=0, protocolStatus=0 )
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] release ExtProcessor!
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] call pConn->writeRespBody() to write 849 bytes
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] Written to client: 1092
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] pConn->writeRespBody() return 849
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] ReqBody: 0, RespBody: 849, HEC_COMPLETE!
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] m_pHandler->onWrite() return 0
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] HttpConnection::flush()!
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] HttpConnection::nextRequest()!
    2007-10-23 18:49:02.383 [DEBUG] [85.237.18.16:1559-0#testy-nlcman:lsapi] HttpExtConnector::cleanUp() ...
    2007-10-23 18:49:07.487 [DEBUG] [85.237.18.16:1559-1] Keep-alive timeout, close!
    2007-10-23 18:49:07.487 [DEBUG] [85.237.18.16:1559-1] Close socket ...
    
  15. eek

    eek New Member

    and the application works just fine with mongrel and apache - i just checked
  16. mistwang

    mistwang LiteSpeed Staff

    The 500 error is generated by Rails.
    Maybe something is missing for the LSAPI rail setup, missing environment variables, etc. Please check rails log files.
  17. eek

    eek New Member

    right, there was a problem with permissions for session file, ok so LS vhost works fine as does the lsapi.

    now why doesn't the .ls_rails_config work :(
  18. mistwang

    mistwang LiteSpeed Staff

    can confirm that /var/www/vhosts/newline-projects.com is the home directory of nlcprojects in /etc/passwd?
    the .ls_rails_config should be owned by nlcprojects user and the user that lshttpd run as should have read permission.

    The related configuration under "server"->"Ruby" tab has been set properly.
  19. eek

    eek New Member

    ok i double checked everything and everything seems to be configured properly.

    cat /etc/passwd | grep nlcprojects
    Code:
    nlcprojects:x:10001:10001::/var/www/vhosts/newline-projects.com:/bin/false
    Ruby Rails tab
    Code:
    Ruby Path: /usr/local/bin/ruby
    Rails Environment: Development
    Max Connections: 5
    Environment: LSAPI_MAX_REQS=1000,LSAPI_MAX_IDLE=60
    Initial Request Timeout (secs): 180
    Retry Timeout (secs): 0
    Connection Keepalive Timeout: 60
    Response Buffering: No
    Back Log: 50
    Run On Start Up: Yes
    Max Idle Time: Not Set
    Priority: 3
    Memory Soft Limit (bytes): 250M
    Memory Hard Limit (bytes): 300M
    Process Soft Limit: 200
    Process Hard Limit: 300
    
    Enable Shared Hosting: Yes
    Max Apps per account: 20
    Max Ruby Processes per account: 100
    ls -la /var/www/vhosts/newline-projects.com/
    Code:
    -rw-r--r--    1 nlcprojects psaserv  235 Oct 23 20:50 .ls_rails_config
  20. eek

    eek New Member

    can this has something to do that we are using the enterprise version with the trial license?

Share This Page