RoR and Growing Pains

I have persuaded my company to move towards an RoR shop… from a PHP 5
(with in-house-built framework)… so the jump is not terribly bad. I’m
REALLY excited actually!

My problem: I am overwhelmed with all the setup Loops I have to jump
through to get RoR setup. I tried it on my current Apache 1.34 and
decided it’d be easier to make the Lighty (1.4.11) jump. So I did. I get
it working fine as per all the nice HowTos out there… but it only
works for one single Virtual Host. Namely: http://localhost/test/ but if
I wanted to add a second one I had to add to http://mylappy/newapp

Both being on the same box but added to my /etc/hosts file…

Could I just setup mod_userdir and have ALL my Rails apps be under
/home/ro/public_html/ ?? (I’ve tried something to this effect
but I am too green in Lighty to know where I’m wrong)

This is my sample vhost (Lighty) I simply repeat it for my other app:

142 $HTTP["host"] == "fxonrails" {
143     server.document-root = "/home/rsamour/test/public/"
144     accesslog.filename = "/home/rsamour/test/log/access.log"
145     server.indexfiles = ( "dispatch.fcgi", "index.html" )
146     server.error-handler-404 = "/dispatch.fcgi"
147
148     # rails stuff
149     #### fastcgi module
150     fastcgi.server = (
151             ".fcgi" => (
152                 "test" => (
153                           "socket" => "/tmp/test1.socket",
154                           "bin-path" =>

“/home/rsamour/test/public/dispatch.fcgi”,
155 “min-procs” => 1,
156 “max_procs” => 2
157 )
158 )
159 )
160 }

Thanks in advance,

-ro-

You’ve about got it. If you do something like this then you can have
multiple subdirectories on one host. The next item will have a
different $HTTP[“url”] as I’m sure you can imagine.

MAGNET

$HTTP[“host”] == “www.railsconsulting.com” {
$HTTP[“url”] =~ “^/magnet” {
var.appname = “magnet”
server.document-root = “/var/www/” + var.appname +
“/current/public”
alias.url = ( “/magnet” => “/var/www/” + var.appname +
“/current/public” )
server.error-handler-404 = “/magnet/dispatch.fcgi”
fastcgi.server = ( “.fcgi” =>
( var.appname =>
( “min-procs” => 1,
“max-procs” => 1,
“socket” => “/tmp/” + var.appname + “.fcgi.socket”,
“bin-path” => “/var/www/” + var.appname +
"/current/public/dispatch.f$
“bin-environment” => ( “RAILS_ENV” => “production” ),
)
)
)

Michael

Michael:

Thanks… the problem that I’m trying to solve is that I used to be
able to say: http://dev/~user1/app1/ or http://dev/~user1/app2/ or
http://dev/~user2/app1/ and it just work… Your magnet example works
great for production but I’m wanting (if possible) to get the
Development side working… Would it still be the same way as you
illustrated? Thanks for the advice and patience! :slight_smile:

-ro-

Someone more knowledgeable than I will have to help you out here. I
don’t see how it’s possible with the way things are laid out with a
rails app, but then again, I’m just figuring this stuff out. Good
luck, and if you figure something out, let me know. I’d be interested
as well.

Michael

Rogelio J. Samour wrote:

I have persuaded my company to move towards an RoR shop… from a PHP 5
(with in-house-built framework)… so the jump is not terribly bad. I’m
REALLY excited actually!

My problem: I am overwhelmed with all the setup Loops I have to jump
through to get RoR setup. I tried it on my current Apache 1.34 and
decided it’d be easier to make the Lighty (1.4.11) jump. So I did. I get

Just a note about setup choices you mentioned:

  • Apache 1.34 will be slower than Apache 2.x (MPM-Worker) and
    Lighttpd-1.4.x.
  • Lighttpd-1.4.11 has issues with SSL when using fastcgi but it works
    great for me otherwise

If you decided to go with Apache 2.x, then I recommend Apache-2.0.55
(MPM-Worker), mod_fcgid-1.08, and mod_security-1.9.2. Don’t use
mod_fastcgi-2.4.x unless you are running Apache 1.x.

Also, if you use MPM-Prefork with Apache 2.0, it will be slow as Apache
1.x–so try Apache2’s MPM-Worker to see if it works for you because it
will be similar to Lighttpd speed.

Take a look at what I worked out in this thread:

[Rails] hosting multiple rails apps in one webroot?