Skip to content

Instantly share code, notes, and snippets.

@perosb
Last active March 6, 2021 07:01
Show Gist options
  • Save perosb/1d1795ab3c746b129ede3d1cd802e32b to your computer and use it in GitHub Desktop.
Save perosb/1d1795ab3c746b129ede3d1cd802e32b to your computer and use it in GitHub Desktop.
Sitecore 10.1 patched solr Dockerfile to cleanup after crash

Sitecore 10.1 patched solr Dockerfile to cleanup after crash

Slr sometimes crashes in our dev setup leaving write.lockfiles around which causes problems during next start. The below removes the lock files prior to start.

Solr Dockerfile uses upstream sitecore as PARENT_IMAGE

Patch in a "Remove-Item" command somewhere in the Start.ps1

# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}

RUN $start=(Get-Content c:\Start.ps1); `
    $start -Replace '\$dataPathToTest = ', `
        'Remove-Item -Path $DataPath -Include write.lock -Recurse -ErrorAction SilentlyContinue; $dataPathToTest = ' `
        | Set-Content c:\Start.ps1

Running it

The new solr from Sitecore 10.1 caused us some other headaches around memory management. We either have to enable "Lock Large Memeory" inside the container, but seems to be kind of tricky using secedit.exe so the below GC_TUNE simply removes the "UseLargeMemory" options.

  solr:
    image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xc0-solr:${RELEASE_VERSION:-latest}
    environment:
      SOLR_JAVA_MEM: "-Xms1000m -Xmx1000m"
      GC_TUNE: -XX:+UseG1GC -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250 -XX:+AlwaysPreTouch
    mem_limit: 1500MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment