Microservices based End to End Dockerized Application to Connected Vehicles.
Realtime backend solution is developed using Nodejs technology with its most popular framework i-e ExpressJs. API Gateway aggregation Pattern is used this kind of requirement. Vehicle and web app users connect to the backend using api gateways. RabbitMQ is used for the internal communication between api gateway and the services. API service perform the following major tasks.
- Url Routing
- Validation
- Token based Security Mechanism i-e JWT validation
- Response Aggregation
- Console Logging
- RMQ Management
- Circuit Breaker
- Server based service Discovery
- Service Registry
- Health checks
Other services i-e Customer and Vehicle perform the following operations.
- Database Setup
- Event Logging
- Data Operations
- Response API gateway’s request
- Queue Management
- Register with Server Registry
- RabbitMQ Health Checks
Architectural diagram is shown below.
Proposed Serverless architecture is shown in the following diagram.
This architecture is assumed to be developed using Microsoft techology Stack i-e Azure Cloud. The number of databases and Azure functions [next to Api Gateway] are just pictorial presentation.
An MVC based Angular application is developed for displaying Vehicle and customer information in real time. The records can be filtered. Single Dashboard API is exposed and filter information can be passed as HTTP Query Params. So in this way achieve API orchestration is achieved. Application refresh it self every 15 seconds without disturbing GUI. The application can accessed using this link
The application follows SPA paradigm. Popular Design Patterns like Dependency Injection, Observer, Factory etc are implemented. Nginx is used for reverse proxy.
GUI snapshot is given below.
Sample integration tests for APIs are written and can be found in test directory. These are written in chai framework and is coupled with mocha framework. These tests are dockerised and can be executed using make script or docker compose. The commands are given below;
make test
OR
docker-compose run api-gateway npm test
The tests are automated with Travis CI pipelines.
The appliactions are fully dockerised and common docker attributes are implemented i-e Proper hierarchy, dependencies and automation is fully supported. The entire proecss, build steps are written in docker-compose.yml
Make script is also written on the top of docker-compose.yml
to build and run appliaction. Some of the command are given below.
- To run the application use
make run
- To build application use
make build
- For running fresh instances of microservices and frontend app use
make reuild
- For integration test use
make test
Other useful commands are written in Makefile
The projects are completely dockerised and automation can be achieved very easily. These settings can be reflected by setting variable environment variable i-e NODE_ENV {dev/prod}
in Dockerfile.
Github and Travis are integrated are CI automation. Static code analysis is carried out once commit is made on master repo.
The multi stage tarvis script is developed. The travis job cycle is composed in travis.yml
file
The project can also be built with out Docker by customly install dependencies. This can be achieved using the following steps.
- Install NodeJs and runtime build dependencies like npm and angular.
MacOs users can use this command
brew install node
and Linux users can execute this commandsudo apt-get install node
- After successfull installation execute
sh ./non-docker.sh