Let’s Azure : Deploy Spring Boot Microservices in Azure
JOINING THE FUZZY WORLD OF MICROSERVICES
When we move on from fuzzy world of RESTful Webservices into the world of microservices, things get even fuzzier. Think this — there is no one accepted definition of a microservice. But some of the identifiable characteristics of microservices are — Suit of small services, autonomous, self-contained, Restful, HTTP(S), independently & automated deployable, centrally managed, and cloud enabled. However, due to its distributed nature, designing microservices has many challenges — apart from challenges in organizing around bounding context and establishing visibility, the other major challenges are configuration management, monitoring, fault tolerance and dynamic scaling.
Microservices can be implemented a multitude of programming languages, frameworks, and tools, Java based Spring Boot is one of the most popular one. Spring Boot makes is easy for developing. The alliance of Spring Boot with Spring Cloud helps mitigate the challenges in designing microservices.
This article we are looking at deploying Spring Boot based microservices in Azure cloud. While there are multiple ways and options for this deployment, we are looking the three most efficient, productive and cost effective deployment approaches — (1) Serverless option (2) VM based option and (3) Kubernates based option.
Serverless Deployment Approach
This is the most efficient, easy to configure and auto managed option of deploying Spring Boot microservices in Azure. As depicted in diagram-1, it uses Azure Spring Cloud service, which is a PaaS service, as main component.
It uses other Azure services like Azure Load Balancer, Spring Cloud Config Server and Spring Cloud Service Registry. Optionally we may add security services like Azure Vault, Azure Security Center, Firewall, API Gateway and DNS services. For monitoring Application Insights and Azure Monitor can be added as well. The automated deployment can be achieved either using Azure DevOps Pipeline or through GitHub Actions with Jenkins.
VM Based Deployment Approach
While Azure Spring Cloud service based approach is the best in most fronts, when there is a principle of not using PaaS service, we can deploy Spring boot services using a number of VMs as depicted in the diagram-2
Its simple — uses a single virtual machine where dockers are deployed. Each docker carries one microservice. The VM is also configured with kafka for intra-service communication. An Azure Container Registry needs to be used for service discover here. The automated deployment can be achieved either using Azure DevOps Pipeline or through GitHub Actions with Jenkins.
Kubernates Based Deployment Approach
I am defining this approach as an scaled extension of the VM based approach. In VM based approach described above all the microservices are deployed in a single VM. However when the need is to deploy them is a distributed manner or in a cluster of VMs, we need to introduce Azure Kubernates Service here which along with Azure Container Registry helps in management and governance of these microservices.
The footnote here is, while these three approaches of deployment I found are easy and efficient, there could be various flavors of these approaches as well depending on need and cost. Do comment with the approaches that you have used or you think best suits your use cases.
Isn’t it interesting. If you like this and wanna read more on Azure, follow Let’s Azure and also click here to Follow this author.
If this story is helpful for you forward to your friends and if you have suggestions, do let us know your thoughts in comments.
Happy Azuring and Happy Coding !!!!