What is it?
"Microservices", a trending buzz word nowadays. What problems does it solve?
Many organizations nowadays are driving the technology migrations and one of the biggest challenges is to migrate from monolithic application to micro-services based application.
This mircoservices-sample project demonstrates how multiple services run independently leveraging on the best microservices patterns to enable scale, performance and resilience.
Use case
The sample application has three services namely service-one, service-two and service-three. Each of the service has its own database service-one-db, service-two-db and service-three-db respectively. During the startup of the services, it persists the service name and an auto generated UUID in its perspective database and sends the data to the RabbitMQ exchange which then broadcasts the data to all the queues based on the routing key. Every microservices listens to its own RabbitMQ queue and keeps updating the database as and when it receives the data.
Below are the screens of the application.
Click on one of the tab's (one, two or three) the data that you see on the screen is based on the data fetched by the respective service by calling its database.
Notice that the UUID generated for service-one which lies in service-one-db is in sync with service-two and service-three tabs which is achieved by RabbitMQ (asychronous communication between microservices).
Service Registration
During the initialization of a service, it would be registered to the discovery and registration server (which in our example is Hashicorp's Consul).
Service Discovery
When one service (say api-gateway) needs to access a resource from another service (say service-one), all it has to do is ask discovery and registration server (Consul) to give one of the service-one's instance information.
Architecture
Below is the architectural diagram for microservices sample project.
Technology
Microservices sample project uses a number of open source projects to work properly:
- SpringBoot - Application framework
- Zuul - API Gateway (Load Balancer)
- Consul - Service registration and Discovery
- Docker - Containerization platform
- RabbitMQ - asynchronous microservices messaging.
- Logstash - Log collector
- Elasticsearch - Log indexer
- Kibana - Data visualization
- AngularJS - HTML enhanced for web apps!
- Bootstrap - great UI boilerplate for modern web apps
- jQuery - HTML document traversal and manipulation
- Swagger - API documentation
Tools
Development
Below are the steps to bring up the development environment and get started.
- Install Git, Java, Maven and Docker
- For the project using https://github.com/mudigal-technologies/microservices-sample.git
- Clone the fork using https://github.com/{YOUR_GIT_ID}/microservices-sample.git
- Execute "cd /microservices-sample/build/docker/scripts/"
- To deploy docker please run "./deploy.sh docker".
- Access the Application at http://localhost/
Help
Feel free to reach "contact@mudigal.com" incase of any concerns.