Apache + Erlang Web Frameworks

I recently started an Erlang project involving grid computation. One requirement is a web interface into the grid. Naturally, the interface would work best if the web app is written in Erlang too. As far as I know the Erlang web frameworks currently available are BeepBeep, Chicago Boss, Erlang Web, ErlyWeb, Nitrogen, and Zotonic. The problem that I have with the previous frameworks is that they're designed to work with Erlang-based servers (namely Inets, Misultin, Mochiweb, and Yaws). I'm running Apache, so out of the box none of these frameworks work on my setup. Normally, bundling a high-capacity server makes sense because if your webapp is in Erlang you probably want the whole system to be robust, distributed, large-scale, etc. However in my case, the web interface to the grid is fairly light and not mission-critical. So this is the ideal framework organization for my setup:
diagram
Creating an Erlang framework that can run under Apache (and most other HTTP servers) is a matter of hosting a CGI bridge to the framework. This bridge then makes a remote procedure call to an Erlang node requesting a page to be constructed. Since a CGI file can be composed in C/C++ it can therefore interface with Erlang nodes using the erl_interface library. Put simply, we're using a small piece of code (a working rough draft is ~200 lines) to connect a web framework written in Erlang with any web server that supports CGI (notably Apache and IIS).

This CGI bridge opens up Erlang frameworks to a host of existing non-Erlang web servers. The major use for this is connecting smaller dynamic websites with larger distributed Erlang applications. Furthermore, in the event of a server crash the larger application persists with only the web interface going down. I've written a working rough draft of the bridge, and Apache is serving pages generated from Erlang. POST and GET data among other server variables are being passed into the framework/webapp stub removing the need for side-effects within Erlang. The next step is seeing whether I can connect this bridge to an existing framework.

No comments:

Post a Comment