In this article, I will provide a step-by-step demonstration of the process of dockerizing your micro-services project with Lumen
and Laravel
alongside with nginx
as a web server and mysql
. This is the first part of a three article series.
This initial part will allow us to setup the foundation of our project, dockerize its main components and to establish the basics in order to make a fluid communication between all components.
Below is the Github repository related to this project:
https://github.com/shsma/microservices-workspace
Docker
Docker-compose
composer
Lumen -v 6.x
: It is the perfect solution for building Laravel
based micro-services and blazing fast APIs. It is one of the fastest micro-frameworks available.Laravel -v 6.x
: Laravel is a web application framework with expressive, elegant syntax.Nginx:
It is a web-server that accelerates content and application delivery, improves security, facilitates availability and scalability for the busiest web sites on the Internet.php-7.4
alongside with the fpm
procces manager.mysql 8.0
and take advantage of it’s blazing speed.Create the microservices-workspace
folder:
->$ mkdir microservices-workspace && cd microservices-workspace
->$ mkdir apps
Now inside our workspace we create the docker
folder and our two components curator
and dipenser
folders inside the apps
folder.
Curator
is the Laravel app that will contain the views and the core logic, alongside with the migrations and the models.Dispenser
is the Lumen app that will behave as the microservice that will dispense/answer the calls coming from the curator
.->$ composer create-project --prefer-dist laravel/laravel apps/curator
->$ omposer create-project --prefer-dist laravel/lumen apps/dispenser
We will create a docker folder that we will take care of later:
->$ mkdir docker
Finally, we need to create a docker-compose
file at the root of our project:
->$ touch docker-compose.yml
#nginx #laravel #mysql #microservices #lumen