Home > Sample chapters

Hello, Service Fabric!

Getting started

To get started with Service Fabric development, you need two things:

  • A development environment

  • A Service Fabric cluster

In this section, first you’ll set up a local development, which includes a local multinode cluster that allows you to deploy and test your applications. Then, you’ll provision a managed Service Fabric cluster on Microsoft Azure. This book primarily focuses on developments using C# in Visual Studio 2015. However, we’ll briefly cover developments using other languages such as Node.js.

Setting up a development environment

To set up a development environment, you’ll need Visual Studio 2015 and Service Fabric SDK. You can install Service Fabric SDK via Microsoft Web Platform Installer (Web PI, https://www.microsoft.com/web/downloads/platform.aspx). Just follow the installation wizard and accept all default options to complete the installation. This book uses the Preview 2.0.135 version.

In addition, install the following tools:

  • Latest version of Microsoft Azure SDK for .NET (using Web PI, this book uses 2.8.1)

  • Latest version of Microsoft Azure PowerShell (using Web PI, this book uses 1.0)

Service Fabric SDK provides a local multinode Service Fabric cluster to which you can deploy and test your applications.

Provisioning a Service Fabric cluster on Azure

Although you can use the local cluster provided by Service Fabric SDK for local development and tests, you’ll want a hosted cluster on Azure for your production deployments.

You can follow these steps to create a new Service Fabric cluster.

To provision a Service Fabric cluster, complete the following steps:

  1. Sign in to Microsoft Azure management portal (https://portal.azure.com).

  2. Click the New icon in the upper-left corner of the home page. Then, click Marketplace, as shown in Figure 1-3.

    FIGURE 1-3

    FIGURE 1-3 Create a new resource on Microsoft Azure

  3. Under the Everything category, type service fabric in the Search box and press Enter. You’ll see a Service Fabric Cluster entry, as shown in Figure 1-4. Click the entry to create a new Service Fabric cluster.

    FIGURE 1-4

    FIGURE 1-4 Service Fabric in Marketplace

  4. On the Service Fabric Cluster blade, click the Create button to continue, as shown in Figure 1-5.

    FIGURE 1-5

    FIGURE 1-5 Service Fabric template blade

  5. On the Basics blade, enter a Cluster Name. Enter the user credentials for VM. Select the Azure Subscription you want to use, and type a name for the new Resource Group. Then, pick an Azure Location where you want the cluster to be hosted, and click OK to continue, as shown in Figure 1-6.

    FIGURE 1-6

    FIGURE 1-6 Service Fabric Cluster creation blade

  6. Click Node Type and create a new node type configuration. (You’ll find more information about types of nodes later in this book.) In the Node Type Configuration blade, enter a name for the node type and pick a virtual machine size. Type 80 for the Custom Endpoints value, and then click OK, as shown in Figure 1-7.

    FIGURE 1-7

    FIGURE 1-7 Service Fabric Cluster settings blade

  7. Change the Security mode to Unsecure, and follow the creation wizard to complete provisioning the cluster.

  8. The provisioning process takes a few minutes. Once that is done, you’ll have a new tile on your dashboard to access the cluster. Figure 1-8 shows the cluster blade, on which you can find the cluster public address (in the format of <cluster name>.<region>.cloudapp.azure.com) and the port number (the default is 19000). You’ll need this information to connect to the cluster later.

    FIGURE 1-8

    FIGURE 1-8 Service Fabric cluster blade