VHost Config Issue

#1
Howdy,

I just switched to a VPS from shared hosting and have been setting up the server.

Currently I'm using:

actionmailer (1.3.4)
actionpack (1.13.4)
actionwebservice (1.2.4)
activerecord (1.15.4)
activesupport (1.4.3)
daemons (1.0.9)
mysql (2.7)
rails (1.2.4)
rake (0.8.1)

ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]

and the latest version of LS.

I have a functioning ruby app that was written in ruby 1.8.4/rails 1.2.4 that works fine when I start a webrick server, but LS errors with a 503 when it tries to parse any Ruby. The app/vhost itself is running (eg I can see the rails welcome file).

I don't think this has anything to do with the fact that I'm using ruby 1.8.6 versus 1.8.4, since it will load the app via webrick.

Also, I am just using the EasyRailsWithSuEXEC vhost template to get it up and running... is there some extra configs that need to be made for this to work properly?
 

mistwang

LiteSpeed Staff
#2
Do you have multiple Ruby installed on your server, make sure the right one used under the "Ruby" tab.
Check your error.log and stderr.log, turn on debug logging if need.
 
#3
I had changed the ruby version once or twice. I had two versions of rails for a bit, but regardless of which version I created an app using (1.2.4, eg), if I create a basic view/controller test app, it parses the ruby just fine from LS.

I was thinking that the ruby plugins I use (action_mailer_tls, acts_as_authenticated, file_column, mini_magick, paypalsdk, request_routing, will_paginate) might be causing the problems somehow, but really, if they are included properly with webrick, is there a reason that they would cause conflicts with ls?

A recurring set of lines in the log (every time a page is accessed/503's):

2008-01-20 15:21:53.162 [INFO] Remove pid: 6137
2008-01-20 15:21:53.162 [INFO] Pid: 6137 associated with [Rails:chictini:/]
2008-01-20 15:21:53.162 [INFO] [Rails:chictini:/] pid list size: 0, pid stop list size: 0
2008-01-20 15:21:53.162 [NOTICE] [Rails:chictini:/] stop worker processes
2008-01-20 15:21:53.162 [INFO] [Rails:chictini:/] 1 request being processed, kill external app later.
2008-01-20 15:21:53.162 [INFO] [24.90.2.46:17072-0#chictini] connection to [uds://tmp/lshttpd/chictini:_.sock] on request #0, error: Connection reset by peer
!
2008-01-20 15:21:53.162 [NOTICE] [24.90.2.46:17072-0#chictini] oops! 503 Service Unavailable
2008-01-20 15:21:53.162 [NOTICE] [24.90.2.46:17072-0#chictini] Content len: 0, Request line: GET /view/cat/1 HTTP/1.1

Again, I'm still kind of new to the ls admin side of things so I'm not sure if this would be causing the problem or how to solve it from there.

Stderr.log mentions broken pipes and some session files not being readable... is it possible since this folder is at the server root (not ls root) that it could be some kind of permissions error? Then again, if it can fetch the rails welcome index file from the public folder, it should be able to access the rest of the site, right?

stderr.log says:

Cannot find gem for Rails ~>1.2.4.0:
Install the missing gem with 'gem install -v=1.2.4 rails', or
change environment.rb to define RAILS_GEM_VERSION with your desired version.

however, gem list --local says:

rails (1.2.4)

and environment.rb has:

RAILS_GEM_VERSION = '1.2.4' unless defined? RAILS_GEM_VERSION

I removed the conditional part of the rails gem definition just in case I was overlooking it being defined elsewhere, but that made no difference.
 

mistwang

LiteSpeed Staff
#4
LSWS run Rails App in suEXEC mode, so if you run your app as root from command line, there might be permission problem, you should fix those problems. And you should start WEBrick or other RoR server as the user own the public directory of the app.

Another difference is that LSWS by default only set PATH to "/usr/local/bin:/usr/bin", if you application use a command in other path or depends on any shell environment, you should set those environment variables under Ruby tab explicitly.
 
#5
I changed $VH_ROOT's owner and group to nobody, which is the same as litespeed... so shouldn't it be able to access it?

also, /usr/bin and /usr/local/bin are the only places that I know of that have a ruby (etc) executable, but then again, I'm obviously not an expert. :)

So, to test the permissions problem I created a new dummy app (using rails 1.2.4) in the LS root folder, /opt/lsws/test_site, and pointed the vhost to that directory instead. It reads from the public directory, but won't parse ruby. I created another dummy app (using rails 2.0.2), and it works just fine. The problem is that the real app has already been developed in 1.2.4 and is not compatible with 2.0.2.

Is there a reason that 1.2.4 wouldn't be recognized properly by LS (or linux I guess, but that's getting on a tangent)?
 

mistwang

LiteSpeed Staff
#6
Try changing "Ruby Path" under "Rails" tab to another ruby executable, if it was /usr/bin/ruby, change it to /usr/local/bin/ruby or vice versa.
 
Top