Continuous Integration and Continuous Delivery using TFS 2013 and Octopus Deploy in Windows Azure

 

Recently I have been looking at the TFS 2013 as a source control system and Continuous Integration Tool to enable teams to develop more productive manner. Then Extend to continuous Delivery/Deployment using the tool Octopus Deploy. Octopus Deploy have become my favourite Deployment/Delivery Model. This Model can be replicated for on premise/private cloud infrastructure and will suite for hybrid cloud configuration with correct networks in place.

As Always I have written in my blogs earlier, I have taken few hours to do this demo right from the first baby steps. Also, this will help for Microsoft house.

  1. Setting up TFS 2013 source control
  2. Creating the Projects in TFS source control
  3. Adding the Sample ASP.Net applications to source control with Tests
  4. Creating the build definitions
  5. Installing Octopus Deploy Server and Tentacle
  6. Configuration of Octopus Deploy
  7. See the Action

For this demo, I’m using Azure Infrastructure as Service Platform. You can sign up for free to Trial under this link http://azure.microsoft.com/en-gb/pricing/free-trial/. Since this is a demo I have installed and configured all the products/tools in same virtual machine.

I have already have the Virtual Networks, Storage Accounts etc Configured, Create new virtual machines using the Team Foundation Server 2013 Update 4 Image which is available under the visual studio category as shown in below screenshot

I’m not going to walk through the entire Image creation process because, this article is more focused on Continuous Integration/Delivery not about how to create virtual machines in Azure.

Step 2: we need to make sure all the require ports are open in Azure for us to play with. Please refer below screenshot. Note, please make sure all the ports are allowed inbound in the windows Advance security firewall configuration.

Http Ports – Quick overview

8080 is for TFS access

1001 is for Octopus Deploy Server (Tentacle operates on difference port which is not required for our demo but if you scale out then yes you need to consider that as well in the client machines)

430-433 are for the actual website to be accessed.


 

As Shown below, we have created a new collection which is didemocode and the project is diprojectsdemo which we are going to use in this series of article.


Now, lets add some code to the source control and install Octo pack


I have already got some sample code and test projects associated for this demo. As shown in below screenshot


Open the Solution and Select the project you want to generate the nuget packages to be deployable artifacts


Now, lets take a look at the build definition which we have created for this project, first thing is first make sure you have Continuous Integration – Build on each check-in is enabled


In the Process tab, we set what solution and projects to build under which configuration


Now, we can queue the build and the build happens. But to produce the nuget packages we need the nuspec file to be added to the projects. This will help complex projects to add files to the packages which are non-standard


Now, we need to make sure to install and configure the Octopus Server (http://docs.octopusdeploy.com/display/OD/Installing+Octopus) and Tentacle (http://docs.octopusdeploy.com/display/OD/Installing+Tentacles).

For the demo purpose the we are configuring Octopus server under 1001 http port and Octopus Tentacle is running under 10933 port

Create the Environments as per the requirements (In this scenario we are naming it as Development, Test , Pre Production/Staging and Production) Refer Screenshot below

Now, we need to add the Machines and assign to the environments. We have configured the Octopus Tentacle in the Listening mode.


In this demo, we are planning to use the Inbuilt Octopus Nuget server as a Package repository.


Created the Octopus Project


Added a simple, Deploy Process Step to install nuget packages and configure the IIS websites/ application pool.


IIS Configuration


The Next step is to Create the API Keys for uploading the nuget packages once CI builds are passed in the TFS


 

Under the Advanced Section, lets Pass the Additional Build arguments required for the Octopack which we installed earlier to create the nuget packages and publish them to the Octopus Server as shown below


/p:RunOctoPack=true

/p:OctoPackPublishPackageToHttp=http://ditfs.cloudapp.net:1001/nuget/packages

/p:OctoPackPublishApiKey=API-WQUPMXQKZGXGC8LJLWGOHGL8W

/p:OctoPackPackageVersion=$(TF_BUILD_BUILDNUMBER)

For Demo purpose I have customized build version numbers


 

Now, Up to this Point TFS will run the build, execute the unit test if everything is looking green. It will package up and upload them into Octopus Nuget packages


There is an option to create the releases automatically when the packages are uploaded in Octopus server.


Now lets make a change and see the releases are automatically created. Just after the check in build is kicked off


Now, let’s look at the octopus server and we should have a release waiting for us to be deployed into various environments.


Let’s push this release into the development environments , if needed we can push to all environments at one go


Now, we have released to dev and promoted to all the other environments just with click of a button.


Next Post you will be able to see the Presentation video of the whole process.


3 thoughts on “Continuous Integration and Continuous Delivery using TFS 2013 and Octopus Deploy in Windows Azure

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.