Previously, you had to describe your Service Fabric applications with XML manifests, which was complex and tedious. The new resource-based application uses lightweight YAML files to describe your application and the resources that make it up, making it easier to specify and modify these resources. The tools also help you scaffold applications, debug microservices, and publish your application to Mesh.
Ready to get started? We’ll walk you through how to take advantage of the managed infrastructure and the simplified YAML files for defining your applications.
Get Started with Service Fabric Mesh tools in Visual Studio 2017
After you download the Mesh tools, you’ll notice we’ve added a new entry for Service Fabric Mesh Application in the new project dialog.
You might notice the new Container OS drop-down. Right now, local Service Fabric developer cluster debugging is Windows-only, but Service Fabric Mesh supports both Linux and Windows containers. Before publishing to Azure, you can change your service to use a Linux-based image by changing the “osType” property in the service.yaml file.
Service Fabric ASP.NET Core applications have two projects in the solution. The service.yaml file that is included in your main service project describes your service to the Service Fabric runtime. This file contains any endpoints your service will be listening on, environment variables, and other properties, including any resource constraints you want enforced. There’s also a Dockerfile with instructions for the Docker image that gets built for your service when it’s running in Service Fabric. The tools configure the Dockerfile to work with the service you select. Usually you won’t need to worry about this file, but you are free to modify it if you want to use a different base image or include additional dependencies.
The second project in this example, HotelApp, is a lightweight project for configuring application-wide settings. By default, the app.yaml and network.yaml files contain basic configuration information. During debugging and publishing, Visual Studio will use the Service Fabric SDK to merge the various YAML files and deploy them, along with your service(s), to Service Fabric.
Publishing and Debugging your Service Fabric Mesh Application
You can set breakpoints and debug your code just like any other .NET Core application. When it’s time to publish your application to Azure Service Fabric Mesh, right click the application project and select Publish. This brings up the following dialog where you’ll need to specify a few values to successfully publish your application.
Publishing from Visual Studio builds the exe/dll for each service, creates Docker images for the services, pushes them to Azure Container Registry, and deploys the application to Mesh. Once publish is complete, Visual Studio will show you each of the ingress endpoint URLs for each of your services that had one defined.
You can get more information about these steps by following our Service Fabric Mesh Quickstart.
Share Your Thoughts
When you try the new Service Fabric Mesh tooling, we’d love to hear your feedback! Leave a message for us through Visual Studio or add a comment to this blog post. You can get started setting up your development machine here.
|Cristy Gonzalez, Program Manager, Azure Developer Experiences
Cristy has been a PM at Microsoft since 2013. In that time, she has worked on the Azure SDK, Storage Explorer, Azure Diagnostics, and Azure developer services like DevTest Labs and ACR. She’s currently working on experiences for users getting started with Azure.