Archive for September, 2008

Web Application on Erlang: Configure Nginx with Mochiweb

September 30th, 2008 by Hughes | Posted in erlang | 5 Comments »
Tags: , , ,

My previous post, the first of our series dedicated to the Erlang world, was definitively getting too long, so here is the second chapter of this marvelous article.

I’ll assume that you have successfully installed Erlang and Mochiweb and deployed your first small tiny app.

When it comes to deliver static content at lightning speed and do reverse proxy job, there is one name : Nginx, the Igor Sysoev high-performance HTTP server.

It plays well with ssl and in the last dev version you can even find an interesting module for uploading files, nothing less … we will probably tell you more about that in the series.

Nginx is really turning itself into a real handy swiss knife.

Continue Reading »

How To Quickly Set Up Ubuntu 8.04 loaded with Erlang, Mochiweb and Nginx

September 25th, 2008 by Hughes | Posted in erlang | 24 Comments »
Tags: , , , , ,

Let’s say you want to give a try to Erlang (Discover our post about Why Erlang?) for your next web development project and you want to be up and running as quickly as possible… you just landed smoothly in the right place.

This post is the starting point of a series of posts in which I’m going to provide you with all the commands you’ll need to set up an Ubuntu 8.04 server loaded with Erlang, Mochiweb proxied by Nginx.

In the same series, I’ll also cover:

  • The basic configuration of Postfix (mail)
  • The use of Imagemagick to create dynamically a captcha for your application
  • The configuration of Bind9 in order to play with the url CNAME

The goal here is not to set up an hardened production server with all the optimizations and security niceties in head (I definitively want to avoid a ‘Why not Gentoo, or Slackware, or Debian, or FreeBSD, …?’, I love them all).

Continue Reading »

Major Release for our JavaScript Template Engine – PURE

September 18th, 2008 by Yves | Posted in PURE | 5 Comments »
Tags: ,

Thanks to your comments and the requests made on our discussion group we have been able to bring PURE to its next step.

This release contains a few corrections but also a lot of new features:

  • Auto-rendering: a new PURE method takes your HTML and your JSON data and merges them automatically. The class attribute is used to map the HTML and the data. (Read more about autoRender and its jQuery version on our Wiki).
  • Functions as directive are called by reference and not serialized
  • Change the id of the template root node (as any other attribute)
  • Better string value handling
  • Use of named properties in iteration “obj.prop” as well as “obj['name']“

We also made some changes to the PURE environment:

  • The source code moved from Google Code to GitHub

We are also actively looking for help in order to port PURE to other JS libraries such as DomAssistant, Dojo, Mootools, Prototype, YUI, …

If you are ready to get your hands dirty, just pass by the discussion group and leave us a message.

Stay tuned

PURE is running on the iPhone

September 11th, 2008 by Mic | Posted in PURE | 1 Comment »
Tags: ,

As you may know, Belgium has some oddities.

One of them is a poor phone law that makes consumers pay the full price for a phone, probably one of the highest in the world. This doesn’t bring any cheaper usage cost than our neighbours either.

So it came as a kind of consolation when I saw PURE running smoothly on my brand new iPhone 3G.

Ok, it’s an easy shot as Safari is running there. But that’s good news for web applications using PURE.

Even if we’ll have to build specific screens for the smaller devices, we’ll be able to use the same technology, back-end services and share some templates between the desktop and the smart phone versions.

Moreover, the rendering speed was really good. We will show some benchmarks soon.

I can’t wait on what Google/HTC will ship in a couple of months.

Web Application on Erlang: So Far, So Good, …

September 2nd, 2008 by Hughes | Posted in erlang | 7 Comments »
Tags:

As a quick recap, I’m building a lightweight server side custom framework which focuses mainly on handling JSON service requests.  This, combined with Mnesia, is our MC stack (Model – Controller).  The client browser will be fully in charge of the ‘V’iew layer of the app.

(See our post Why Erlang ? for more information).

A stable version of the core has been finished a week ago.  In brief, a request hits the server, Nginx proxies it to Mochiweb which starts a new process. 

At this point the framework converts the posted data (JSON) to a native Erlang structure. We check if the request contains one or more services and, based on their name (=:= module), we spawn processes accordingly.

As you may have noticed, in order to save some http requests and to use the full power of our server, the client can ask for an array of services.

i.e. : Let’s imagine you are building a screen which is divided into multiple small independent functional parts : your preferences, your status, your personal info, whatever …, you have the choice to wrap all those service calls into one JSON and the framework will happily process those in parallel … fine isn’t?

At this stage of development, and provided that the DB is not fully populated, if I make a comparison with other developments I’ve done using other languages/architectures, my global feeling is : SPEED.

Whenever I find myself in the situation of using a ‘map’ function and depending on the computation weight on each element, I’m parallelizing the operation (pmap).

Coupled with PURE for the rendering at the client side, we aim to end up with a highly responsive application.

The job now is to continue on that track and make the whole thing even more flexible.

One of my concern when choosing Erlang was the lack of libraries compared to other languages such as Ruby. However, I found relatively easy to develop, from scratch, a mail module responsible to dynamically build messages to be send to one or more addresses (via Postfix) and a ‘captcha’ system.

Soon, I will say a little bit more about those two points and will also describe how to quickly set up an Ubuntu server running Erlang and friends.

Stay tuned