Skip to content

Latest commit

 

History

History
102 lines (68 loc) · 2.41 KB

README.md

File metadata and controls

102 lines (68 loc) · 2.41 KB

stakater-nordmart-review

Spring Boot microservice for product review

Introduction

This project implements review functionality for the products; it provides CRUDS API for reviews.

User scenarios

Review Operations

  • Add: add a product review
  • Delete: delete a product review
  • Get: get all reviews for a given product

Dependencies

It requires following things to be installed:

  • Java: ^8.0.
  • Maven
  • Mongodb

Dummy Data

Some dummy data is loaded into the system which can be found here

Deployment strategy

Local machine

To run the application locally use the command given below:

mvn clean spring-boot:run

Kubernetes/OpenShift

Here is the step by step for local development with Tilt

APIs

  • /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

Configuration

TODO

Test API

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

Alerts & Monitoring

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 Grafana Dashbaord

An Alertmanager rule is setup to send alerts if the total rating <= 2 goes beyond 5

DevSecOps scans

tooling:

  • trivy
  • rhacs
  • stackrox
  • checkov
  • sonar

MongoDB Secret Update Scenario

  • 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