Monday, August 17, 2015

Sitecore Deployments using OctopusDeploy - Part 1 (Overview and Architecture)

Part 1 | Part 2 | Part 3 | Part 4


While working on one of the biggest Sitecore Implementation, few years back there was no guidance nor the defined process for Continuous Integration and Deployment for Sitecore. We have learned our lessons hard way and wanted to ensure that other folks in the community does not go through the same pain.

In this blog series I wanted to put forth my thoughts on specific to area of deployment while briefly touching on the build and Continuous Integration process

In the 4 part series of deployment, I will be focusing on these areas
  1. Continuous Integration and Deployment Architecture
  2. Overall deployment process and considerations using OctopusDeploy
  3. Handling environment specific Configuration Transformation
  4. Handling external packages such as Sitecore support patches, Modules and Hotfixes

Continuous Integration and Deployment Architecture

Strategic Architecture

Strategic Continuous Integration and Deployment Architecture which involves Sitecore and Other Microsoft Technolgoies
Strategic CI And Deployment Platform

Specific to Sitecore Project

Project specific Continuous Integration and Deployment Architecture
Sitecore Project Specific Continuous Integration and Deployment Architecture

This will be explained in detailed in the subsequent blogs

Tools and Technologies

Tools and Technologies used in Sitecore Continuous Integration and Deployment
Tools Used in Sitecore Continuous Integration and Deployment

Please note: We are using TDS in all three phases. 

  • In Development to work against local Sitecore instance and serialize our items in source control system
  • In Continuous Integration to create Sitecore Packages
  • And In deployment we are using PackageInstaller.exe that comes with TDS to install Sitecore packages using Powershell.

Brief considerations for Development and Continuous Integration

Development Environment Considerations

  1. Use Team Development for Sitecore (TDS) from Hedgehog to work with Sitecore items directly in Visual Studio
  2. If you have multiple teams working on the same Sitecore platform, better separate their responsibilities and areas in Sitecore where they work. TDS allows you to sync the children under the parent but if you have two teams working on the same folder / root item, when you install the package with these settings, you may step over one another and end state will not be what you desire.
  3. Work against your local Sitecore sandbox environment than central Sitecore development server, otherwise, it will add limits to your capabilities to do parallel streams of development without having additional environments for each individual team working in parallel sprints / across multiple branches in source code repository
  4. Consider cloud based source code repository such as Bitbucket OR any other GIT based repositories. This will allow you to do feature based development, facilitate multi-geo development and avoid additional infrastructure to support. This will also depend on your legal and regulatory compliance.
  5. Bring in test driven development right from beginning using NUnit, XUnit and FakeDB for mocking Sitecore
  6. Use SlowCheetah to create configuration transformation files (other than web.config). This way you can also preview transformed configurations right in the visual studio.

Build and Continuous Integration (CI) Considerations

  1. For CI, you can use any of the Continuous Integration platforms as long as it supports MS Build, PowerShell and also has plug-ins to generate Nuget Packages.
  2. In our environment we generate two separate packages. First package contains our web deploy solution such as files (aspx, cshtml, css, js, dll), configurations (*.config including config transformation files) and the other one contains a Sitecore pacakge with all Sitecore items serialized using TDS. Both these pacakges are created as Nuget packages. Sitecore package is wrapped in a Nuget package
  3. We have customized the package creation for Sitecore to generate incremental package compared to the last production release. This is done by customizing Sitecore Courier and using Sitecore.Update dll
  4. In addition you can run unit test cases built on frameworks mentioned above, run static code analysis using FxCop / StyleCop and submit its report to products like SonarQube
  5. Once the packages are built, CI platform publishes these package into the Nuget feed hosted by Nuget servers such as Proget. You can leverage this server to matinain enterprise nuget feeds and keep all your nuget dependencies project / enterprise wide.
In the next blog I will talk about overall deployment process and considerations for the same using OctopusDeploy.