Introducing Gaudi: An Architect for Multi-Component Applications

Emmanuel Quentin
Emmanuel QuentinJanuary 31, 2014
#devops#oss#golang

Web applications often use a lot of different components, such as MySQL, ElasticSearch, or Redis. Installing, running and maintaining theses servers can waste a lot of our time. Especially on development environments, where all components must run on the same machine.

What's the command to install RabbitMQ on Debian? What's the IP of the database in this environment? What's the Java version required to run Jackrabbit ? Your teammates probably ask you that type of questions often.

There are plenty of orchestrators such as Ansible, Chef or Puppet. But learning how to write a Chef recipe, or finding the right Puppet module can be painful.

Gaudi removes the need for orchestrators: it allows all components to run in a single Virtual Machine, using a single configuration file. Developing complex applications with multiple components now only requires that you run gaudi.

Docker filesystem

Gaudi Builds Up On Docker

Gaudi uses Docker containers to run each component of your architecture in a separate and isolated environment.

With layered UnionFS, Docker is able to detect changes in the container configuration, to run only the required operations.

Docker containers share the OS Kernel with the host machine (thanks to Linux LXC) to build tiny virtual machines, allowing them to boot quickly (usually a few seconds).

That way, if you have 6 servers using Ubuntu, Docker will not require 6 times the space of 1 Ubuntu.

With Gaudi, to describe a complex environment, you just need to write a YAML file describing all the servers you need, the type of each server (MySQL, Php, Nodejs, ...), and how they interact together. Gaudi will take care of running them in isolated containers and handling their communication.

Quick Exemple of Gaudi Configuration File

Create a .gaudi.yml file in the folder where you want your application to be stored (or specify a file path with the --config option of the gaudi executable).

Here's a short example:

applications:
    server:
        type: nodejs
        links: [redis]
        ports:
            8080: 80
        volumes:
            .: /app
        after_script: node /app/server.js
        custom:
            modules: [redis]

    redis:
        type: remote
        image: gary/redis
        path: github.com/tallstreet/docker-redis
        ports:
            6379: 6379

Run the entire architecture with one command:

$ gaudi

Cleaning server ...
Cleaning redis ...
Building gaudi/server ...
Building gaudi/redis ...
Starting redis ...
Application redis started (172.17.0.1:6379)
Starting server ...
Application server started (172.17.0.2:80)

Gaudi will build 2 servers: one with Node.js, and the other one with Redis. The nodejs server communicates with the Redis app using the port 6379.

The current folder (materialized by the .) will be mounted in an /app directory in the node container. The after_script will be executed by Gaudi by the time the server is set up: this is where we start the node server.

The Magic Behind Gaudi

  • Written in Go, which allows asynchronism in a simple and elegant way, it can build and start applications simultaneously.

  • Uses Go templates to make Dockerfile and other helpful files for each of your servers.

  • Manages dependencies: If an application is linked to another, Gaudi waits for the first one to start before running the second.

  • Modulable: If an application type is not currently supported by Gaudi, you can use your own, or other containers in the Docker index.

  • Reusable: Project architecture can be shared with your coworkers easily.

Gaudi is open-source and lives on GitHub (marmelab/gaudi). Please give it a try and send me your feedback!

Did you like this article? Share it!