There is a proper guide in the project wiki for doing this, you start to follow it and end up with the following activities:
So you take a day or two for environment setup. You encounter various issues. Some of the issues are easily solved by that nice senior guy of the new project. Other issues he has never seen. The strangest issue you encounter sounds familiar to him, but he does not remember exactly what they did to overcome this issue. The lady who probably knows more has left the project, works in some other country now, and is unavailable at the moment.
Why is every environment setup for any project a unique artwork? What if you could just get it with a single click? Why not let the computer do the step-by-step setup automatically for you (and you having a lunch or a table football match with nice colleagues at the same time), and still start being productive in half an hour instead of three and half days? This is exactly where development environments automation, when done properly, can help.
So, development environment automation can make local development environment setups automatic and repeatable. This would save lot of time in situations like these:
You can always script development environment automation in your favorite programming language, but that may turn out a long and hard task. Another way would be to build the entire solution in Docker way, which also takes care of development environment automation. Yet the third way is to use Vagrant, which is a tool especially meant for that. Since I like automation and since I happened to have some free time, I started exploring development environment automation the Vagrant way to create a setup of a particular project I would possibly be starting in the future.
Once I got started, I encountered a mess of related tools and technologies that were totally new for me: Ruby, Chef, ChefDK, Chef Solo, ChefSpec, Vagrant, various Vagrant plugins, Berkshelf, Knife, Test Kitchen, RSpec, Serverspec – what are all these? Do I need to learn them all? Do I need to learn a new programming language? Several weeks later, the mess was sorted out and I had a working solution together with automated tests. Here is a brief description of the solution:
The basis for the entire solution is Vagrant (https://www.vagrantup.com/), of course. Vagrant and all the other tools are based on Ruby programming language (https://www.ruby-lang.org). However, I did not have to learn all of Ruby, because the tools generally provide a Ruby-based DSL for configuring them. (I still got quite excited about Ruby)
I used Chef Solo (https://docs.chef.io/chef_solo.html) as a provisioning engine. This is a version of Chef that works without a Chef server.
I started with a generic public vanilla Ubuntu 14.04 box from the Hashicorp’s Atlas box catalog (https://atlas.hashicorp.com/boxes/search) Then i had my Chef cookbook build up everything on top of the box.
I used some public open-source Chef cookbooks for setting up some widely used open-source components: Tomcat, ActiveMQ, MySQL, Java. I used Berkshelf (http://berkshelf.com/) to manage cookbook dependencies. I also used the Berkshelf plugin for Vagrant to handle the dependencies fully automatically – I just had to declare them. This series of blog posts was the most helpful source of information for me: Docker Getting started writing Chef cookbooks the Berkshelf way/.
Since I’m a fan of test-driven development, I developed unit tests for this solution as well. I used Chefspec (https://github.com/sethvargo/chefspec), which is a Chef-specific extension of Rspec (http://rspec.info/) – a unit-testing framework for Ruby. Here is an example of a Chefspec unit test: it ‘creates tomcat-users.xml file with correct admin user and roles