Helix In The Sitecore Docker Images

Table Of Content:

Entrée

A docker file is the representation of a docker image. In a word, if you want to build an image, that's where you would have to make your modification or implementation. In this article, I would like to help you navigate through the current structure of the docker images used to create the Sitecore Docker images. At the end of this article, you should get a pretty clear understanding on how the images are structured and how to read through them.

Before reading the content, I will describe some acronyms that I am using in this article.

Acronym Description
SXA Sitecore Experience Accelerator
JSS JavaScript Services
PS Publishing Service

La Pièce De Résistance

A docker file is a set of docker commands that will be executed to create your docker images. The repository contains a lot of images. The docker images are structured using the Helix principle, there are foundation, feature and a project layers.

Helix principle

The Foundation Layer

The foundation layer contains all images that are used as base for every images. For example, the Sitecore assets, MS SQL server image, etc etc.

The Sitecore Assets image

This is one of the basis image for the Sitecore Docker Environment. It contains all the necessary assets such as scdwp package to succesfully build an image of a specific version of Sitecore. Every version of Sitecore has its specific Sitecore assets images.

What it does?

  • Downloads a set of files it may vary from sitecore version to another (nuget.exe, urlrewrite.msi,vc_redist.exe, filebeat.zip, dotnet-hosting.exe, node.msi)
  • Install nuget and a series of assemblies
  • Extract the specified scwdp packages. For 9.3 it would use below
    • "Sitecore 9.3.0 rev. 003498 (WDP XM1 packages).zip",
    • "Sitecore 9.3.0 rev. 003498 (WDP XP0 packages).zip",
    • "Sitecore 9.3.0 rev. 003498 (WDP XP1 packages).zip",
      • "Sitecore.Commerce.WDP.2020.01-5.0.145.zip",
      • "Sitecore Experience Accelerator 9.3.0.2589.scwdp.zip",
      • "Sitecore Experience Accelerator 9.3.0.2589 CD.scwdp.zip",
      • "Sitecore Experience Accelerator XM 9.3.0.2589.scwdp.zip",
      • "Sitecore Experience Accelerator XM 9.3.0.2589 CD.scwdp.zip",
      • "Sitecore JavaScript Services Server for Sitecore 9.3 XM 13.0.0 rev. 190924 CD.scwdp.zip",
      • "Sitecore JavaScript Services Server for Sitecore 9.3 XM 13.0.0 rev. 190924.scwdp.zip",
      • "Sitecore JavaScript Services Server for Sitecore 9.3 XP 13.0.0 rev. 190924 CD.scwdp.zip",
      • "Sitecore JavaScript Services Server for Sitecore 9.3 XP 13.0.0 rev. 190924.scwdp.zip",
      • "Sitecore.PowerShell.Extensions-6.0.scwdp.zip",
      • "Sitecore Publishing Service 4.2.0-win-x64.zip",
      • "Sitecore Publishing Module 9.3.0.0 rev. r00546.2197.scwdp.zip"
    • Create a couple of folders.

An example can be found here.

The Feature Layer

The feature layer contains all base sitecore images. For example the Sitecore XM, XP images. They are built on top of the images from the foundation layer.

The Sitecore XP and XM images

These images are the keys to having a running Sitecore Docker Images. They are responsible of the following actions

  • Download and extract the scwdp packages (provided by the Sitecore Assets image) to C:\inetput\wwwroot
  • Copy a set of configs
  • Create and remove folders
  • Add installers
  • Create an IIS instance/website that will point to the created directory
RUN $env:INSTALL_TEMP = 'C:\\inetpub\\wwwroot\\temp\\install'; `
    $env:IIS_SITE_PATH = 'IIS:\Sites\Default Web Site'; `
    $env:IIS_SITE_HOMEDIR_PATH = 'C:\\inetpub\\wwwroot'; `
    $env:IIS_APPPOOL_IDENTITY = 'IIS AppPool\DefaultAppPool'; `
    # install dependencies
    Start-Process msiexec.exe -ArgumentList '/i', (Join-Path $env:INSTALL_TEMP '\\setup\\urlrewrite.msi'), '/quiet', '/norestart' -NoNewWindow -Wait; `
    Start-Process (Join-Path $env:INSTALL_TEMP '\\setup\\vc_redist.exe') -ArgumentList '/install', '/passive', '/norestart' -NoNewWindow -Wait; `
    # install tools
    Copy-Item -Path (Join-Path $env:INSTALL_TEMP '\\tools') -Destination 'C:\\tools' -Recurse -Force; `
    setx /M PATH $($env:PATH + ';C:\tools\scripts;C:\tools\bin') | Out-Null; `
    # configure Windows to disable DNS caching
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name 'ServerPriorityTimeLimit' -Value 0 -Type DWord; `
    # configure app pool permissions
    Add-LocalGroupMember -Group 'Performance Monitor Users' -Member $env:IIS_APPPOOL_IDENTITY; `
    $acl = Get-Acl -Path $env:IIS_SITE_HOMEDIR_PATH; `
    $acl.SetAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule($env:IIS_APPPOOL_IDENTITY, 'FullControl', @('ContainerInherit', 'ObjectInherit'), 'None', 'Allow'))); `
    Set-Acl -Path $env:IIS_SITE_HOMEDIR_PATH -AclObject $acl; `
    # configure role
    Import-Module WebAdministration; `
    Set-WebConfigurationProperty -PSPath $env:IIS_SITE_PATH -Filter '/appSettings/add[@key=\"role:define\"]' -Name 'value' -Value $env:SC_ROLE_DEFINE; `
    # delete temporary files
    Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse;

An example can be found here.

The Project Layer

The project layer contains all the other flavours of Sitecore, for example SXA, JSS, PS.

The Sitecore SXA image

This is a derivation based on the Sitecore XM or XP images provided by the Feature Layer. It simple installs the Sitecore SXA packages. It does not create an IIS instance anymore as it is based on the Sitecore XM/XP images

An example can be found here.

Overview of the Docker Images Layers and Dependencies

Helix principle

Le Dessert

We've seen that docker images architecture and dependencies align with Sitecore's Helix principle. where in the docker context, the foundation layer creates the infrastructure of all the containers, the feature creates the basis of a Sitecore Docker image and the project the actual Sitecore flavors. Now that you've read how the docker images are built and their structure and dependencies, you should now be able to create your own container using the principles and theories named in this article.