Dockerized Laravel9 Project
Docker Images
php:8.1-fpm
|
mysql:8.0
|
phpmyadmin/phpmyadmin
|
nginx:latest
|
redis:3.0
- Make sure up and running the laravel-microservice-projectB microservice in your machine first. Unless
http://api.microservice-b.test:8084/api/v1/customer/list
this link work in your browser. Use below command to clone laravel-microservice-projectB and follow the instruction of the README.md filegit clone https://github.com/gihandilanka-github/laravel-microservice-projectB.git
- Clone the repo (laravel-microservice-projectA)
git clone https://github.com/gihandilanka-github/laravel-microservice-projectA.git
- Go inside the cloned directory
cd laravel-microservice-projectA
- Configure the
.env
filecp .env.example .env
- Run this command to up docker containers
docker-compose up -d --build
- Run composer install
docker-compose exec app composer install
- Generate APP_KEY in .
env
docker-compose exec app php artisan key:generate
- Add these two records to
/etc/hosts
file127.0.0.1 api.microservice-a.test 127.0.0.1 pma.microservice-a.test
- Open the phpmyadmin in the browser. You can see the
microserviceA
databasehttp://pma.microservice-a.test:8081
- Give these laravel directory permissions
sudo chmod -R 777 storage/logs/ sudo chmod -R 777 storage/framework/
- You can check the following API url, it will return the customers as
json
responsehttp://api.microservice-a.test:8082/api/v1/customer/list
When we call this http://api.microservice-a.test:8082/api/v1/customer/list
endpoint, it is called to the laravel-microservice-projectB
microservice. So you have to setup the laravel-microservice-projectB project first in your machine.