Automated Deploy with Octopus - XConnect

6/18/2020 Octopus CI/CD XConnect Sitecore

This article goes over the XConnect deploy setup through Octopus

OMG look how many ppl have commented

If you have not already, please read the Intro of this Article series. Otherwise, this may seem rather vague and little confusing. The XConnect project is probably the most complicated of the automated deploys due to the installation of the Window Services, making sure they are turned off, and ensuring the Client Certificate thumbprint matches. If needed, the XConnect services can be separated out into their own projects if you choose to install them on separate servers. You just have to make sure the host entries are added.

Package Information

This project uses four of the packages stored in the Library

  1. XConnect - For the XConnect Site
  2. XConnectAutomationEngine - One of the three Windows services
  3. XConnectIndexWorker - One of the three Windows services
  4. XConnectProcessingEngine - One of the three Windows services

Configuration

Project Variables (aside from the global variables)

  1. allowInvalidClientCertificates: (Set this to true if you are feeling a little risky. Otherwise, false)
  2. configurationEnvironment: (Varies. Development or Production)
  3. indexWorkerServiceExecutable: Sitecore.XConnectSearchIndexer.exe
  4. indexWorkerServiceName: #{siteName}-IndexWorker
  5. indexWorkerServicePath: #{deployPath}\App_Data\jobs\continuous\IndexWorker
  6. marketingAutomationServiceExecutable: Sitecore.MAEngine.exe
  7. marketingAutomationServiceName: #{siteName}-MarketingAutomationService
  8. marketingAutomationServicePath: #{deployPath}\App_Data\jobs\continuous\AutomationEngine
  9. processingEngineServiceExecutable: Sitecore.ProcessingEngine.exe
  10. processingEngineServiceName: #{siteName}-ProcessingEngineService
  11. processingEngineServicePath: #{deployPath}\App_Data\jobs\continuous\ProcessingEngine
  12. xdbSolrCore

Files (for XConnect Package)

  1. AppSettings.config - Located under App_Config
  2. ConnectionStrings.config - Located under App_Config

Files (for XConnectAutomationEngine Package)

  1. AppSettings.config - Located under App_Config
  2. ConnectionStrings.config - Located under App_Config

Files (for XConnectIndexWorker Package)

  1. AppSettings.config - Located under App_Config
  2. ConnectionStrings.config - Located under App_Config

Files (for XConnectProcessingEngine Pagakage)

  1. AppSettings.config - Located under App_Config
  2. ConnectionStrings.config - Located under App_Config

Release Process

The general setup of this release process starts off with turning off the XConnect services if they exist. Because since I am deploying the XConnect site to the same relative path the Services will be in and the deploy path will be purged beforehand, the deploy will fail if the services are still running. So here are the steps:

  1. Install Certificates (click title for more info) 
    1. Install Root Certificate to Trusted Root Certification Authorities
    2. Install Storefront Certificate to Personal store
    3. Install XConnect Certificate to Personal store
    4. Install XConnect Client Certificate to Personal store
    5. Install Identity Certificate to Personal
  2. Add Host Entries (click title for more info) 
    1. Add XConnect Host entry
  3. Stop Services
    1. Stop Marketing Automation Service (uses Windows Service - Stop step template under the Octopus public library)
    2. Stop Processing Automation Service (uses Windows Service - Stop step template under the Octopus public library)
    3. Stop Index Worker Service (uses Windows Service - Stop step template under the Octopus public library)
    4. Ensure Services are off (a custom Powershell Script I created as a fail-safe to make sure the services are off)
  4. Deploy Site (click title for more info)
    1. Deploy XConnect Site 
      1. Package ID: XConnect
      2. Install to: #{deployPath}
      3. Web site Name: #{siteName}
      4. Application Pool Name: #{siteName}
      5. Add host bindings for https only via host name using the xConnectCert certificate (NOT the xConnectClientCert)
      6. Custom Deploy Scripts
        1. Post-deployment script to set configurations for the application pool
      7. Substitute Variables in Files: **\*.config
    2. Grant Access to Users (Using the File System - Grant Permissions step template)
      1. Items: #{deployPath}
      2. Read Users: #{applicationPoolUser},LOCAL SERVICE
      3. Write Users: #{applicationPoolUser},LOCAL SERVICE
      4. Modify Users: #{applicationPoolUser},LOCAL SERVICE
  5. Add XConnect Services
    1. Add Index Worker Service (uses Deploy a Windows Service step template)
      1. Package Id: XConnectIndexWorker
      2. Install to: #{indexWorkerServicePath}
      3. Windows Service
        1. Service name: #{siteName}-IndexWorker
        2. Display name: Sitecore #{siteName} - Index Worker Service
        3. Description: Sitecore #{siteName} - Index Worker Service
      4. Windows Service: Executable
        1. Executable path: #{indexWorkerServicePath}\#{indexWorkerServiceExecutable}
        2. Arguments: -service
      5. Windows Service: Startup
        1. Service account: Local Service
        2. Start mode: automatic
        3. State: Default (based on start mode)
        4. Substitute Variables in Files: **\*.config
    2. Add Marketing Automation Service (uses Deploy a Windows Service step template)
      1. Package Id: XConnectAutomationEngine
      2. Install to: #{marketingAutomationServicePath}
      3. Windows Service
        1. Service name: #{siteName}-MarketingAutomation
        2. Display name: Sitecore #{siteName} - Marketing Automation Service
        3. Description: Sitecore #{siteName} - Marketing Automation Service
      4. Windows Service: Executable
        1. Executable path: #{marketingAutomationServicePath}\#{marketingAutomationServiceExecutable}
        2. Arguments: -service
      5. Windows Service: Startup
        1. Service account: Local Service
        2. Start mode: automatic
        3. State: Default (based on start mode)
        4. Substitute Variables in Files: **\*.config
    3. Add Processing Engine Service (uses Deploy a Windows Service step template)
      1. Package Id: XConnectProcessingEngine
      2. Install to: #{processingEngineServicePath}
      3. Windows Service
        1. Service name: #{siteName}-ProcessingEngine
        2. Display name: Sitecore #{siteName} - Processing Engine Service
        3. Description: Sitecore #{siteName} - Processing Engine Service
      4. Windows Service: Executable
        1. Executable path: #{processingEngineServicePath}\#{processingEngineServiceExecutable}
        2. Arguments: -service
      5. Windows Service: Startup
        1. Service account: Local Service
        2. Start mode: automatic
        3. State: Default (based on start mode)
        4. Substitute Variables in Files: **\*.config