At Leaseweb, we have quite some experience using various tools to build infrastructure as code. This concept requires a very different way of thinking in order to design and build your infrastructure. Also, the gap between operational and development work is closing quickly, as managing infrastructure nowadays starts to look more and more like managing a software project.
For example, our operations and development teams all collaborate on a big repository of Chef recipes that we use to roll out our systems. Only two years ago their responsibilities, configuration and code would have been totally separated, and it was unthinkable that such an overlap would even exist.
Today, I’ll show two tools that are shaping the future of infrastructure as code. I’ll introduce them quickly and show you how to get up and running with them.
Containers
Docker is a tool to create small, portable containers with applications that can be deployed anywhere. A single Docker container merely contains the application and the libraries it depends on. The Docker engine (which uses Linux Containers), can run these as an isolated process on the host OS. Compared to a normal virtual machine (VM) this brings the advantage that there’s no guest OS needed in the VMs, so the containers are very lightweight and will start in seconds. (Further reading here)
Gaudi
Gaudi (In this case, not the famous architect) is a very clever open-source tool that helps you define and configure your architecture using Docker containers. It provides you with an intuitive drag & drop interface that helps you autogenerate the YAML configuration you need to deploy your infrastructure. Watch this screencast to see how it can be used to deploy a Symfony PHP application: http://vimeo.com/97235816
Deploying Go, Docker & Gaudi on CentOS
Gaudi requires both Golang and Docker to be installed. Here’s how to install them on a fresh CentOS 7 Leaseweb machine, the easiest way to install Go is to use the EPEL repository which can be enabled with these commands:
wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm |
rpm –ivh epel-release-7-0-2.noarch.rpm |
Once this is done, we can install Go and Docker easily:
yum install golang |
yum install docker-io git bzr |
The above command will also install Git and Bazaar, which you will need for Gaudi. Next, we should be able to get Gaudi:
go get github.com/marmelab/gaudi |
Now start Docker and we should be ready to go:
systemctl start docker.service |
You can now use the Gaudi builder to build your architecture, for example, you can deploy NGINX + PHP-FPM, then save the configuration YAML file to .gaudi.yml (click here for our test file which will deploy NGINX and PHP-FPM working together in separate containers) and use the following command to start your containers:
gaudi |
It will take a while to start first time, but after you should be able to use:
docker ps |
To show your running containers.
The future
We have abstracted the infrastructure to code, and the next generation of tools, like Gaudi, will abstract that code into graphical interfaces, so there’s no writing or copying code involved at all. However, there are still some challenges to overcome before infrastructure as code will be the de facto standard. There are currently many different tools, standards and syntaxes, which make it hard for someone new to pick the right set of tools. On the Microsoft platform the choices are very limited, but I’m pretty sure that in a few years, it will be rare for someone to deploy and configure their infrastructure manually.