Table of Contents
NinjaTruck aims to be the last mile delivery management solution for delivery drivers. 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.
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.
- From the directory ./IS213-driver-app, open the terminal and enter
docker compose up
- Access http://localhost:1337 in a browser to create an admin user for Konga
Username: admin
Email: <your email address>
Password: adminadmin
- Sign in to continue
- Connect Konga to Kong by creating a new connection
Name: default
Kong Admin URL: http://kong:8001
- Go to Snapshots located on bottom right of the sidebar
- Select IMPORT FROM FILE and import ./tools/kongSnapshot.json
- Click on DETAILS for the new snapshot created which ends with Ninjatruck
- Select RESTORE, tick all of the boxes, and click on IMPORT OBJECTS
- Docker - 20.10.13
- Node - 16.13.0
Ensure you are running the same version by running the packages with --version
in the terminal
- Open folder in vscode and open terminal
- Install required dependencies
$ cd Frontend
$ npm install
- Launch NinjaTruck Application
$ quasar dev
- In browser, tap f12 to open console (as platform is only compatible for mobile)
Driver logs in and views his dashboard
- 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.
- Driver microservice is coded in Java SpringBoot. This is to highlight that the microservices are language agnostic.
- 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
Driver views map of all his parcels for delivery
Driver completes a delivery of a parcel and marks it as either completed or failed
- 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.
- Kafka uses their own custom kafka protocol.
- SMS microservice is built with Node.js. This is to highlight that the microservices are language agnostic.
- To handle exceptions in business logic, Error handling is implemented if delivery has not been fulfilled.
- 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.
- Utilized 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.