In the Last Post we have seen how to use the Octopus for Cloud Service deployments, now in this post its all about build , deploy and promote windows services by using octopus deploy without any bespoke scripts.
- Visual Studio 2013
- Windows server 2012 (Either in cloud or on premise)
- Sourcecode repository (In this case, we have our sample solution in the github)
If you are reading this post, then you must be already having the above tools handy. In addition you need to have the following done
- Nuget Packaging
- Octo Pack
- Nuget Package repository
The solution file is available under https://github.com/mani0070 .
For this demo, I have taken a default solution file and made some simple log file writing to accomplish this demo.
Adding nuspec file for packaging as shown below
Enable the OctoPack by running the following command in the package manager console.
PM> Install-Package octopack
‘OctoPack 3.0.42’ already installed.
L2SProcessor already has a reference to ‘OctoPack 3.0.42’.
Check the changes into source control. Now, let’s move to teamcity to create the build configurations. Since we have seen about running tests in the last part we are not going to discuss it in here.
Below is the overview of the build configurations
This is a two step process which Is one to restore the nuget packages on the build agent and next to build the solution and octopack packaging.
Below screenshot looks, what its going to look like
The artefacts are produced as the nuspec definition
Octopus Setup and Configuration of Projects and deployment targets
- Adding Deployment Targets, since we have created the environment during the previous Post we will use the same. Refer previous post to get more information.
Now, let’s add the Listening tentacle as shown below
Next step is to add the projects
Now, the Process step is created as shown below, Extract the nuget packages, install the windows service and manage the configuration.
Now, click on configure features and enable windows service
You can use the Octopus environment variables to define the windows services name and description to represent the environment you are deploying. Likewise you can do the same for startup and executables if there are any arguments.
In the overview you can see the deployment status
This version match with OctopusDeploy and teamcity.
Hope you have enjoyed this article. Next Blog we will discuss about deploying the azure websites using the azure web app deployment targets.