Rails on Resin

Anyone figured out how to get rails/fastcgi to run on Resin.

I assume it would be similar to PHP, which there are directions here:

http://www.caucho.com/resin-3.0/thirdparty/php.xtp

One thing that confuses me is that it wants a server address:

localhost:8002

Apparently you start the php process, like this:

php -b 8002

And then the PHP process listens on that port. Is that how you would do
it
with rails? If so, what process do you start?

not entirely familiar with resin, but rails as an app server listens
on 3000 for requests. This can be overridden with -p to
script/server…

i.e., script/server -p 8002 -e production

or something like that

adam

Paul B. wrote:

Apparently you start the php process, like this:

php -b 8002

And then the PHP process listens on that port. Is that how you would do
it with rails? If so, what process do you start?

The equivalent of the php command is probably:

script/spawner --port=8002 --instances=1

This will start a Rails FCGI server on port 8002. You’ll need to have
lighttpd around to run this command though. The script uses the
spawn-fcgi command that is included with lighttpd.

Phil


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby

Even if you get Resin to talk to your Rails app through FastCGI, from
looking at the Resin code, you are limited to a single FastCGI process
per
app, since Resin only takes a single host/port, and Rails only runs with
a
single process per port.

I think Resin’s FastCGI support is designed for minimal use of
functionality
you can’t get any other way, not for full scale app hosting.

Isn’t that WEBrick that listens in port 3000? I thought WEBrick was
only
for development?

Adam D. wrote:

not entirely familiar with resin, but rails as an app server listens
on 3000 for requests. This can be overridden with -p to
script/server…

i.e., script/server -p 8002 -e production

or something like that

Not for FCGI, you don’t. There’s no need to fire up WEBRick (the
process that listens on port 3000) or lighttpd in that case. You want
the dispatch.fcgi script in the public/ directory of the app. There is
an example parallel installation of FCGI PHP and rails on lighttpd here,
which may help:

http://textsnippets.com/posts/show/299
There’s an example of configuring rails fcgi to listen on a port rather
than a socket here:
http://defendem.com/read/chapter/6

But I don’t know how current that is…

So in order to use FastCGI with Resin, you would have to use lighttpd as
well?

On 14.1.2006, at 22.29, Paul B. wrote:

Isn’t that WEBrick that listens in port 3000? I thought WEBrick
was only for development?

Rails nowadays uses lighttpd if it’s found on the system. However,
3000 is still the default port unless your lighty config file says
otherwise.

//jarkko