The best vagrant docker ansible development environment

Hello à tous,

It's been a while since my last post. I'm very busy lately because of some changes in my career.

But lately I was playing and viewing some presentations about the new development tools going on. Some really good stuff is waiting to be deployed and played with.

I'll share a development environment set up for web development that I've in mind.

First of all, I don't like to have development tools to be installed on my real system. Do not know why exactly but I think that my security background is telling me to not let any tool available to a possible attaquer. That's why I would use a virtual image for my development environment. And who's telling virtual image should almost immediately think about vagrant. This virtual image manager can work with virtual box and vmware boxes. It also configure automatically your ssh connection and file sharing. Easy to deploy and package prepared boxes.

Besides that you can use it with well known provisioning systems. A provisioning tool will allow you to execute a set of predefined commands to configure your system. My favorite one is ansible because it uses yaml and because of it's really simple syntax and script galery (called galaxy). Thanks to it you could easily deploy your favorite development tools and or softwares. But in my opinion an interesting option could be to install docker using your ansible configuration.

Docker is based on an old technology that is rapidly becoming a state of the art. As of BSD based systems with their junk tool, docker allows you to run a process in his own environment totally separated from others. Each process is called a container allowing you to have a lot of different atomic processes. It's just like having a virtual machine for each process! But, in order to have your docker to work, you'll need to install a specific linux kernel module.

Because i really like to have a clean machine, i'll recommend people to use a vagrant to install this specific development software (I know that some people use it as a day to day tool but it is another use case). The only problem introduced by docker is that you'll soon have a lot of containers running in parallel and some will depend from one another. That's why docker bought Fig, another tool for container dependencies management.

So now that we have our virtual box environment packed with native docker multicontainer support, we need to think about our application architecture. Every web application nowadays use the same pattern with a front-end communicating with a back-end using a database. While developing you'll face different challenges that you'll resolve though complexe algorithms. These solutions needs to work for your local development environment but not only. You'll need for example to follow the new version of your interpreter or compiler and see if all your hard work is actually compatible. For this you'll as for each project need a good layer of tests (unit and functional) that you could pass on each necessary version. This way upgrading will not be such a pain in the ass. Another big problem is when you create a new solution that actually works on your local data but lamely bug on real production data. To avoid such bad news, you could with docker container, launch a sql server instance with development data or production data really easily. You could also create profiling configuration to follow based on it so bad optimized code will be rejected automatically (see blackfire PHP profiling tool)

So to resume, to have our best development environment we'll need a virtual image with docker integrated for our continuous integration tests and profiling based on rock solid automated testing launched with corresponding data programmatically.

Let me know what you think of such development environment and I may post a more technical post on this subject.

Remember to have fun.

A+ Flyers.

Most seen