eFortunes 0.1: a distributed, scalable and fault-tolerant fortunes server developed in Erlang

Well, after naming this post in this way I think it could be a good idea to explain what this is about… :)

As the result of working in my Master Thesis, I developed an small “ad-hoc” framework for programming simple and so-so-small web applications using Erlang, since a requirement for doing my Thesis was using distributed functional technology… and web applications are not usually developed with this kind of tools. Well, I know that with ErlyWeb this assertion could be wrong in a matter of months ;) , but when I started my work (a year ago) the situation was so much different from now.

In the other hand, my fellow worker Javier Muñoz had recently developed a so much practical script (“Erlang On Rails”, as he called it) for easily start with the development of Erlang applications, without getting lost (and bored) with several commonly needed issues, such as the application definition file, the compilation process or the launcher script. On this post you can read more about “Erlang On Rails”, as it was told by Javi some days ago.

With this background on mind, I felt myself encouraged to develop an small web application that let me to carry on learning about the Erlang world, now that my Thesis is (at last) over… and I thinked about doing an “absurd” (well, this is subjective :) ) fortunes server could be a good choice, since I could learn with it more about so many issues about Erlang I haven’t learnt yet, or get a deeper knowledge about issues I’ve already know. For instance:

  • Distributed persistence of data (fortunes) using Mnesia, a Erlang-based objectual DBMS.
  • Persistence into a relational DBMS (such as PostgreSQL) using the ODBC API provided by the Erlang/OTP platform. (Nowadays, it seems Mnesia is not suitable for storing large amounts of data)
  • Developing reliable and fault-tolerance applications on Erlang according the design principles of the supervision tree, as suggested on the Erlang/OTP documentation at erlang.org. (Well, sometimes fortunes are a really-critical information… don’t you think?)
  • Designing of web applications with Erlang using Yaws, a light web server developed on Erlang which is quickly growing on these days, adding more and more capabilities with each version that is out (such as AJAX or haXe support).
  • Testing several frameworks I’ve recently discovered on the web, and that I wasn’t able on my Thesis because of a matter of time: Yatsy, ErlyDB, ErlTL, ErlyWeb
  • And so on…

In fact, all these points could be abbreviated as “learning more about Erlang and having an workbench for testing all those issues I’d like”. And if, while learning in this way, I get a distributed, scalable and fault-tolerant fortunes server for being able to safely store jokes and spontaneus comments… “better than better” XD

At last, I’d like to thank my Master Thesis’s director (Víctor M. Gulías) for letting me to license my work under the terms of the GNU General Public License, in order to let everyone to get the source of eFortunes and use it as needed.

Now I’ll end this post by telling the current features of eFortunes 0.1, the TODO list (this one could change, of course) for eFortunes 0.2 and some screenshots of it. And, of course… you can download the source code if you want from here:

efortunes-0.1.tar.gz

eFortunes 0.1 features:

  • List, create, edit or remove fortunes from server
  • Underlying distributed persistence layer based on the Mnesia DBMS
  • Easy access to the services offered by efortunes by using a simple web interface (powered by yaws)
  • Internationalization (i18n) support for the implementation of the web interface

eFortunes 0.2 TODO list:

  • Bug fixing ;)
  • Add the capability of importing/exporting from/to regular fortunes files
  • Add search interface for making possible to look for fortunes according some specific criteria
  • Improve the web interface ( well… this is a must ;) )
  • Add an user profiles management tool (currently, only an user admin/admin exists)
  • Create an standalone, deployable daemon of efortunes (maybe, yaws should be embedded into an erlang application)
  • Documentation and code-cleaning

eFortunes screenshots (sorry, only spanish text on them):

List all the fortunes

Edit a fortune Deployment of eFortunes