Microservices application presented on Hack your career lecture on 06.11.2018.
It manages Beer entity through simple CRUD REST API and provide API to rate chosen beer.
Application exposes following methods (when started through provided docker-compose):
GET http://locahost:8040/catalog/beerwhich returns all the beers from the dbGET http://locahost:8040/catalog/beer/IDwhich returns a beer with requested ID, if such does not exist null is returnedPOST http://locahost:8040/catalog/beerwhich creates new beer and accepts following request body:
{
"id": 1,
"name": "Name",
"description": "Description",
"alcoholContent": 10.0,
"ibu": 10
}PUT http://locahost:8040/catalog/beer/{ID}which modifies beer with the requested ID, note that request body requires you to provide all data.DELETE http://locahost:8040/catalog/beer/{ID}which removes beer with requested ID form dbGET http://locahost:8040/rating/beer/IDwhich returns a overall rating for beer with requested ID, if such does not exist null is returnedPOST http://locahost:8040/rating/beer/IDwhich creates new rating for beer and accepts following request body:
{
"rating":5
}DELETE http://locahost:8040/rating/beer/{ID}which removes all ratings for beer with requested ID
This project require Docker and Docker Compose (which is included in Docker installation in most cases). Description on Docker installation could be found on official docker site - both for macOs and Windows. To run application only docker-compose.yaml file is needed - in directory containing this file use command in terminal
docker-compose up
Be aware that it could take some time to start and after that, first requests could take longer than usual due to lazy initialization of underlying components (Hystrix threadpools, beans etc).
When extending this solution with custom changes docker plugin has to be configured in pom file of every service - it has to point to specific docker hub repository. More info about docker plugin could be found here. With changed images - in different docker repository, docker-compose.yaml file has to be adjusted - every changed image has to be provided in "image:" tab with following manner {YOUR_ACCOUNT_NAME}/{YOUR_REPOSITORY_NAME}