Spring Boot microservice for product review
This project implements review functionality for the products; it provides CRUDS API for reviews.
- Add: add a product review
- Delete: delete a product review
- Get: get all reviews for a given product
It requires following things to be installed:
- Java: ^8.0.
- Maven
- Mongodb
Some dummy data is loaded into the system which can be found here
To run the application locally use the command given below:
mvn clean spring-boot:run
Here is the step by step for local development with Tilt
/api/review/{productId}
- Get a review for the given product id
/api/review/{productId}/{customerName}/{rating}/{text}
- Add a review for the given product id
/api/review/{reviewId}
- Delete a review for the given product id
TODO
Get Review
curl localhost:8080/api/review/329199
Add a Review with Username: bumblebee, ProductId: 329199, Review Rating: 5 and Comment: great
curl -X POST 'localhost:8080/api/review/329199/bumblebee/5/great'
Delete a Review with reviewId: 6277b5c05c21830faf89a3bf
curl -X DELETE localhost:8080/api/review/6277b5c05c21830faf89a3bf
A grafana dashboard is setup to display the number of reviews overtime. The trend can be viewed by adding more reviews using the add API
An Alertmanager rule is setup to send alerts if the total rating <= 2 goes beyond 5
tooling:
- trivy
- rhacs
- stackrox
- checkov
- sonar
- The secret is fetched from vault via external secret
- To simulate password update; first update the mongodb password via terminal
mongo admin --username root --password CURRENT_PASSWORD
db = db.getSiblingDB('admin')
db.changeUserPassword("root", "NEW_PASSWORD")
- Then go to vault and update the password
- External secret will fetch the new secret
- And then reloader will restart the application