Getting Started

Currently, if you are interested in deploying Service Fabric on standalone linux clusters, you'll need to create your own instance, install all of the packages and dependencies, configure the cluster appropriately via the xml spec, and run a few scripts. After all that, you'll have a standalone cluster running on one physical instance. If you are interested in checking out the manual process or want to set up a small footprint development environment, the full instructions can be found here at docs.microsoft.com.

While having a small footprint linux development environment is all well and good, according to the documentation here, production level standalone linux clusters are not officially supported by Microsoft and their setup and configuration can be a complex process. This is where we can introduce BOSH to solve the setup problem and a few others that arise in the maintenance and monitoring of long running clusters that are the subject of future posts.

Deployment Preparation

If you do not currently have a running BOSH director, take a look at the above video tutorial, or walk through one of the guides on bosh.io for setting up the CLI and directors on AWS, Azure, GCP, vSphere, and more

The Service Fabric bosh-release requires the use of the newer Xenial (Ubuntu 18.04) stemcells. Other stemcells are currently not supported but may be considered in future releases. To upload a stemcell, target and authenticate with your BOSH environment and upload a Xenial stemcell which are available on bosh.io. An example for vSphere is shown below.

bosh -e <alias> upload-stemcell https://bosh.io/d/stemcells/bosh-vsphere-esxi-ubuntu-xenial-go_agent?v=97.16

After uploading your stemcell, you'll have to set up your networking and instance configurations in the cloud-config. The default manifest provided in the repo references the service-fabric network and vm_type. You can either add the corresponding sections to your cloud-config or edit the manifest to use existing network and vm_type definitions. Example cloud-config snippets for vSphere are provided below.

networks:
- name: service-fabric
  subnets:
  - azs: [z1,z2,z3]
    cloud_properties:
      name: Lab-Net
    dns: [8.8.8.8,8.8.4.4]
    gateway: 172.16.1.1
    range: 172.16.0.0/17
    reserved: [172.16.0.0-172.16.0.10]
  type: manual

vm_types:
- name: service-fabric
  cloud_properties:
    cpu: 2
    disk: 51200
    ram: 8192

For more information on the specific cloud_properties you'll need to reference for your IaaS of choice, visit the cloud-config documentation
here under the Cloud Providers section for AWS, Azure, GCP, vSphere, and more. If you're creating a cloud-config from scratch, be sure to look at the Example Cloud Config to base yours off of and ensure you have all of the required sections.

Deployment

Once you have a running director with xenial stemcells and a cloud-config, you're ready to deploy a Service Fabric cluster. The first thing you'll need is to clone the repo for the bosh-release.

git clone https://github.com/starkandwayne/service-fabric-boshrelease.git

After cloning the repo, deployment of the default manifest can be done with one simple command.

cd <repo-folder>
bosh -e <alias> -d service-fabric deploy manifests/service-fabric.yml

After running the deployment, you should see something similar to the task log below with VMs being created and then updated to run Service Fabric. This process takes usually between 20-30min for the base five node cluster, and 4-6min for each additional VM if you scale the instance group.

Using environment 'https://10.200.202.0:25555' as user 'admin' (openid, bosh.admin)

Task 2

Task 2 | 18:49:18 | Preparing deployment: Preparing deployment (00:00:15)
Task 2 | 18:49:35 | Preparing package compilation: Finding packages to compile (00:00:00)
Task 2 | 18:49:39 | Creating missing vms: service-fabric/041a5eaa-1576-496f-a6e7-fd967c5f0b82 (2)
Task 2 | 18:49:39 | Creating missing vms: service-fabric/431ed308-4ddb-4f71-b33d-6a1fcbbaadfb (1)
Task 2 | 18:49:39 | Creating missing vms: service-fabric/65f2a1bf-46df-4b24-ada9-e950f4a9f39b (3)
Task 2 | 18:49:39 | Creating missing vms: service-fabric/7939f734-b4ab-46eb-ae32-6d35c8a4464e (4)
Task 2 | 18:49:39 | Creating missing vms: service-fabric/af2084f7-b222-415d-8518-9aa5f3000262 (0)
Task 2 | 18:53:19 | Creating missing vms: service-fabric/431ed308-4ddb-4f71-b33d-6a1fcbbaadfb (1) (00:01:40)
Task 2 | 18:53:21 | Creating missing vms: service-fabric/7939f734-b4ab-46eb-ae32-6d35c8a4464e (4) (00:01:42)
Task 2 | 18:53:22 | Creating missing vms: service-fabric/af2084f7-b222-415d-8518-9aa5f3000262 (0) (00:01:43)
Task 2 | 18:53:22 | Creating missing vms: service-fabric/65f2a1bf-46df-4b24-ada9-e950f4a9f39b (3) (00:01:43)
Task 2 | 18:53:25 | Creating missing vms: service-fabric/041a5eaa-1576-496f-a6e7-fd967c5f0b82 (2) (00:01:46)
Task 2 | 18:53:29 | Updating instance service-fabric: service-fabric/af2084f7-b222-415d-8518-9aa5f3000262 (0) (canary) (00:04:18)
Task 2 | 19:05:47 | Updating instance service-fabric: service-fabric/041a5eaa-1576-496f-a6e7-fd967c5f0b82 (2) (canary) (00:04:00)
Task 2 | 19:14:47 | Updating instance service-fabric: service-fabric/431ed308-4ddb-4f71-b33d-6a1fcbbaadfb (1) (canary) (00:04:12)
Task 2 | 19:23:59 | Updating instance service-fabric: service-fabric/65f2a1bf-46df-4b24-ada9-e950f4a9f39b (3) (canary) (00:04:00)
Task 2 | 19:32:59 | Updating instance service-fabric: service-fabric/7939f734-b4ab-46eb-ae32-6d35c8a4464e (4) (canary) (00:03:57)

Task 2 Started  Thu Nov  1 18:49:18 UTC 2018
Task 2 Finished Thu Nov  1 19:11:31 UTC 2018
Task 2 Duration 00:22:13
Task 2 done

Succeeded

Now that your cluster has successfully deployed, we can look up one of the VM IP addresses and check out the cluster web interface. To do this we can use the following command.

bosh -e <alias> -d service-fabric vms
Using environment 'https://10.200.202.0:25555' as user 'admin' (openid, bosh.admin)

Task 3. Done

Deployment 'service-fabric'

Instance                                             Process State  AZ  IPs             VM CID                                   VM Type         Active
service-fabric/41fceda7-b949-4cfe-ba82-390b6f2a431c  running        z2  10.200.202.133  vm-d3cd1c94-fd2a-473a-83df-fe6d467f7a60  service-fabric  -
service-fabric/57413822-f11a-4dc1-bb83-bd2a2ca16f65  running        z2  10.200.202.134  vm-4e5932f7-7884-47c8-904a-a496eb74ec72  service-fabric  -
service-fabric/70cc72f0-6aeb-4c3a-9d9f-e467948f7c29  running        z1  10.200.202.132  vm-a532f63c-12f7-4545-995d-0abf5bdfb7ff  service-fabric  -
service-fabric/91b19a9c-4185-4b91-83ec-a9c79f8d6804  running        z1  10.200.202.131  vm-1632b547-5c66-4a06-9d13-51e86674a0c9  service-fabric  -
service-fabric/a1da1336-8487-4c5b-9c73-c78ac0ab8586  running        z3  10.200.202.135  vm-5ad50cd8-62a2-44ae-90d1-babb22fa95c7  service-fabric  -

Once you have one of the node IPs, we can open a browser and navigate to http://<node-ip>:19080 and you should see the following interface.

ServiceFabric Interface

Now that we have a cluster running, we should validate that it is deployed correctly and is ready to accept application deployments for several different languages. To do this we can run the smoke-test errand via BOSH, which will test pushing several applications and testing to ensure they come up and run in a healthy state. This process takes roughly 10 minutes and should look like the following if all is well. If there is an error, BOSH will give verbose logs and you can diagnose environmental issues causing apps to fail (i.e. deploying in an air-gapped environment and trying to deploy a containerized app from DockerHub)

bosh -e <alias> -d service-fabric run-errand smoke-test
Using environment 'https://10.200.202.0:25555' as user 'admin' (openid, bosh.admin)

Task 4

Task 4 | 19:21:19 | Preparing deployment: Preparing deployment
Task 4 | 19:21:30 | Warning: Ambiguous request: the requested errand name 'smoke-test' matches both a job name and an errand instance group name. Executing errand on all relevant instances with job 'smoke-test'.
Task 4 | 19:21:31 | Preparing package compilation: Finding packages to compile (00:00:00)
Task 4 | 19:21:31 | Preparing deployment: Preparing deployment (00:00:12)
Task 4 | 19:21:31 | Creating missing vms: smoke-test/1015ea4d-a7ba-4080-a364-635390531a3b (0) (00:02:51)
Task 4 | 19:24:22 | Updating instance smoke-test: smoke-test/1015ea4d-a7ba-4080-a364-635390531a3b (0) (canary) (00:01:05)
Task 4 | 19:25:28 | Running errand: smoke-test/1015ea4d-a7ba-4080-a364-635390531a3b (0) (00:08:36)
Task 4 | 19:34:04 | Fetching logs for smoke-test/1015ea4d-a7ba-4080-a364-635390531a3b (0): Finding and packing log files (00:00:01)

Task 4 Started  Thu Nov  8 19:21:19 UTC 2018
Task 4 Finished Thu Nov  8 19:34:05 UTC 2018
Task 4 Duration 00:12:46
Task 4 done

Succeeded

At this point, you should have a Service Fabric cluster ready for application deployments. For information on setting up the Service Fabric CLI, as well as building and deploying applications for Service Fabric, check out the Quickstarts and Tutorials on microsoft.com.