postrank-labs / goliath

Goliath is a non-blocking Ruby web server framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How start goliath with rails

JohnBat26 opened this issue · comments

Hi.
I have installed goliath and want to run my rails app with it.
How can I start rails app with goliath ?

Goliath isn't designed to run Rails applications. It's more along the lines of, if your Rails application needs to do some heavy lifting the Rails app would make a call to the Goliath App to do the work.

@dj2 But what's the point of making calls from synchronous Rails code to async Goliath? If I understand correctly, Goliath server should be accessible directly from the client, not behind a synchronous server.

I'm not sure what making Goliath available to clients has to do with Rails? We had our rails server talk to our Goliath servers, and allowed clients access through the API. But, we didn't run Rails under Goliath. Goliath was designed for API servers.

@dj2 I guess, as many people are using Rails, it's just not immediately clear where in the stack is the place for Goliath. I myself discovered Goliath just a few days ago, and my understanding is it's a separate server which can be useful, particularly, for AJAX-requests that require slow IO operations to get the response. That is while the rest of the application doesn't require these and works just perfectly on Rails. And having this combination, the questions arise about how to share the user sessions, how to deploy etc.

BTW, your episodes on the peepcode helped me a lot to get a grip on EM stuff.

For us, we always kept the two things separate. We had API keys for the frontend and for external clients. The Rails app would send it's API key the same as external clients.

We deployed them separately as we usually pushed the API servers a lot more than the Rails app. The API servers were also versioned so we could push a new version while the Rails app was still talking the old version. Then update the Rails as a needed.

@dj2 When you say about Rails consuming the API provided by Goliath, do you mean inside the Rails request? This would block the Rails server until it receives the response, which is what one would want to avoid, isn't it?

Yes, it blocked the Rails requests. In our use case we'd want that to happen as there was nothing else to send to the client until we received the reply.

@dj2 I see. Thank you.