Tuesday, August 12, 2014

Octopus Deploy

Octopus Deploy is a deployment solution focused on .Net development teams. The goal is to have an automatic deployments. The whole concept is very similar to integration server - a place where code is built, packed, and deployed. Except that Octopus takes care of the deployment of packages to desired destinations.

It achieves this by installing services (called Tentacles) on destination machines and one central point - the Octopus. The software releases are packed as nuget packages - a simple zip container with files + some metadata.

Octopus can deploy web sites as well as windows services.

A few tricks are required, though.

  • Set the Web.config transforms build action to Content so that the transform files do get copied to the output directory. Only then Octopus can actually perform the transform process. More here.

Code Project Preparations

Configuration Transformations

One of the key things is to have configurations for different environments in the source code.
Web Config Transformation Tester is an online tool that helps to test configuration transforms. Alternatively, use Slow Cheetah, Visual Studio extension.

Build Process

Package Restore

See "Package Restore with Team Build" for instructions on how to build a solution that has NuGet Package Restore enabled. In brief, use the build.proj MS Build script as the destination project. Adjust the paths to your code's locations before hand.


OctoPack nuget package can be added to deployable projects to help out in generation of deployable packages. Then, add "/p:RunOctoPack=true" parameter to MSBuild to generate the packages. Additional parameters:
"/p:OctoPackPackageVersion=1.0.1" overrides the package version number which is, by default, taken from the project version.
"/p:OctoPackPublishPackageToFileShare=c:\packages" instructs OctoPack to copy only the resulting packages to the destination directory. This way you do not need any other output files.
OctoPack can also deploy directly to NuGet Server with "/p:OctoPackPublishPackageToHttp=http://my-nuget-server/api/v2/package".
See more at OctoPack GitHub page.


No comments: