On Mon, Jun 20, 2011 at 12:32 PM, Rakesh S <rakesh.usenet@...> wrote:
> On Mon, Jun 20, 2011 at 12:36 AM, Rakesh S <rakesh.usenet@...> wrote:
>> I am looking at the documentation for integration my fastcgi scripts
>> with yaws and it mentions about fastcgi.
>>
>> There is this wiki here that goes through this briefly:
>> https://github.com/klacke/yaws/wiki/run-rails-under-yaws .
>>
>> My specific use case is that of a native C fcgi library that I want t
>> be integrated with yaws.
>>
>> Some quick questions mapping the rails with my scenario.
>>
>> 1)
>> appmods = </, mod_rails>
>>
>> What would this be set in a native fcgi executable, i.e. something
>> that is produced by gcc , and what custom application modules do we
>> need to write / load ?
You need a module similar to yaws_appmod_cgi.erl that instead of
calling yaws_cgi:call_cgi, calls yaws_cgi:call_fcgi_responder or
call_fcgi_authorizer depending on what you're trying to do. You'd then
configure that module to handle "/", similar to what you show above.
Your native fcgi code is, I assume, an fcgi server. You just run that
on a host:port configured as fcgi_app_server and let yaws talk to it
that way.
>> 2) docroot = path/to/rails/application/public/directory
>>
>> Where would the fcgi directory be located ?
>
> To clarify, if the fcgi binaries are present in say , /srv/cgi-bin
> and the static files are present under - /srv/www , what would
> docroot look like ?
I think you should make docroot = /srv/www in this case. Yaws won't
actually be running the fcgi binaries itself, but will instead
communicate with your fcgi server over a network connection.
>> 3) fcgi_app_server = localhost:3000
>
> Ok - as far as 3) is concerned - that seems to indicate the fcgi ip
> socket communication through external program ( spawn-fcgi , for
> example).
>
> # spawn-fcgi -F 1 -a localhost -p 3000 <fully-qualified-path-to-fcgi>
>
> seems to do the trick.
Correct.
> (Alternatively: the other way of communication is also through an unix socket,
>
> # spawn-fcgi -F 1 -s /tmp/unix.socket <fully-qualified-path-to-fcgi>
>
> There were some threads that discuss about how fast the unix socket
> communication is , as compared to the IP socket communication between
> the web server and fcgi process.
> )
>
> Is there a facility in yaws to communicate via unix sockets though ?
No, because I don't believe Erlang provides such a facility. (I think
there might be an experimental/example driver for this in the Erlang
distribution but it's not supported.) If you're talking over localhost
connections, they're pretty darn fast in my experience.
> That still leaves 1) and 2) in terms of configuration though. Any
> more specific pointers will be much appreciated . Thanks !
Hope this helps. If not, feel free to ask further questions.
--steve
|