Sitecore upgrade from 8.1 XP to 10.4 XM Scaled -Part 2

 Part 1 of this upgrade article covered the checklist needed for performing the upgrade activity.

In this blog, we will explore how to configure a local 8.1 instance that will be helpful for the developer to validate and play with it.

One of the important things in this local setup is getting the prod database restored in the local SQL Server and updating the vanilla Sitecore 8.1 instance to point to this database by updating the connection string.

Solr Setup:

The easiest way to setup Solr for 8.1 is below

  • Download the solr from http://archive.apache.org/dist/lucene/solr/4.10.4/solr-4.10.4.zip
  • Extract the files to C:\Program Files\solr-4.10.2 or any folder
  • The default Solr does not have Sitecore cores, so download already created cores from here
  • Place all the download cores in the following folder C:\Program Files\solr-4.10.2\example\solr
  • Open the Command prompt and navigate to this root Solr folder C:\Program Files\solr-4.10.2\bin and run solr start command to see if solr starting on port 8983

  • Once the solr works fine with the following URL http://localhost:8983/solr/#/ 

  • Once we verified this solr works with HTTP and using the command, now let us make this solr automatically run as a Windows service in HTTPS with the help of NSSM
  • Download NSSM from here
  • once downloaded then extract the NSSM and open the folder in the command prompt based on our Windows 32bit or 64 bit, in my case I opened the 64-bit folder from the NSSM

  • Update the Path and StartUp director with the relevant details
  • Path= C:\Program Files\solr-4.10.2\bin\solr.cmd
  • StartUp directory = C:\Program Files\solr-4.10.2\bin
  • Arguments = start -f -p 8983
  • The above minimum setting is more than enough for Solr to be automatically started using the Windows service
Find all the layouts, rendering, and templates in the 8.1, for comparison once we do IAR (Sitecore Update Tool) this will help to ensure nothing is deleted during the process of Sitecore Update Tool

Scripts for Getting all the Templates and their fields.

$itemsArray = @()
$templates = Get-ChildItem -Path "master:" -ID { 3C1715FE-6A13-4FCF-845F-DE308BA9741D } -Recurse 
$standard = '{1930BBEB-7805-471A-A3BE-4858AC7CF696}'
foreach ( $template in $templates ) {
    $available = ""
    $available = Test-BaseTemplate -Item $template -Template "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"
   
    if ($available -eq 'True') {
        $templateandFields = [PSCustomObject]@{
            "Path"         = $template.Paths.Path
            "TemplateName" = $template.Name
            "FieldName"    = ""
            "Section"      = ""
          
        }
        write-host inside $template.Name
    }
    else {
        $available = 'False'
        if ($template.TemplateId -ne '{E269FBB5-3750-427A-9149-7AA950B49301}') {
            write-host outside $template.Name
            $templateandFields = [PSCustomObject]@{
                "Path"         = $template.Paths.Path
                "TemplateName" = ""
                "FieldName"    = $template.Name
                "Section"      = ""                 
            }
        }
        else {
            $templateandFields = [PSCustomObject]@{
                "Path"         = $template.Paths.Path
                "TemplateName" = ""
                "FieldName"    = ""
                "Section"      = $template.Name
            }
        }
    }         
    if ( $templateandFields -ne $null) {
    
        $itemsArray += $templateandFields
    }
}
$itemsArray | Export-Csv -Path "D:\nelson\latest_published_items.csv" -NoTypeInformation -Encoding UTF8
Write-Host "Export completed successfully."

Scripts for Getting all the Renderings and their fields.
$itemsArray = @()
$renderings = Get-ChildItem -Path "master:" -ID { 32566F0E-7686-45F1-A12F-D7260BD78BC3 } -Recurse |  
Where-Object { $_.TemplateId -eq '{99F8905D-4A87-4EB8-9F8B-A9BEBFB3ADD6}' -or 
    $_.TemplateId -eq '{2A3E91A0-7987-44B5-AB34-35C2D9DE83B9}' } 
$standard = '{1930BBEB-7805-471A-A3BE-4858AC7CF696}'
foreach ( $rendering in $renderings ) {
    
    $renderingItems = [PSCustomObject]@{
        "Path"          = $rendering.Paths.Path
        "RenderingName" = $rendering.Name
          
    }
    write-host inside $rendering.Name                
    if ( $renderingItems -ne $null) {    
        $itemsArray += $renderingItems
    }
}
$itemsArray | Export-Csv -Path "C:\nelson\latest_published_items.csv" -NoTypeInformation -Encoding UTF8

Write-Host "Export completed successfully."

  • After exporting all the templates and rendering details using the above Powershell scripts for future validation, We can run the Sitecore.UpdateApp.exe.
  • Before doing this I created some new fields in Sitecore 8.1 on some of the default templates to see whether any customization on the default templates was removed during the upgrade process.
Sitecore UpdateApp:
  • Download the following upgrade guide from the Sitecore portal and follow the steps mentioned there, I have provided the same steps here for more clarity
  • Extract the folder and place the license file to the data folder in it
  • Update the connectionstring.config file for master, core, and web in the extracted folder, which should be the same connectionstring used in Sitecore 8.1
  • Once all the configuration is done then open the command prompt in administrator mode, navigate to this extracted root folder, and try to execute the following command to move the default items to the resource file



Database scripts Upgrade:
  • Goto upgrade configuration file extract the Database upgradescripts.zip and try to run the scrips in core, master, and web in order.
  • Execute the following in the core  (A, C, H)
    • Script A – CMS_core_master_web8x.sql
    • Script C – CMS_core.sql
    • Script H – CMS_security.sql
  • Execute the following in master (A, D)
    • Script A – CMS_core_master_web8x.sql
    • Script D – CMS_master.sql
  • Execute the following in web database (A,E)
    • Script A – CMS_core_master_web8x.sql
    • Script E – CMS_web.sql
  • Clear cache
From now onwards we will be seeing the error in Sitecore 8.1 instance, in which all the default items are removed, so we can't use the Sitecore 8.1, so we need to make sure that we do all the necessary things before running the scripts.

Now setup the Sitecore 10.4 instance and update the connection string to point to this upgraded database(master, core, and web)
Verify that the new fields that we created before are still there, actually, those new fields are available, and there is no loss of fields, etc.
We can also use the Excel sheet created by the PowerShell to validate that all the fields are still available here.

Now we will see the code upgrade challenges and fixes.

Steps for Sitecore and Solution Upgrade Checklist

Let's learn and grow together, happy programming 😊

Comments

Popular posts from this blog

Custom Item Url and resolving the item in Sitecore - Buckets

Fixing Sitecore Buckets folder path - Items created after 12 AM server time zone

Sitecore Search - API Crawler with Edge Pagination