Have you ever wanted to start working on a cool project straight away, but the setup was taking hours?

Maybe you tried to add new microservice to your application but that would involve all changes in the deployment procedure so you decided to stick with the monolith?

Have you ever got an error that was only happening on production because the system setup was slightly different?

If you answered Yes to any of these questions, this article is for you! And if you are a lucky one who never got such issues — good for you! But you can still use these techniques to speed up your process.

Project architecture complexity

Every project is different. Both on the business requirements side, but also, in terms of the application architecture. Sometimes your projects might consist of a simple frontend and backend with a database, sometimes you might have many microservices communicating with each other, several databases with different retention rules and some additional brokers and dispatchers connecting all these modules.

Try thinking about the most complex architecture you had been working with. How hard would it be to setup this project from scratch for a new developer joining your team? The chances are that you will have to spend hours if not days setting up all databases, queues, installing all required dependencies. But you can reduce it to just several minutes using our technique based on virtualisation.

Virtualisation basics

Virtualisation is far from being a new concept. Actually, it was used on the mainframes back in 1960s and 1970s [1] as a solution for processor time sharing technique among various users using the same machine. When you setup your VPS in the cloud — that’s the virtualised machine you are getting.

But the virtualisation got much more popular with emergence of the new technologies like Docker. Old techniques were very robust and efficient, but they were introducing additional complexity instead of reducing it. Docker did something revolutionary — simplified the whole workflow by providing easy to use tools every developer can start working with straight away. Also, it allows you to abstract the whole architecture into single configuration file you can easily share in your project repository.

This article is not, by any means, an introduction to Docker or virtualization. It is a showoff of techniques you can apply in almost any project which will speed up your development, deployment and testing process.

Bootstrap repository

We believe that the project setup shouldn’t be any different whether you are setting up simple frontend app or you are creating 100-microservices-solution. That’s why for every project we setup a boostrap repository which consists of our configuration files and the main docker-compose file which describes how different parts are combined. This is the main repository you are fetching when you setup your project. With a single simple command you can fetch all the project modules. This has a big advantage when the project changes or the new module is added.

After running the project you can start tinkering with the project. If your docker-compose is set up correctly, you can have live reload for all the projects so there is no need to rebuild the module by hand every time you change something.

Sometimes the projects you have to work with have so many services that it is impossible to run all of them on a single machine. Fortunately you can specify dependencies between your services to tell the docker which components are crucial to run it. Then you can just run service you want to work with and bootstrap will start all the dependencies for you.

If you want, you can provide fixtures for your database which would be loaded automatically, so every developer and tester can work on a fresh environment with all the accounts and data already there. Have you ever got a problem with testing functionality because there were no enough data or no user with proper privileges on your local machine? With this solution using additional fixtures won’t be a problem anymore.

I once worked on a project where we didn’t have such a setup. I was working on a frontend and I was surprised when I found out after a year that the backend developer never setup frontend for the application and never tested their tasks end-to-end. That was mainly because it was hard for them to setup and maintain additional component on their machines. With our new setup the frontend would update and run automatically and you would not have any benefit for not using it.

How to start using it?

We have recently open sourced our bootstrap repository solution, so you can start using it right away. Just go to bootstra-bootstrap repository, clone the repository and you can start working on it.

The whole repository consists of just three files: bootstrap.sh which is our bash tool for running and managing all the dependencies. In modules.txt you can find list of all modules that are needed for the project to run. docker-compose.yml is a standard compose file containing all the information about the modules and provides environmental variables to the processes. To run all the modules simply call the following command:

./bootstrap.sh up

For detailed documentation, head to our repository.

Advantages of bootstrap

Using bootstrap repository have many advantages. For developers it speeds up setup and development process. Also it encourages them to experiment with new technologies as it removes overhead with setting up completely new environment. In one of projects we have python backend communicating with microservices in both php and node.js.

Administrators and devops have ready-to-use recipes how to setup the project. Bootstrap repository is somehow an architecture documentation.

It also enables easy automation of end-to-end tests. You can have separate configuration which inherits from the main one for running automatic and manual tets.

If you have ideas or want to extend our project, issues and pull requests are welcome!