Intro

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

Prerequisites:

  • Docker
  • Docker-compose
  • composer

Technologies

  • 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.
  • https://lumen.laravel.com/
  • Laravel -v 6.x : Laravel is a web application framework with expressive, elegant syntax.
  • https://laravel.com/
  • 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.
  • https://www.nginx.com/
  • We will be using php-7.4 alongside with the fpm procces manager.
  • We will be using mysql 8.0 and take advantage of it’s blazing speed.

Setup

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

Microservices Boilerplate — with Lumen + Laravel + Nginx + Mysql → part (1/3)
29.25 GEEK