# Rails on Resin

**URL:** <https://www.ruby-forum.com/t/rails-on-resin/95203>\
**Category:** Rails\
**Created:** [January 14, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203 "2006-01-14T19:00:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 14, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/1 "2006-01-14T19:00:41Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 14, 2006, 7:45pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/2 "2006-01-14T19:45:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 14, 2006, 10:34pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/3 "2006-01-14T22:34:27Z")

</div>

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/](http://tzinfo.rubyforge.org/) – DST-aware timezone library for Ruby

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 16, 2006, 7:04am UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/4 "2006-01-16T07:04:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/5 "2006-01-21T15:39:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 15, 2006, 10:38am UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/6 "2006-01-15T10:38:22Z")

</div>

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](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](http://defendem.com/read/chapter/6)

But I don’t know how current that is…

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/7 "2006-01-21T15:40:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/rails-on-resin/95203/8 "2006-01-21T15:40:22Z")

</div>

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
