Pages

Showing posts with label Docker. Show all posts
Showing posts with label Docker. Show all posts

01 November, 2022

Sitecore Scheduled Publishing Module - Update

The purpose of Scheduled Publish Module is to give the content editor the option to delay the publishing of an item for a future point in time. Thus, a page or a feature that should go live at a specific time can be created and populated in Sitecore and previewed long before it goes live without the risk of an accidental publish before the specific time. Moreover, there is no need for a content-editor to go to Sitecore and manually publish something at an inconvenient hour, e.g. a New Year’s announcement. Scheduled Publish intends to give the content-editor all features of a normal publish with the addition of automation, timing and notifications.

Updated to Sitecore 10.2

This module was built by Hedgehog few years ago and it was not updated to Sitecore 10. I forked it and updated to work with Sitecore 10.2. As part of this task,

  • TDS project has been removed and converted to Sitecore Content Serialization with version 5.1.x. 
  • Updated the .NET version, referenced latest Sitecore nuget packages and fixed build issues.
  • Updated the documentation from an old source to GitHub readme file.
  • Created a Sitecore Package for installing it without the source.
You can view it here in my GitHub repository. https://github.com/nehemiahj/SCScheduledPublishing.

Docker Asset Image Creation

Lately, I was exploring options to create a Docker asset image for this module. Robbert Hock has created an excellent Docker asset image creator script which can intake the Sitecore package and convert it into an asset image. When you run the script, you may face this issue "The SQL provider cannot run with dacpac option because of a missing dependency". You can follow the below steps to fix it. Otherwise, it was super easy to create the image using this script. 

To fix the dacpac missing dependency issue:
  • Install the following applications by downloading it from here
    • Microsoft SQL Server 2012 Data-Tier Application Framework
    • SQL Server 2012 Transact-SQL ScriptDom
    • SQL Server System CLR Types 11.0
  • Register it using gacutil
    • "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\gacutil" /i "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\Microsoft.SqlServer.TransactSql.ScriptDom.dll


Docker Asset Image:

For the Sitecore Scheduled Publishing module, the Docker image has been published to DockerHub and tagged it for Sitecore 10.2.

Image repository: nehemiah/sitecore-scheduled-publish

Tags: 10.2-1809

Dockerfile instructions:
  • cm:
COPY --from=<sitecore_scheduled_publishing_image> \module\cm\content .\


Reference:

DacFx Issue: https://stackoverflow.com/a/41777959/3016347
sitecore-module-docker-asset-image-creator: https://github.com/KayeeNL/sitecore-module-docker-asset-image-creator

24 August, 2022

Docker - Increase web.config size

Since we have many IIS rewrites, the web.config file size has exceeded the default 250 KB. We moved all the redirects to separate rewriteMaps configuration but the overall web.config file size has been more than 2.5 MB. In order for the application to work, we went ahead and set the registry changes in Docker images. 

While building the Sitecore CM image, we added few lines in Dockerfile to set the max size. Below lines will increase the web.config max size to 10 MB.

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Set the web.config size to 10MB to support rewriteconfig
RUN New-Item -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration'
RUN New-Item -Path 'HKLM:\SOFTWARE\Microsoft\InetStp\Configuration'
RUN Reg Add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration /v MaxWebConfigFileSizeInKB /t REG_DWORD /d 10240
RUN Reg Add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Configuration /v MaxWebConfigFileSizeInKB /t REG_DWORD /d 10240

Update: Dec 2022:

It is recommended to convert multiple RUN statements to multiline. 

Example: 

RUN {cmd1}  \
  && {cmd2} \
  && {cmd3} \


Docker - Install IIS Rewrite Module

Recently I wanted to test the IIS redirects in the local Sitecore Docker environment. In order to install IIS rewrite module, we can add few lines in CM Dockerfile. Please note that we need to rebuild the CM image. 

  • First, we need to get the MSI file for Microsoft IIS Rewrite site. You can get it from here
  • Then add the above lines to CM Dockerfile which will download the MSI file and install it silently. 
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install IIS Rewrite Module
WORKDIR /install
ADD https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi rewrite_amd64_en-US.msi
RUN Write-Host 'Installing URL Rewrite' ; Start-Process msiexec.exe -ArgumentList '/i', 'rewrite_amd64_en-US.msi', '/quiet', '/norestart' -NoNewWindow -Wait;

28 June, 2022

Sitecore Docker - xdbautomationworker, cortexprocessingworker, xdbsearchworker unhealthy in Docker Desktop 4.9.1

Back to blogging after a month of learning and completing certifications. June has been a month of Certifications in Sitecore community. :) 

Containers for Sitecore development has reduced the onboarding time for new team members and it is easy to bring up and bring down a Sitecore environment without impacting much on the hosting environment. 

When Docker Desktop works, everything is fine. When it does not, sometimes we have to spend hours to find the root cause especially in an office laptops where company policies are applied. That's been the case after Docker Desktop 4.7+ onwards. 

ERROR: for cortexprocessingworker Container "22039ee585b5" is unhealthy. ERROR: for xdbautomationworker Container "22039ee585b5" is unhealthy. ERROR: for xdbsearchworker Container "22039ee585b5" is unhealthy. ERROR: Encountered errors while bringing up the project.

Recently encountered this issue with Docker Desktop 4.9.1. There are multiple ways mentioned in the below links. 

https://stackoverflow.com/questions/38088279/communication-between-multiple-docker-compose-projects/38089080#38089080

https://stackoverflow.com/questions/41093812/how-to-get-docker-containers-to-talk-to-each-other-while-running-on-my-local-hos

https://stackoverflow.com/questions/42385977/accessing-a-docker-container-from-another-container

We followed the below step to resolve the issue. 

  • Open Windows Defender Firewall with Advanced Security
  • Click Windows Defender Firewall Properties. 
  • Go to Publish Profile, click Customize in Protected network connections. 
  • Uncheck any network connections starting with name - vEthernet
  • Give 2 - 3 minutes for the changes to reflect and open Terminal again.
  • Start the containers again. 
Few experts in the community mentioned that there are other alternatives. Trying to gather the details and reference those solutions here. 

Update 7/8/2022:
Docker released Docker Desktop v4.10.1 (82475). It seems that this version has fixed many Docker related problem. 

blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }