Skip to main content

Walkthrough: Preparing to install the SFCRM connector in a container environment

Abstract

How to prepare installation files and Docker images for installing Sitecore Connect for Salesforce CRM in a container environment.

To prepare for adding the Sitecore Connect for Salesforce CRM connector (SFCRM) to your container installation, regardless of whether you are deploying to Docker or Azure Kubernetes Service, follow the steps in this walkthrough.

This walkthrough describes how to:

  • Prepare the installation files.

  • Build the Docker images.

To prepare the files you need for the installation:

  1. Download the SFCRM container deployment package from the Sitecore download page. Extract it to your local workstation with the folder structure intact.

  2. Go to the folder that you extracted the SFCRM container deployment package to. Go to the folder for the Windows version and topology you are using, for example, compose\ltsc2019\xp1.

  3. Open the .env-example file in an editor. Copy all the variables to the clipboard.

  4. Go to the Sitecore Experience Platform (SXP) container deployment folder on your local machine. Go to the folder for the Windows version and topology you are using, for example, compose\ltsc2019\xp1.

  5. Open the .env file in an editor, and paste in the variables from the SFCRM .env-example file. Replace the default value for MYSF_CONNECTIONSTRING with the connection string you prepared in ???.

  6. From the SFCRM compose\<version>\<topology> folder, copy the docker-compose.override.yml file to the SXP container deployment compose\<version>\<topology> folder (where the docker.compose.yml file is).

When you have prepared the installation files, you must create Docker files for each role, and build the Docker images.

Note

For more information on image assets, see the documentation on how to Add Sitecore Modules.

To build the images:

  1. Go to the Sitecore container deployment folder on your local machine. Go to the folder for the Windows version and topology you are using, for example, compose/ltsc2019/xp1. Create a folder and name it module.

  2. In the module folder, create these subfolders:

    • cm

    • xconnect

    • xdbsearchworker

  3. In each subfolder, create a new file and name it Dockerfile.

  4. In the cm folder, in the Dockerfile file, enter the following instructions:

    # escape=`
    ARG BASE_IMAGE
    ARG SFCRM_IMAGE
    ARG DEF_IMAGE
    ARG TOOLING_IMAGE
    
    FROM ${DEF_IMAGE} as def
    FROM ${SFCRM_IMAGE} as sfcrm
    FROM ${TOOLING_IMAGE} as tooling
    FROM ${BASE_IMAGE} as baseImage
    
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
    
    #Add tools from sitecore-docker-tools-assets
    COPY --from=tooling \tools\ C:\tools\
    FROM baseImage as defsfcrm
    
    # Add DEF module
    COPY --from=def \module\cm\content C:\inetpub\wwwroot
    
    # Add SFCRM module
    COPY --from=sfcrm \module\cm\content C:\inetpub\wwwroot
    
    #Copy transformation files
    COPY --from=sfcrm \module\xdttransform\cm\transforms\ C:\transforms\role
    
    # Add SFCRM connection strings in Sitecore config file
    RUN C:\tools\scripts\Invoke-XdtTransform.ps1 -Path C:\inetpub\wwwroot -XdtPath C:\transforms\role
    
    #Enable loadUserProfile to allow CMS to connect to salesforce
    RUN C:\windows\System32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.processModel.loadUserProfile:"true" /commit:apphost;
  5. In the xconnect folder, in the Dockerfile file, enter the following instructions:

    # escape=`
    ARG BASE_IMAGE
    ARG SFCRM_IMAGE
    ARG TOOLING_IMAGE
    
    FROM ${SFCRM_IMAGE} as sfcrm
    FROM ${TOOLING_IMAGE} as tooling
    FROM ${BASE_IMAGE} as baseImage
    
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
    
    #Add tools from sitecore-docker-tools-assets
    COPY --from=tooling \tools\ C:\tools\
    
    # Copy models file into index worker
    COPY --from=sfcrm \module\xconnect\content C:\inetpub\wwwroot
    
    #Copy transformation files
    COPY --from=sfcrm \module\xdttransform\xconnect\transforms\ C:\transforms\role
    
    # Update value for IndexPIISensitive and IndexAnonymousContactData in IndexerSetting
    RUN C:\tools\scripts\Invoke-XdtTransform.ps1 -Path C:\inetpub\wwwroot -XdtPath C:\transforms\role
  6. In the xdbsearchworker folder, in the Dockerfile file, enter the following instructions:

    # escape=`
    ARG BASE_IMAGE
    ARG SFCRM_IMAGE
    ARG TOOLING_IMAGE
    
    FROM ${SFCRM_IMAGE} as sfcrm
    FROM ${TOOLING_IMAGE} as tooling
    FROM ${BASE_IMAGE} as baseImage
    
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
    
    #Add tools from sitecore-docker-tools-assets
    COPY --from=tooling \tools\ C:\tools\
    
    # Copy models file into index worker
    COPY --from=sfcrm \module\xdbsearchworker\content C:\service\
    
    #Copy transformation files
    COPY --from=sfcrm \module\xdttransform\xdbsearchworker\transforms\ C:\transforms\role
    
    # Update value for IndexPIISensitive and IndexAnonymousContactData in IndexerSetting
    RUN C:\tools\scripts\Invoke-XdtTransform.ps1 -Path C:\service -XdtPath C:\transforms\role
  7. In the compose\<version>\<topology>\docker-compose.override.yml file, add build instructions for each role. If you are using, for example, the XP0 topology, the file will look like this:

    services:
      cm:
        image: sitecore-sfcrm-xp0-cm:${SITECORE_VERSION}
        build:
          context: ./module
          dockerfile: ./cm/Dockerfile
          args:
            BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
            DEF_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/sitecore-def-xp0-assets:${DEF_VERSION}
            SFCRM_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/sitecore-sfcrm-xp0-assets:${SFCRM_VERSION}
            TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION}
            environment:
              Sitecore_ConnectionStrings_mysf: ${MYSF_CONNECTIONSTRING}
    xdbsearchworker:
      image: sitecore-sfcrm-xp0-xdbsearchworker:${SITECORE_VERSION}
      build:
        context: ./module
        dockerfile: ./xdbsearchworker/Dockerfile
        args:
          BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xdbsearchworker:${SITECORE_VERSION}
          SFCRM_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/sitecore-sfcrm-xp0-assets:${SFCRM_VERSION}
          TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION}
    xconnect:
      image: sitecore-sfcrm-xp0-xconnect:${SITECORE_VERSION}
      build:
        context: ./module
        dockerfile: ./xconnect/Dockerfile
        args:
          BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xconnect:${SITECORE_VERSION}
          SFCRM_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/sitecore-sfcrm-xp0-assets:${SFCRM_VERSION}
          TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION}
  8. In the compose\<version>\<topology>\.env file, add the asset image version. For example:

    DEF_VERSION=<image version for your topology>
    SFCRM_VERSION=<image version for your topology>
    SITECORE_TOOLS_REGISTRY=scr.sitecore.com/tools/
    TOOLS_VERSION=<image version for your topology>

    Note

    You can find the image version in the Sitecore Docker Images repository.

  9. In the Windows console, go to the folder containing the docker-compose.override.yml file. Run the command docker-compose build.

  10. If you are deploying to Docker, continue with the instructions in Add the SFCRM connector module to Sitecore in Docker.

    If you are deploying to Kubernetes, continue with the instructions in Walkthrough: Adding the SFCRM connector module to Sitecore in Azure Kubernetes Service.