Database operations
In the previous chapters, we explained that you can have single or multiple databases for your application. This is one of the advantages of microservices; you can scale a single microservice when you realize that it is getting a big load by dividing the database into a single database for a specific microservice.
For our example, we will create a single database for the secrets microservice. For storage software, we decided to use Percona (a MySQL fork), but feel free to use any database you like.
To create a database container in Docker is very easy. We only need to edit our docker-compose.yml
file, and change the links section of the microservice_secret_fpm
service with the following:
links: - autodiscovery - microservice_secret_database
In the changes we did, we are telling Docker that now our microservice_secret_fpm
can communicate with our microservice_secret_database
container. Let’s create our database container. To do this, we only need...