Monday, 28 August 2023

Step by step guide to install and configure Sitecore CLI

August 28, 2023 0

Sitecore Serialization refers to a process within the Sitecore web content management system (CMS)that allows developers to save and retrieve Sitecore items and their associated data in a structured format. This process is commonly used for version control, content deployment, and collaboration in Sitecore development projects.

Sitecore Serialization essentially involves converting Sitecore items, which are the building blocks of content within the CMS, into files that can be stored in a version control system, such as Git. These files typically include configuration data, templates, layouts, renderings, and other relevant information about the Sitecore items. 

There are many tools available that provide Sitecore Serialization for content management in different types of machines and environments.

  • TDS
  • UNICORN
  • SITECORE CLI

The objective of this post is to provide a step-by-step guide to setting up Sitecore CLI in your solution.

Prerequisites:

Please ensure that you are working with Sitecore version 10.0 or later, as Sitecore CLI is not available for earlier versions. Additionally, you will need to have .NET Core 3.1 or a later version installed on your server. 

Step 1: Install Sitecore Management Services package 

·        Download Sitecore Management Services package from the URL: https://dev.sitecore.net/Downloads/Sitecore_CLI.aspx 

·        Now, Install the package on Sitecore instance using Sitecore Control Panel > Install a package.


Step 2: Install the Sitecore CLI

The Sitecore CLI requires .NET Core. Open a command prompt and run "dotnet --list-sdks". If you see the version as 3.1 (For me, the version is 6) or above, you are ready to proceed.

Now, open PowerShell as an administrator and navigate to the Visual Studio solution folder. Install the CLI by executing the following script:

dotnet new tool-manifest
dotnet nuget add source -n Sitecore https://sitecore.myget.org/F/sc-packages/api/v3/index.json
dotnet tool install Sitecore.CLI --add-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json


Step 3:Initialize Sitecore CLI

Next, initialize your new serialization project by entering the following in the terminal:

dotnet sitecore init


This action will generate the Sitecore.json file.


Step 4: Connecting to Sitecore

To connect to a Sitecore instance type in the following command:

dotnet sitecore login --authority https://<Sitecore identity server> --cm https://<Sitecore instance> --allow-write true
Upon executing the above command, a login screen will open up in your browser.





After successfully logging in, you are ready to perform serialization (push, pull), and database publishing using the commands below.


You can use either the "ser" or "serialization" command to pull or push the data.
dotnet sitecore ser pull
dotnet sitecore ser push


During the setup process, I encountered the following error related to the installation of the CLI plugin version. Please find the error details and the solution below:

Solution: Check the plugin versions using the "Sitecore plugins list" command. Then update plugins with the latest version using the following command:

Sitecore plugins init --overwrite


Conclusion

To serialize Sitecore items, you can install and configure Sitecore CLI by following the steps provided above.

Thursday, 17 August 2023

Setup issue with Sitecore 10.3 in Windows 11 development machine

August 17, 2023 0


I was doing  Sitecore 10.3 setup in my local development environment. And I encountered the bellow  issue while doing the setup-

Problem Statement 1:

Certificate chain was issued by an authority that is not trusted.



Solution:

After attempting to address the issue, I explored suggestions on Sitecore Stack Exchange (installation - Sitecore 9.3 Installing on Windows 11 returns "certificate chain was issued by an authority that is not trusted." error - Sitecore Stack Exchange). Implementing these suggestions proved effective in resolving the problem. The details are provided below:

The problem stemmed from the "sitecore-XP0.json" file. The root of the issue lay in the presence of InvokeSqlcmd statements within the file. To rectify this, it was necessary to include "TrustServerCertificate": true within those statements.



Furthermore, within SQL Server Management Studio (SSMS), ensure to check the "Trust server certificate" checkbox.



Once all these steps have been successfully completed, you are ready to initiate the Sitecore 10.3 installation process.