Skip to content

naeemark/fino-cars-service

Repository files navigation

Fino Cars Service

Publish Docker Image Develop Branch Coverage Quality Gate Status Docker

Demonstration of Requirements understanding, proposing a solution and implementation by using the latest tools and techniques.



Distribution


What is this repository for?

  • This app is built as assignment for FinologyGroup.
  • Adds different libs to enhance the application quality and performance.
  • Using SWAGGER.IO for documentation and as a working REST-API client
  • CI/CD Demonstration using Github Actions
  • Docker containers are used for Build Deployment
  • The live environment is established on an EC2 instance to run dockerized build
  • Version 1.0.0

Problem Statement

Problem Statement


Proposed Solution:

  • For the implementation of REST API, I would prefer to use a Spring Boot application for the implementation of required functionality.
  • Postgres Database will be used for Persistence.
  • For testing, I would prefer to use JUnit and Mockito
  • There will be a Dockrized Build distribution
  • Some opensource database can be used for mocking purposes.
  • As we are mocking an inventory system, there should be a search mechanism available.
  • There shouldn't be a possibility to modify the database via JPA
  • For demonstration purpose, an API frontend should be provided...i.e Swagger

Entities

  • I am assuming that there will be only one table in the database which will contain the data (for the sake of simplicity)

Assumptions

  • The system is for abstraction and demo purpose, so;
    • No auth system is integrated
    • No integration testing is being done in pipelines
    • The code quality checks are place and coverage report is synced in SonarQube
  • The is no locking system is implemented on database.

Deliverable Content

  • GET {baseURL}/api/cars - Retrives total cars available as a single list (Raw implementation)
  • GET {baseURL}/api/cars/page?number=1&size=10 - Paginated variation of the listing API
  • GET {baseURL}/api/cars/search?id=10 - this will provide a flexibility to search in the database based on different parameters i.e data-details
  • GET {baseURL}/api/health - Checks the health of the system,

Development Cycle

How do I get set up

<< Docker Compose >>

To run the project locally using docker;

  • docker compose up --detach --wait

To tear down:

  • docker compose down --remove-orphans

Developer set up

To setup the project locally you need to clone this repo, from main branch or some latest TAG

Configuration

  • Please sync and resolve the maven dependencies
  • Run mvn clean install
  • To run tests mvn clean test
Build Docker Image
  • docker build -t fino-cars-service .

Run Docker Image
Run Docker Image From Docker hub
Stop Docker Container
  • Run docker kill {container-id}

Pre-reqs

  • JDK 1.8
  • Spring Boot
  • Docker
  • PostgreSQL
  • Junit
  • Mockito
  • Swagger
  • IntelliJ IDEA

Tools Included

  • Jacoco
  • Sonar
  • Swagger
  • JPA
  • Hibernate
  • Github Actions
  • EC2 Instance for deployment

Auth

  • No auth system is included in this solution

External Tools:


Deployment

  • When a pull request is merged in master, Github Action starts and following steps are done by automated CI/CD:
    • Creates Environment and Runs all tests
    • Complete a SonarQube analysis and pushes the results to Live Project
    • Makes a deployment to Github packages (Mock)
    • Creates the Docker Image and pushes to Docker Repository

As a next step, it is deployed manually in an ec2 instance.

Contribution guidelines

  • Forks are always appreciated

Data Details

Available Search Params:

type: [Micro, Car, Sports, 4 WD, Electrical, Vintage, Coupe, Antique, Hybrid, Crossover, Convertible, Diesel, Classic, Minivan, Wagon, Supercar, MPV, Mini, 2 WD]

year: [2009, 2010, 2011, 2012]

make: [Chrysler, Toyota, BMW Motorrad, GMC, Mercedes-AMG, Maybach, Lincoln, Honda, Grand Cherokee, Ford, Scion, Maserati, Dodge, Chevrolet, Infiniti, MINI, Bentley, Porsche, Audi, Mercedes, Rolls-Royce, Jaguar, Lexus, Lotus, Kia, Lamborghini, Mercedes-Benz, Land Rover, Jeep, Volvo, Buick, Cadillac, Acura, Nissan, Saab, Hyundai, Suzuki, Mitsubishi, Aston Martin, Subaru, Mazda, BMW, Volkswagen, Mercury]