Fluent Bytes

"The only source of knowledge is experience" - Albert Einstein-

Category: TFS

Just released: Introduction to Docker on Windows with Visual Studio 2017

In this new course, I teach you how to use Docker to deliver solutions to the Windows platform. First, you’ll explore the options and capabilities Docker offers on the Windows platform. Next, you’ll delve into how Visual Studio 2017 simplifies the use of Docker in the development cycle. Finally, you’ll learn how to implement a delivery pipeline with Visual Studio Team Services (VSTST) or TFS to deploy to any of the target platforms, ranging from single windows server to a cluster of machines managed by cluster managers like Kubernetes or Service Fabric. By the end of this course, you’ll be able to explain how containers work on windows, how to build Docker containers to run new or existing workloads, and how to deploy your applications to different container hosting solutions on premise or in the cloud.

Here is a brief video introduction that gives you an idea of the course.

Here is the outline of the course:

Module 1: Introduction to Docker on Windows with Visual Studio 2017

  • Running Containers and Docker
  • What Is a Container?
  • Containers vs. Virtual Machines
  • Containers vs. Docker
  • Docker Command-line
  • Difference Between an Image and a Container
  • Inspecting Images and Layers
  • Running on Windows
  • Development Tools
  • Docker Compose
  • Docker Commands Needed to Understand Visual Studio
  • Which .Net Framework to Choose?
  • Container Clusters

Module 2: Docker and Visual Studio

  • Using the Docker Tools in Visual Studio 2017
  • Docker Files Added
  • The Docker file Debug/Release Trick
  • Yaml Files Added
  • The Yaml File Trick
  • Volume Maps on the Containers
  • Use the Visual Studio 2017 IDE to Build Containers
  • Debugging Your Cross-container Solutions with Visual Studio 2017

Module 3: Handling Data in Containers & Testing

  • Handling Data in Containers
  • Setting up Volume Mappings to Manage State
  • Using the Volume Mapping Commands
  • Running SQL Server in a Container
  • Creating and Running SQL Server Images
  • Leveraging Immutability for Testing
  • Integration Test Using a SQL Container That Resets After the Tests

Module 4: Docker and Your Continuous Delivery Pipeline in VSTS

  • Understanding Containerized Builds
  • Running a Build in VSTS
  • Setting up the Build
  • Configuring Build Agents to Build Containers
  • Setup a Custom Build Agent
  • Setup a VSTS Build for Your Containers
  • Understanding Tags
  • Deploying Your Containers Using the Release Pipeline
  • Deploy Your Containers to a Container Host
  • Pushing Images to Azure Container Registry or Dockerhub
  • Create and Use an Azure Container Registry

Module 5: Deploying to Azure Container Services (ACS)

  • Why Do You Need Clusters?
  • Understanding Azure ACS
  • Create an ACS Cluster Running Kubernetes
  • Deploying Your App to the Cluster by Hand
  • Kubernetes Cluster Anatomy
  • Deploy Containers to Kubernetes Cluster by Hand
  • Deploying Your App to the Cluster Using VSTS
  • Zero Downtime Deployment Using VSTS and ACS with Kubernetes
  • Scaling Your Apps and the Cluster
  • Alternative Cluster Solutions

Module 6: Deploying to Azure Service Fabric

  • Understanding Azure Service Fabric
  • Same Rules Apply as to ACS
  • Create a Service Fabric Cluster
  • Deploy Containers to Service Fabric by Hand
  • Deploy Containers to Service Fabric with VSTS

You can find the course here at the PluralSight website: https://app.pluralsight.com/library/courses/docker-visual-studio-2017-windows

Not yet a PluralSight subscriber? No worries, you can still watch the course for free with a trial subscription.

Hope it helps to get you up to speed with Docker on Windows!

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant

Using docker on Windows in VSTS build and release management

In my previous post I showed you how you can create a docker container image that has an ASP.NET 4.5 website running on the full .NET framework. In this post I want to show you how you can use VSTS build V-next and the release management tools to leverage the docker technology.

Continue reading

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant

Deploying ASP.NET 4.5 to Docker on Windows

At the moment of this writing you can search the internet on ASP.NET and docker and all you will find is how to deploy ASP.NET Core applications to a Linux docker container. Although I love the initiative of ASP.NET core, I do believe that ASP.NET 4.5 is something many of you know and love already and nobody talks about how we can leverage docker on windows to run this full version of ASP.NET

To get you started we need to have a Windows version that is capable of natively running docker. With natively running docker I mean that docker is build into the OS. So no use of docker for windows tools, since we don’t want Linux containers, we want to run windows containers! At this moment you can use Windows 10 Anniversary edition and Windows Server 2016 Technical Preview 5 to go through the steps that I describe here to get your ASP.NET 4.5 website running in a docker on windows container.

Continue reading

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant

Execute and publish xUnit Tests results with .NET Core and VSTS

At the moment of writing you can not use the standard Visual studio tests task to run your xUnit unit tests on DotNetCore 1.0 and then publish the results to VSTS.

You need some different steps to get DotnetCore compiled and run your unit tests in a VSTS build. Here are the steps to make it work:

Continue reading

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant

How to unblock an Azure VM that is stuck in the starting state?

today I got hit by some serious outage on Microsoft Azure, that caused a couple of my virtual machines to be stuck in the starting stage. the problem was that there is just no way to fix this problem by using the simple tools you get in the azure portal. My servers that I use for demo purposes, needed to be up, since I was going to demo a lot of stuff in the afternoon at my Visual Studio Live! talks in Orlando.

My VM dashboard looked like this when I looked this morning:

Azure VM stuck in starting

So the question is, how the heck can you unblock these machines in this starting state, since they have been there for hours, so they are not actually starting.

the only way to fix this, was either delete the VM’s and be carful to keep the disks when deleting, or use PowerShell to stop the VM’s. Interestingly enough you can do a lot more with PowerShell then with the portal and I thought that might be the easiest way to get going again.

But since I most o the time just use the portal, I had not done any PowerShell on my brand new laptop. I think it is nice to go through the step by step process of what I needed to do in order to get things going again.

So first I needed to get the Azure PowerShell environment. The Azure PowerShell command lets are available for download, but I just got the whole package using the Windows Platform installer.

Here I selected the Azure Power tools and after that install I started a fresh command prompt.

Next I wanted to issue the Stop-AzureVM command, but in order for that command to succeed, you need to set up your subscription first.

For that you start with the command:

Add-AzureAccount.

This command will create an UI prompt to log you on with your Azure credentials and after this succeeds you will see your subscriptions listed associated with your account.

image

If you have multiple subscriptions, you need to check which subscription was selected as your default. In this case  I needed to select the right subscription. For this you use the command:

Select-AzureSubscription and you provide it the subscription name.

Now the default subscription is set for all subsequent azure commands.

Now I could finally issue the Stop-AzureVM command and there you need to provide it a couple of parameters. Fist you need to give it the name of the VM, tha tis easy since it is the name you see in the portal. The second question is the name of the service. The name of the service apparently is the name of the DNS for that machine, without the cloudapp.net part. So for my TFS azure machine that is called FluentbytesTFS, this was fluentbytesdc, as you can see in the picture here below.

image

 

After issuing the Stop-AzureVM command, I was able to use the portal again to start the VM’s. This time they started and all was well again.

Hope this helps you when you get your VM’s stuck, I had to search in multiple places to figure out how to make it work again.

cheers,
Marcel

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant

How to work with symbolic link files under Linux/Unix and TFS?

With Team Explorer Everywhere you have the ability to use TFS from the command line on any Unix/Linux system. One of the features of the Unix/Linux file system is that you can use so called symbolic links. These are files that more or less work the same as a shortcut, they point to another location on the file system where you can find the actual file. You could also call it a moniker.

This type of file is often used to share a common set of files from another location in the file tree on different other locations of the file system. It is a way to handle dependencies e.g.

Lets assume you have such a system, and you want to place it under Team Foundation Server Version control, how can you make this work?

Welcome in the wonders of .tpattribute files.

.tpattribute files get their name from the early days of Team explorer everywhere, the company where this was first build. Team Prise. a .tpattributes file is just a text file that can contain the definition of a symbolic link. this definition is then used on a get operation in that workspace to be applied to a certain file so it becomes a symbolic link.

In the past (before Team Explorer Everywhere 2012) you also used these files to set for a set of files e.g. the execute bit on a get operation.

the contents of the .tpattributes file is described very shortly here: http://msdn.microsoft.com/en-us/library/gg413272(v=vs.100).aspx

Lets use an example to clarify its usage:

Lets assume we have the following symbolic link we want in our workspace:

./site/bin/site_config

It points to:

site_config -> ../client/bin/site_config

For this to happen on a TF get command, we need the .tpattributes file to contain the following information:

site_config:local-link=../client/bin/site_config

When we have created this file we check it in. But that is not all to make it work! In order to actually make the magic happen we also need a file in version control as the placeholder for the symbolic link file. Easy way to do this is by deleting the symbolic link file and then recreate a new 0 bytes file with the touch command.

then we check in the .tpattributes file and the 0 bytes placedholder file, site_config in our example case.

Now to see the magic happen, we can set up a new directory and workspace mapping and then execute a get operation on that folder. What happens is that it will get the .tpattributes file and when that is on local disk, will be used by the tfs client to apply the symbolic link to the file site_config.

So the moment you get the site_config file, team explorer will convert it to the symbolic link. this can be easily verified by executing a ls –all command and then you can see it point to another file.

This symbolic link will not be set up when the file it points to is not available.

Another thing to note is that in the past the .tpattributes file was also used to set the execute bit on files. you could do this by starting the file with e.g. the following regular expression:

.*:x

This then resulted in all files in that directory to get the execute bit applied.

Now I have experienced that sometimes when your file starts with this syntax to set the execute bit on a certain set of files, sometimes the symbolic link is not created. the solution is that you remove this part from the file. the reason that can be done is that TFS will keep track of the the execute bit status on a file and when executing an add it will add this information with the file in TFS. when you get the file on a Unix/Linux system, then TFS will restore the execute bit without the need for the .tpattributes file.

Hope this helps, I can tell you it took me quite a while to get this figured out.

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant

© 2017 Fluent Bytes

Theme by Anders NorenUp ↑