- Part 1 - Getting it running
- Part 2 - WebAPI-based stateless service
- Part 3 - Stateful services
- Part 4 - Actors
- Part 5 - Running a cluster in the cloud (coming)
- Part 6 - Continuous delivery using TeamCity (coming)
I've been meaning to write about Azure Service Fabric for a while. In my opinion it is one of the most exciting things that has happened on Azure so far. It promises a radical new way to build and deliver applications on Azure.
This is the first part of a blog series where I will be building an example application designed to take advantage of Azure Service Fabric.
What is Azure Service Fabric
If you aren't already familiar with Service Fabric I highly recommend checking out the official Azure documentation articles to get you started.
Azure Service Fabric is a Platform-as-a-Service offering still in preview, which promises us a way to build highly reliable, massively scalable cloud based services.
Microsoft is already using Service Fabric internally to power Azure offerings like SQL Database, DocumentDB and EventHubs, which should give you a sense of what the technology is capable of.
Service Fabric comes in different flavours catering to different requirements. There are two APIs available to us, Reliable Actors and Reliable Services, and the services we build can be either stateful or stateless.
During the course of this blog series we will be taking multiple approaches to development using Service Fabric, using both the Reliable Actors and the Reliable Service APIs to build different parts of our application.
Let me start by introducing the application we will be working on. We will be using Azure Service Fabric to write a cloud based application for an imaginary startup called Sheepishly.
Sheepishly is a very exciting new IoT startup in the sheep tracking industry. They provide GPS tracking of sheep, helping farmers keep track of their herd from the comfort of their own living rooms.
The product works by equipping each sheep with a GPS tracking device (called a "bleater") that periodically sends its location to a cloud application. We will build that cloud application using Azure Service Fabric.
Setting up Azure Service Fabric locally
Before we can start coding we need to get Service Fabric running on our development machines. A nice thing about Service Fabric is that we can install and run the actual runtime on our own machines.
We are going to start by setting up our local cluster, which will be the same as the environment that will ultimately run our application in Azure.
Visual Studio 2015 is required to install the SDK, so make sure you have that installed before you start.
Install the SDK
First, head over to the Azure website and follow the instructions to install the SDK. Basically what we need to do is this.
- Download and run the installer
- Open a Powershell window as an administrator
- Run command to allow script execution
Command to set execution policy to allow execution of Service Fabric scripts.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser
Create a cluster
With the SDK installed we can create a local Service Fabric cluster by running the following Powershell command (still running Powershell as an administrator).
& "$ENV:ProgramFiles\Microsoft SDKs\Service Fabric\ClusterSetup\DevClusterSetup.ps1"
For further details visit the Azure documentation and follow the instructions.
The cluster explorer
With a cluster ready we can check out the cluster explorer. You can navigate directly to it at http://localhost:19080/Explorer, or go ahead and launch it using the Service Fabric tray application.
The cluster explorer gives you an overview of the health and state of your cluster, and the applications running inside it.
We will taking a closer look at the cluster explorer as we start writing our application. For now we have everything set up and are ready to start working on our application.
In the next part of the series we will start using stateless services to build the API endpoint that will receive our sheep tracking data.