What is Ninjatruck?

NinjaTruck helps delivery drivers manage deliveries better. The application covers the most essential features a delivery driver will need when carrying out their day to day responsibilities of delivering a parcel to customers.

The application uses a suite of smart technologies to enable drivers. Drivers can view and track all parcels that they must deliver, and also utilise AR technologies to help guide them while they are en route to their destination. On delivery, drivers will be able to digitally mark the items as delivered, and the system updates itself automatically.

SOA

Technical Diagrams

Solution Architecture

The application was designed to account for scalability and reliability via a microservice architecture. It was designed to be split up into the different service layers.

Logo

Services Overview

This shows an overview of our API implementations, and also how the services intereact with one another.

technicals

(back to top)

Getting Started

You can get started here to set up the application if you want to!

Configuring Backend

Make sure you have a clean environment with no other containers as it can possibly conflict with this project’s ports mapping, image or container naming/labeling. Make sure that the Kong container and image is also deleted along with its network to set up a new kong configuration.

  1. From the directory ./IS213-driver-app, open the terminal and enter docker compose up
  2. Access http://localhost:1337 in a browser to create an admin user for Konga
Username: admin
Email:    <your email address>
Password: adminadmin
  1. Sign in to continue
  2. Connect Konga to Kong by creating a new connection
Name: default
Kong Admin URL: http://kong:8001
  1. Go to Snapshots located on bottom right of the sidebar
  2. Select IMPORT FROM FILE and import ./tools/kongSnapshot.json
  3. Click on DETAILS for the new snapshot created which ends with Ninjatruck
  4. Select RESTORE, tick all of the boxes, and click on IMPORT OBJECTS

(back to top)

Prerequisites

  • Docker - 20.10.13
  • Node - 16.13.0

Ensure you are running the same version by running the packages with --version in the terminal

(back to top)

Usage

  1. Open folder in vscode and open terminal
  2. Install required dependencies
$ cd Frontend
$ npm install
  1. Launch NinjaTruck Application
$ quasar dev
  1. In browser, tap f12 to open console (as platform is only compatible for mobile)

(back to top)

Scenario 1

Driver logs in and views his dashboard

Logo



Logo

Additional Points

  1. KONG is used as our API Gateway mainly for security implementation. Kong keeps the internal microservices from being directly exposed to external clients. 3 Plugins was also used to configure Kong:
  • Kong’s Bot detection and rate limiting was used to prevent any bot attacks, DoS attack, and limit login attempts in case an attacker tries to brute force through the login.
  • Key-auth plugin was also used to add another layer of security by allowing only users with an api key belonging to Driver type consumer to access the microservices through kong.
  1. Driver microservice is coded in Java SpringBoot. This is to highlight that the microservices are language agnostic.
  2. To handle exceptions in business logic, Error handling is implemented if username or password is incorrect when logging in. User will be notified of the incorrect username or password

(back to top)

Scenario 2

Driver views map of all his parcels for delivery

Logo


Logo

(back to top)

Scenario 3

Driver completes a delivery of a parcel and marks it as either completed or failed

Logo


Logo

Additional Points

  1. Used Kafka as our message broker between Update Parcel Status and SMS microservice. Kafka is designed for holding and distributing large volumes of messages. Considering how there are hundreds of thousands of parcels delivered daily, kafka would be a good choice to handle the large amount of messages.
  2. Kafka uses their own custom kafka protocol.
  3. SMS microservice is built with Node.js. This is to highlight that the microservices are language agnostic.
  4. To handle exceptions in business logic, Error handling is implemented if delivery has not been fulfilled.

(back to top)

Container Orchestration

  • Each of the services in the red box represents a kubernetes pod containing our services.
  • Our Kong gateway acts as an entry point between the clients and our pods. With kubernetes, there is now the capability to scale our services easily.
  • With the use of either vertical or horizontal Pod Autoscaler, and their auto load-balancer, scaling through kubernetes is made much easier compared to load balancing and scaling in a pure docker environment.
Logo

(back to top)

Kubernetes Deployment

We explored the use of Kubernetes for container management, in case users want to have extreme scale over the application.

First, we used Tanzu Community edition to provision and set up our aws infrastructure, and deploy our Kubernetes management cluster onto an ec2 instance, which would contain our downloaded packages and tooling.

From there, we created our workload cluster to run in another ec2 instance which would contain our application. To monitor our workload cluster, we use octant which helps to display the lifecycle of our pods in the cluster and the logs.

Logo


Logo

(back to top)

Built With

The following technologies were used to build this application.

Frontend

API Gateway

Backend

Message Brokers

DevOps

Deployment

External APIs used

(back to top)

Acknowledgments

Thanks to the following few folks who helped to build this project:

(back to top)