You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Audrey Lee <au...@gmail.com> on 2010/04/05 05:13:36 UTC

How I "glue" together Rails and couchDB ?

Hello couchDB People,

Is it possible to easily glue together couchDB and Rails?

I have a rails server running here:
  http://localhost:3000/rails/

And I have a couchDB server running here:
  http://localhost:5984/

I'd like to configure couchDB (or Rails) so that I have a server which
listens on 8080.

I want any request directed at:
  http://localhost:8080/rails/
to be forwarded to
  http://localhost:3000/rails/
And I want all other requests to be forwarded to
  http://localhost:5984/

Or perhaps I could configure couchDB so that any request directed at:
  http://localhost:5984/rails/
is forwarded to
  http://localhost:3000/rails/

Have any of you done something like this?

Re: How I "glue" together Rails and couchDB ?

Posted by Audrey Lee <au...@gmail.com>.
Here is some configuration syntax for nginx I got from the nginx mail list:


server {
   server_name localhost;
   listen 8080;

   location /rails {
       proxy_pass http://localhost:3000;
       include proxy.conf; # other proxy settings - see docs
   }

   location / {
       proxy_pass http://localhost:5984;
       include proxy.conf; # other proxy settings - see docs
   }
}



On 4/4/10, Audrey Lee <au...@gmail.com> wrote:
> Hello couchDB People,
>
> Is it possible to easily glue together couchDB and Rails?
>
> I have a rails server running here:
>   http://localhost:3000/rails/
>
> And I have a couchDB server running here:
>   http://localhost:5984/
>
> I'd like to configure couchDB (or Rails) so that I have a server which
> listens on 8080.
>
> I want any request directed at:
>   http://localhost:8080/rails/
> to be forwarded to
>   http://localhost:3000/rails/
> And I want all other requests to be forwarded to
>   http://localhost:5984/
>
> Or perhaps I could configure couchDB so that any request directed at:
>   http://localhost:5984/rails/
> is forwarded to
>   http://localhost:3000/rails/
>
> Have any of you done something like this?
>

Re: How I "glue" together Rails and couchDB ?

Posted by Ben Hall <be...@googlemail.com>.
Sounds like you need a proxy setting in between your incoming requests
and webserver\couchdb.

I'm currently using HAProxy but nginx would also be a good choice.

On Mon, Apr 5, 2010 at 10:38 AM, Mirsal Ennaime
<mi...@gmail.com> wrote:
> On Mon, Apr 5, 2010 at 5:13 AM, Audrey Lee <au...@gmail.com> wrote:
>> Hello couchDB People,
>
> Hey !
>
>> I'd like to configure couchDB (or Rails) so that I have a server which
>> listens on 8080.
>> I want any request directed at:
>>  http://localhost:8080/rails/
>> to be forwarded to
>>  http://localhost:3000/rails/
>> And I want all other requests to be forwarded to
>>  http://localhost:5984/
>
> You have probably already set up lighttpd / nginx / whatever to serve
> your rails app (and if you didn't, you should)
> You can also use it as a reverse proxy to forward traffic to the right app.
> --
> Mirsal
>

Re: How I "glue" together Rails and couchDB ?

Posted by Mirsal Ennaime <mi...@gmail.com>.
On Mon, Apr 5, 2010 at 5:13 AM, Audrey Lee <au...@gmail.com> wrote:
> Hello couchDB People,

Hey !

> I'd like to configure couchDB (or Rails) so that I have a server which
> listens on 8080.
> I want any request directed at:
>  http://localhost:8080/rails/
> to be forwarded to
>  http://localhost:3000/rails/
> And I want all other requests to be forwarded to
>  http://localhost:5984/

You have probably already set up lighttpd / nginx / whatever to serve
your rails app (and if you didn't, you should)
You can also use it as a reverse proxy to forward traffic to the right app.
-- 
Mirsal