A big portion of last year I’ve spent building accelerators for a Sitecore solution scaffolding and deployments aside from production projects. All this work was done for VMs created in a cloud managed via OpenStack. Using PowerShell DSC we were able to easily set up single machine local sandboxes as well as multi-server environments. However, provisioning VM and then configuring them is still less than ideal for the deployment of an application. What I was waiting for is a release of windows containers. Finally, they arrived closer to the end of last year and a few months later I was able to try them out. So I’m going to start describing what I’ve ended up creating, keeping in mind that tweet from last year:

@mservais that would be cool to see @Sitecore running in containers on @kubernetes with @nodejs responsible for presentation layer and…

Alexander Smagin (@true_shoorik) December 21, 2016

The reason why I was waiting for windows containers is quite simple. Container technology provides you with a possibility to package your application and make sure that the configuration it will use will be identical in all environments. It doesn’t matter if you are running a container on your local machine or in a cloud, and that is a beauty.

In addition to that, you have a very easy way to scale your application as a creation of a new container, that already has your application and is ready to go takes less than a couple of minutes (plus whatever you put into a vanilla Sitecore to make it start slower :).

You do not need to reconfigure a clean machine - just provide valid connection strings to databases and you are good to go. This could be done via environment variables and a tiny startup script or even simpler - automatically linked hosts via docker-compose (or Swarm, or Kubernetes).

It is possible to continue this list for quite a while, but hope you start to feel this pure DevOps joy :)

Jenkins

As some samples of Sitecore in docker are already available on GitHub I used them as a basis, but my interest in end-to-end deployment solution should include a continuous integration as a must-have element.

Tools providing good dotNET support like AppVeyor are nice to work with but they only provide SaaS offering. TFS is something that I prefer not to work with unless I’m forced to (the new build system makes a situation a bit better but still). I end up using Jenkins as it is free, widely used, and supports tons of different plugins.

jenkins _ Sitecore Build.V2 Multi-Branch - Google Chrome 2017-04-28 23.34.51

Actually, with recently released Blue Ocean it gets a nice facelift, multibranch support which is good for feature branch development, and the ability to drive CI configuration with *Jenkinsfile *stored in your source control.

What is included

Jenkins image on GitHub includes master and slave configurations of Jenkins. Both images are build based on openjdk:windowsservercore images available on DockerHub. The reason to do it on Windows images is that setup of a Docker cluster with multiple platforms is quite complicated to run on a single VM or your PC, but I’m planning to explore this later with Kubernetes or Swarm.

On top of this for Master, I’m installing Jenkins itself, Git client (as you would need it to check the content of branches and trigger feature branch build).

The Slave configuration is a bit more complicated, as it includes the following things:

  • Download Jenkins zip and extract slave from it
  • Install dotNet 4.5 features
  • Install MSBuild 14
  • Install NuGet

Install MSBuild Web Targets (this allow to avoid Visual Studio installation on slave machines - Install Git

  • Install NodeJS
  • Install Jetbrains Static Code Analysis
  • Install NUnit & XUnit

In addition to that, each setup will have the start-up file that will start Java and load the corresponding jar file in it. The master configuration will also check plugins.txt file and install all plugins listed there.

Those images are the basis and are further inherited by Sitecore ones. In my case, I’m adding TDS as we are using it internally and also a default configuration to Jenkins Master. This default configuration includes jobs that we are usually setting up for Sitecore.

Where to find?

You could find the source code of base images on GitHub https://github.com/asmagin/jenkins-on-windowsservercore or DockerHub https://hub.docker.com/r/asmagin/jenkins-on-windowsservercore

Follow me on Twitter @true_shoorik. Would be glad to discuss the ideas above in the comments.