Is Webrick good enough?

Hi all,

On the rails list I’ve seen that it’s hard to integrate Rails with
Apache
(especially apache2), that it’s hard to change the default port (3000),
and
that Apache runs Rails stuff slowly.

Is it reasonable to run Rails stuff on Webrick while simultaneously
running
other stuff on Apache? How does one simultaneously run two rails
applications
on Webrick, when one must start webrick in the specific app’s directory
(script/server)?

Thanks

SteveT

Steve L.
Author:

Steve:

You can easily run different webrick apps at the same time by
specifying different port numbers. I find the EASIEST way to do this
is to run Locomotive. Locomotive is FREE and available from
sourceforge. Just put ruby rails locomotive into google. BY default
Locomotive runs lighttpd, which seems like a very capable Apache
equivalent (but I am no expert on such matters). Continue your
enquiry with the cognoscenti on this list, if you wish to ask about
the comparison.

bruce

I didn’t see any visual cues that would lead me to believe he was
running Mac OS X which Locomotive is for.

On the other hand if he’s using Windows he can try Instant Rails which
is an all in one Rails dev environment complete with Apache / MySQL

Frank:

You are absolutely right. I forgot it was not cross-platform. Thanks
for setting me straight there.

bruce

Well neither is Instant Rails (at least not yet). I can’t wait until
it is though. =)

On Wednesday 04 January 2006 11:12 am, Frank H. wrote:

I didn’t see any visual cues that would lead me to believe he was
running Mac OS X which Locomotive is for.

On the other hand if he’s using Windows he can try Instant Rails which
is an all in one Rails dev environment complete with Apache / MySQL

Thanks Frank

I’m running Linux (Mandrake currently) and expect any web hosts I use to
run
Linux or BSD also. How does that change the situation?

Thanks

SteveT

Steve L.
Author:

On Wednesday 04 January 2006 12:05 pm, Frank H. wrote:

well Rails is Rails is Rails… Haha. But the cool thing about Instant
Rails / Locomotive is their easy install, they seem to come with
everything one would need to get started easily. As far as IR goes it
l looks like a future version will likely be cross platform and run on
Linux.

On linux I run Ruby 1.8.4, Rails 1.0.0 and Lighttpd / FastCGI which is
pretty easy to get running and there is alot of information on the web
about configuring it.

Does Lighttpd/FastCGI require setting a port number for each app?

Thanks

SteveT

Steve L.
Author:

well Rails is Rails is Rails… Haha. But the cool thing about Instant
Rails / Locomotive is their easy install, they seem to come with
everything one would need to get started easily. As far as IR goes it
l looks like a future version will likely be cross platform and run on
Linux.

On linux I run Ruby 1.8.4, Rails 1.0.0 and Lighttpd / FastCGI which is
pretty easy to get running and there is alot of information on the web
about configuring it.

On Jan 4, 2006, at 9:39 AM, Steve L. wrote:

which is
Steve L.
Steve-

You have a few different options for hosting multiple rails apps on

one linux box. If you absolutely need apache then you go ahead and
kep apache running on port 80. Then you can run lighttpd for each of
your rails apps on a different port and proxy the requests thru
apache. Or you can just run lighttpd and use its vhost capabilities
to run different apps.

Lets assume you want to use the apache->prox->lighttpd/fcgi method

for now. Here are some example vhosts for apache that will proxy thru
to lighttpd on a high port:

Apache 1.3.x:

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/

Apache 2.x:
<VirtualHost :80>
ServerAdmin [email protected]
ServerName example.com:80
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.
) http://127.0.0.1:3000/$1 [P,L]
ProxyPassReverse / http://127.0.0.1:3000/

Then you can run one lighttpd instance for each rails app each on

its own port. This gives you the advantage that you can restart each
rails app individually without affecting the other apps. Also once
you install lighttpd and make sure it is in your $PATH, script/server
will use lighttpd instead of webrick by default. So all you need to
do is install lighttpd and then run each of your apps behind an
apache vhost by setting a port number for each app and then using
this line to start each rails app:

$ script/server -e production -p 8000 # or whatever you want for each
app.

Hope that helps you out a bit. This is one area of rails

documentation that is sorely lacking. All the info is fragmented
across a hundred blogs and each of these blogs contradict each other
in some ways. So I am happy to tell you that I am writing a “Rails
Deployment” book for the Pragmatic Programmers as we speak. Look for
a beta pdf version in March.

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]

PS. You can find more helpful info on rails configuration and
deployment on my blog at:
http://brainspl.at

Ezra Z. wrote:

On Jan 4, 2006, at 9:39 AM, Steve L. wrote:

So I am happy to tell you that I am writing a "Rails

Deployment" book for the Pragmatic Programmers as we speak. Look for
a beta pdf version in March.

This sounds great! I am running Apache 2, MySQL 5 with PHP on Windows,
and am looking for the best way to serve ROR without impacting the PHP
stuff harshly… and am I mistaken but is Lighttpd not an option for
Windows?

I am also running the same setup on OS X as a dev environment and it
would be great to have a simple (well even a single) way of setting all
this up. I know about Instant Rails, Locomotive, etc, but I don’t want
to “redo” my existing setup.

Some help in the area of melding ROR in existing evnvironments (where
changing the webs server or platform is not an option) can only help
Ruby and ROR adoption. Look forward to the book!

In the lighttpd configuration you can map apps in however you want,
based on
host name, url, port, whatever.