Azure Service Fabric is Microsoft's entry into the world of "MicroServices". While the most popular non-Microsoft way of implementing a MicroService is to utilize "containers" (e.g. Docker), Microsoft seems to have chosen the option of "Virtual Machine Scale Set" to implement the first version.
Since the concepts of MicroServices are not something one can cover in single post and there is so much awesome content available on the Internet, I will try to cover the experience with Azure Service Fabric.
In order to run a Azure Service Fabric application, you need to install the Azure Service Fabric SDK on your machine. Once it is set up, you should start to see the relevant options in "New Project" dialog box.
In Service Fabric world, a microservice can be of one of the following categories:
Azure Service Fabric (ASF) comes with a broad implementation of reliable data structures (reliable queues, reliable dictionaries) which can be utilized when building a Stateful Service. Given that ASF cluster indeed launches and manages the application executable inside its infrastructure, it is entirely possible to host an executable (called "guest executable") in ASF environment.
The fastest way to get ramped up on the different type of ASF applications is to go through the samples provided here.
I downloaded one of the web applications (Link) as I was interested in finding out the infrastructure that would be set up for web applications once we deploy the ASF application to Azure. The solution's help page is quite informative and as expected, it runs fantastically on local machine.
Now, let us try to deploy it on Azure. Deploying an ASF application is quite simple - Just select the ASF application in Visual Studio and say "Publish". A prerequisite to the deployment activity is availability of a Service Fabric Cluster in your Azure Subscription.
While configuring the ASF cluster, you specify the different parameters (including ports that you would be using for different purposes like managing ASF cluster or accessing an HTTP end point that is mapped to the web application hosted in ASF cluster). Once you have deployed the ASF application to the cluster, the resource group looks like following:
Following components are deployed:
- Virtual Machine Scale Set: For managing the virtual machines for resiliency, reliability and scale purpose. Default setting is to create a set of 5 virtual machines.
- Load Balancer: To balance the load of inbound traffic on specific ports.
- Public IP Address: To create a global address for ASF app.
- Virtual Network: a vNet so that each machine in VM scale set has unique internal IP.
- Service Fabric Cluster
- Storage Accounts: To store to logs and VHD image of the VM scale set machines.
You might notice that your web application is not accessible at port 19000 as configured on the ASF cluster. This is because the Web Application's manifest causes the web server to run on port 8505 instead of 19000 (which is configured through ASF cluster configuration).
The fix: correct the LB rule.
Once it is done, the inbound traffic on port 19000 gets rerouted to internal port 8505 on the VM Scale Set machines and application works like charm.