2015 Ignite New Zealand demo prep: Step 3

Steps:

  1. Intro
  2. VSO
  3. Docker
  4. xUnit
  5. Build
  6. Back end
  7. Selenium
  8. Docker
  9. Release Management
  10. Testing

Microsoft Visual Studio has tooling that eases the creation and deployment of Docker hosts. In this post we are going install the extensions and configure our Docker host. Be sure to check that all your tools and extensions are up to date by visiting the Notifications in Visual Studio.

Once your IDE is up to date we can install the needed extensions.

For this demo we are going to need Tools for Docker , SQL Server Data Tools , and ASP.NET and Web Tools .  The tools for Docker enable the deployment of ASP.NET 5 applications to Docker containers running on Linux or Windows VMs. Make sure you have at least version 0.7.1.

  1. Install Web Tools Extensions
    1. Visit Microsoft ASP.NET and Web Tools 2015 download page
    2. Click Download
    3. Check DotNetVersionManager-x64.msi
    4. Check WebToolsExtensionsVS14.msi
    5. Click Next
    6. Click Run on both the msis and install one after the other
  2. Install Tools for Docker
    1. Visit Tools for Docker download page
    2. Click Download button
    3. Click Run
    4. Install
  3. Update SSDT
    1. From the Tools menu, select Extensions and Updates
    2. SSDT should already be installed but still verify there are no updates needed
    3. If you find any, install them before you proceed

    SQL Server Data Tools is one of Microsoft’s best kept secrets.  If you are developing for SQL Server, you owe it to yourself to at least research the power in SSDT.  SSDT enables the management of your database schema just like every other project in your solution and deploys your changes without writing a single line of SQL and without losing a single line of data.

    To make sure everything is set up correctly, let's create the ASP.NET 5 application we are going to use in this demo.

  4. Create ASP.NET 5 app
    1. From the File menu select New / Project…
    2. From the Visual C# section select Web
    3. Select the ASP.NET Web Application template
    4. Enter PeopleTracker.Preview as the name
    5. Enter PeopleTracker as the solution name
    6. Check the Add to source control check box
    7. Click OK
    8. Select Web Application from the ASP.NET 5 Preview Templates
    9. Change the Authentication to No Authentication
      1. Click Change Authentication
      2. Select No Authentication
      3. Click OK
    10. Uncheck Host in the cloud check box
    11. Click OK
    12. Select Git
      1. This demo would also work if we selected TFVC. However, for this demo I wanted to show how to work with our new Pull Request feature, so I selected Git. TFVC is not going away and is still a valid source control choice.
    13. Click OK

    Once the project creation is complete, compile and run the application to make sure everything is working as expected.

  5. Create Dev Docker Host
    1. Right-click project
    2. Select Publish...
    3. Select Docker Containers
    4. Click the New... button
    5. Select Subscription
    6. Select Location
    7. Enter DNS name for Dev Docker Host
    8. Select Ubuntu Server 15.04 for image
    9. Enter Username
    10. Enter Password
    11. Confirm Password
    12. Click OK
    13. Click OK on Virtual Machine Creation Started dialog

    A PublishScripts folder will be added to your solution with a Scripts and Templates folders. For each host you create you will get a PowerShell script and two json files. You can monitor the progress from the Output window or from the Azure Portal. When the deployment of the template is complete you will have a folder created that has all the certs needed to connect to the host. We will reuse theses certs when we create the additional Docker Hosts. Each Docker Host will be created in its own Resource Group and will include the following:

    • Virtual Machine
    • Network Adapter
    • Public IP
    • Virtual Network
    • Storage Account

  6. Publish to your Dev Docker Host
    1. Right-click project
    2. Select Publish
      1. This time, the Publish dialog will open on the Connection tab.
    3. Click Validate Connection
    4. Click Next
    5. Click Publish

    Leave the Dockerfile text box empty so it will be auto generated for us and click Publish. Visual Studio will create a dockerfile and add it to your project. It will also build, package, and deploy our application to our Docker Host and launch our default browser so we can use our site. Once the publish is complete a browser will open with your application running.

    At Ignite I deployed to three environments so I repeated the process to provision my QA and Prod hosts as well.

  7. Create QA Docker Host
    1. Right-click project
    2. Select Publish...
    3. Click Profile Tab
    4. Select Docker Containers
    5. Click the New... button
    6. Change DNS name for QA Docker Host
    7. Click OK
    8. Click OK on Virtual Machine Creation Started dialog
  8. Publish to your QA Docker Host
    1. Right-click project
    2. Select Publish...
      1. This time, the Publish dialog will open on the Connection tab.
    3. Click Validate Connection
    4. Click Next
    5. Click Publish
  9. Create Prod Docker Host
    1. Right-click project
    2. Select Publish...
    3. Click Profile Tab
    4. Select Docker Containers
    5. Click the New... button
    6. Change DNS name for Prod Docker Host
    7. Click OK
    8. Click OK on Virtual Machine Creation Started dialog
  10. Publish to your Prod Docker Host
    1. Right-click project
    2. Select Publish...
      1. This time, the Publish dialog will open on the Connection tab.
    3. Click Validate Connection
    4. Click Next
    5. Click Publish

    The final step is to use Team Explorer to commit and push your changes to VSO.

  11. Commit and Push your changes
    1. Open Team Explorer
    2. Open Changes
      1. If you have not already, click the Configure link to configure your user name and email address and return to the Changes tab.
    3. Review the Untracked Files and make sure everything is included in the commit except the openssl tools.
    4. Enter comment
    5. Select Commit and Push

    This will take you to the Synchronization page so we can enter the URL to our VSO Git repo. Visit the Code page of your VSO team project and copy the value presented under the “to clone this repository” section. Paste that value into the text box on the Synchronization page and click publish. When the publish is complete, return the VSO code page and press F5 to see your code in VSO. In the next post we will add xUnit test to our project.

Comments (16) -

  • Aaron Taylor

    10/5/2015 12:49:26 AM | Reply

    Hi Donovan, I am loving the step by step blog posts which I am attempting to follow after seeing it in action at Ignite NZ but am having a problem with this one.
    After installing Tools for Docker and ASP.NET Web Tools for 2015 Beta7, when I right click the project and click Publish nothing happens and if I go to Build -> Publish Project I get the error 'COM object that has been separated from its underlying RCW cannot be used.'
    I am using Visual Studio 2015 Enterprise. Is there something I am missing?

    • Donovan

      10/7/2015 6:35:27 AM | Reply

      Hey Aaron,
      I am glad you are enjoying the series.  Are you using the RTM bits for Visual Studio?  I know the Docker tools are very specific about which versions they work with.  I would double check you are using RTM bits for each.  Another option is to spin up a machine in Azure like I did.

      • Aaron Taylor

        10/8/2015 3:36:47 AM | Reply

        Thanks Donovan, I managed to get further by spinning up a machine. I managed to set up the Publish profile and create the resource group and when I attempt to publish it seems to complete successfully. However, I can't browse to the site and looking back at the publish output I see the error 'Failed to connect to myapplication.southeastasia.cloudapp.azure.com/. If your Docker host is an Azure virtual machine, please make sure to set up the endpoint '80' using the Azure portal.' I have tried to set the endpoint for port 80 but the option doesn't seem to exist in the new Azure portal and this type of VM is not accessible from the old portal. Do you have any advice?

        • Donovan

          10/10/2015 4:39:51 PM | Reply

          The only time I have gotten that error is when my image failed to run.  I would use putty and connect to the Docker host.  Issue a "docker ps" command. This will list all the running containers. I bet you get an empty list back.  You can run "docker images" to see all the images that have tried to run on your machine. That command will also show you the state of the image. I bet they all failed to start for some reason.  In the output window in Visual Studio it should show you the last error from the image that was trying to start.  When this happen to me most recently I had to make sure I was using the latest version of the Docker tools. The only way to get them was to download them from the site and not from within Visual Studio.  I think I had to recreate my profiles but then everything worked.

  • Roger

    12/16/2015 10:28:50 PM | Reply

    What DNS Name, am I supposed to enter in the step 5. g. "Enter DNS name for Dev Docker Host"?

    • Donovan

      2/28/2016 1:15:47 AM | Reply

      In your Azure portal should be the FQDN for your Docker Host.

  • Roger

    12/16/2015 10:52:00 PM | Reply

    Can you update this blog post that "Azure SDK 2.8.1" is now required?

    • Donovan

      2/28/2016 1:16:30 AM | Reply

      I am updating the entire series for my 2016 trip to New Zealand. It will updated in that series.

  • Sriram

    1/27/2016 8:50:44 AM | Reply

    Hi SIr,

    I am getting the below error after publishing app
    VERBOSE: Trying to connect to http://donovandev.eastus.cloudapp.azure.com/, attempt 10
    VERBOSE: GET http://donovandev.eastus.cloudapp.azure.com/ with 0-byte payload
    Executing command [docker --tlsverify -H tcp://donovandev.eastus.cloudapp.azure.com:2376 logs 069264fe1294635fc737aafec546e34068d6cf535267762a9c93c4c3e77fb947]
    Failed to connect to http://donovandev.eastus.cloudapp.azure.com/. If your Docker host is an Azure virtual machine, please make sure to set up the endpoint '80' using the Azure portal.
    I tried several times with different profiles. Still facing the same issue. I have gone through azure.microsoft.com/.../   .Nothing worked for me. Please suggest work around for this.

    Thanks
    Sriram

  • Julien Strohejer

    2/16/2016 10:00:34 PM | Reply

    Hey Donovan,

    What a great post !

    FYI, you missed to mention to install the Docker Toolbox (https://www.docker.com/products/docker-toolbox) before to install the Install the VS Tools for Docker ;)

    Thanks

    • Donovan

      2/28/2016 1:14:14 AM | Reply

      Interesting because I never installed Docker Toolbox on my machine.  I wonder if the latest version requires it. When I used it, it did not.  I hope others see your comment.

  • Eelco Los

    5/27/2016 9:41:48 AM | Reply

    Hey Donovan,
    I watched both your Ignite 2015 NZ and Build 2016 show. Keep up the good work! Laughing

    I was trying to get this step 3 going, when my docker installation requested an update. After updating everything, The .net 5 docker publishing wasn't available (due to it being renamed to .Net Core). However, even the new .Net Core doesn't have the Publish Docket Container. Do you know how the current version publishing to a remote docker container is provided?

    • Donovan

      5/30/2016 3:00:12 PM | Reply

      Thanks!  I just started playing with .NET Core RC2 and Docker. I have gotten it to work and will be posted how soon.  Stay tuned.

  • Eelco Los

    6/23/2016 9:32:33 AM | Reply

    Hey Donovan,

    As you know, I'm trying to implement this demo to the fullest (if that's proper english ;) ).
    When i'm using docker-machine env create, it'll create the machines properly on azure and can be used during the time the vm is available. However, If i'd stop (deallocate) the machine, not editing the machine at all.
    I can resolve some of that by going into azure and edit the machine to have the docker extension installed on it as well, using the certificates it created via the docker-machine command. This will make it possible to reuse the same docker-machine. However, after starting it then and accessing the vm via the docker-machine env dockerdev command it'll say the certificate is registered for another ip then the one it currently has.

    Is there any solution to either have the server being registered for 1 ip, so the certificates do work after the vm has been deallocated (ie. using the docker vm's for dev/qa during working hours) and starting them again or have the certificates not be ip-based but dns based?

  • Andy T

    7/19/2016 8:09:44 PM | Reply

    Hello Donovan, Great post but getting stuck on step "Install Tools for Docker". In my case, I took an Azure VM with VS2015 Community + Update 3 + Azure SDK 2.9. With DotNetVersionManager-x64.msi and WebToolsExtensionsVS14.msi, I am getting a message that more recent version is already installed. Then, when I run "VS 2015 Tools for Docker Preview" - it says - I need Microsoft .NET Core 1.0.0 RTM VS 2015 Tooling Preview 2. But the Preview 2 installation is also failing. Please take a look at the steps - it may require a refresh.    

  • Andy T

    7/20/2016 1:10:19 AM | Reply

    Hi Donovan, Today morning I submitted a comment regarding an error for deploying - Microsoft .NET Core 1.0.0 RTM VS 2015 Tooling Preview 2, which is a prerequisite for Docker Tools for Visual Studio 2015 installation. This time I tried against VS Enterprise 2015 and it worked. I think its a bug in the installation code for Microsoft .NET Core 1.0.0 RTM VS 2015 Tooling Preview 2. It checks the Visual Studio version number before installation and the number is probably wrong for VS community version check. That's why it is not working for community version only.

Pingbacks and trackbacks (25)+

Add comment

Loading