Skip to content

vinifig/hero-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hero Project

A system to manage heroes

Architecture

Hero backend definition

The image above is a reference to all the services of hero project and his architecture definition.

Architecture Definition

  • Any Guard System should send a authorization request to Users Microservice (see the image) containing a Token and Resource string

  • Each Microservice should use env variables to define Integrations URI. For Example:

BASE_PATH=protocol://doma.in
AUTH_ENDPOINT=/authorization
  • Rest microservices should not use endpoint with plural resource names

    • /users (WRONG)
    • /user (CORRECT)
    • /user/:id (CORRECT)

Modules

Pre-Requisites

Development

  • Docker
  • docker-compose
  • minikube

Production

  • Docker
  • Kubernetes

How to

Create a new laravel microservice

Run the commands above on services folder (project/path/services), it can take a while:

curl -L https://github.com/laravel/laravel/archive/v5.6.12.tar.gz | tar xz
mv laravel-v5.6.12 <microservice-name>
cd <microservice-name>
docker run --rm -v $(pwd):/app composer install

Then create all microservice configuration files based on users microservice files:

  • php.ini
  • app.dockerfile
  • vhost.conf
  • web.dockerfile
  • docker-compose.yml

If you are running on windows, change $(pwd) to "%cd%": docker run --rm -v "%cd%":/app composer install

If you want any other version of laravel see the official releases page: https://github.com/laravel/laravel/releases

Running the project

Before run, verify if your docker environment has authorization to read and write in the disk

With docker-compose installed run the commands above in the root folder:

docker-compose up
docker-compose exec heroes_app composer install
docker-compose exec heroes_app php artisan db:seed --class=HeroesSeeder

docker-compose exec users_app composer install
docker-compose exec users_app php artisan migrate

Remember to copy all .env.example files into .env for each service folder on project.

To see the hero-app open your browser on 0.0.0.0:8082 (localhost:8082).

ToDo

  • Verify, update and build all the projects docs
  • Finalize api_management
  • Create a swagger api docs
  • Add authentication and guards in angular hero-app
  • Create the CDN with RabbitMQ for images upload communication
  • Integrate Heroes and CDN Microsservices with RabbitMQ
  • Include on hero-component a image for the hero