Seven deployment strategies for Service Fabric

I've finished two hackfests with our partners as a DevOps evangelist. During the hackfest, I find some typical patterns that they want to know. I'd like to share these. I hope you like this.

1. Simple Deployment Pipeline

People want to know the typical CI/CD pipeline for Service Fabric. When you try Service Fabric,
I strongly recommend VSTS (Visual Studio Team Services). It is the SaaS version of the TFS.

It supports Service Fabric tasks. Since Service Fabric is brand new product, it keeps on developing.
You might not want to catch up these changes. The VSTS help you to catch up these change to supports
through Service Fabric tasks. Also it has template of CI/CD pipeline for Service Fabric. It is deadly
easy.

The Concept of the basic CI / CD pipeline for the Service Fabric is simple. Build and Release.
I recommend to separate a build and release. Generally speaking, you don't want to deploy it every time,
when you commit your code into Git. Build is in charge of Build/Test the artifact. You can create it
using the Service Fabric Template. The artifact that you built is sent to the shared place. We often
call it 'drop' folder. The artifact is uploaded into the folder.

Then, you go Release. Using the artifact, you deploy the artifact using Service Fabric deployment tasks. You can create several releases for the same artifact. You might want to deploy Dev / QA / Staging / Production environment. Or you might have several Live sites. You can create several release depend on your needs.

For the detail, you can refer https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-set-up-continuous-integration Also, you might have a problem of writing a unit test. You can refer

On the step 4. You can create several application instances from your Application Type. Which means
you can create an application instance for one tenant. If you create several applications, it means
multi-tenant. Service Fabric allow you to have several application type version. So you can manage
multi-tenant environment very easily.

In this case, you need to manage database connection by your self. Because you can't change
property files for an instance.

3. OnPremise deployment

If you want to go an OnPremise Service Fabric cluster, you can use VSTS build agent.
You can use it on your OnPremise environment. If you want to deploy a Service Fabric application into yor
cluster, the client should be reachable to the cluster endpoint. Then you can use the same strategy as the
simple deployment pipeline.

Also, if you want to know how to upgrade your Service Fabric cluster. We don't have any grace shout down for
whole cluster. However, you can upgrade cluster node one by one. You can use this power shell for this reason.
Then you can achieve zero-downtime upgrade.

4. Provisioning the Secure Service Fabric cluster

You can use several measure to deploy a Service Fabric cluster. I recommend to go Azure portal.
Wait! Do I foreget about Infrastructure as Code? No worries. You can generate ARM template before
you deploying it. The cluster is managed. It is automatically upgraded by default.

You just save it. The next time, you can provision it using PowerShell or Azure CLI.

However, currently, If you want a secure Service Fabric cluster, you need to deploye Resource Group and KeyVault
first. Also, you need to store certificate on it. It is annoying process. So I wrote a powershell that you can
easily understand what it looks like.

7. Feature Flags

You might want to do a continuous deployment to the environment, I recommend the Feature Flags. I recommend to use Launch Darkly. It is integrated with VSTS. You can also use it for A/B testing, beta testing and Canary testing.
You might also try Trunk Based Development. It will accelerate your lead time.

Conclusion

The Service Fabric is brand new product. However, you can pick several strategy for deployment. The Service Fabric
already implement Fault Injection via PowerShell Command let and Rolling Update feature. You can easily to deploy
your Microservices. I hope you enjoy this technology.