Setting up Sitecore Getting Started Template

Today I am going to explain the process of installing the Getting Started Template that helps developers to learn all the new concepts that are included with Sitecore 10. These new concepts are Sitecore on Containers, Sitecore Content Serialization, and ASP.NET Core Rendering SDK. The Getting Started Template is a Sitecore 10 ASP.NET Core project which is set up on Containers (Docker) and also uses the concept of Content Serialization for deploying content items.

The Getting Started Template is not implemented according to Sitecore Helix conventions for solution architecture.

Installation of Pre-requisites

.NET Core 3.1 SDK

It is necessary for building and running cross-platform web, server, and console applications. Moreover, Sitecore Serialization commands are also included in .NET Core 3.1 SDK. You can check the version of your .NET core using the below command.

dotnet --list-runtimes


Docker Desktop

Docker Desktop is used for easily building, sharing, and running containers on Windows as you are allowed to do with Linux.

Note: After installing Docker Desktop you need to switch Docker Desktop to Windows Containers.


PowerShell 5.1

You need PowerShell 5.1 version as the PowerShell 7 version is not supported. To check the version of PowerShell you can run the below command in PowerShell.

Get-Host | Select-Object Version


.NET Framework 4.8 SDK

.NET Framework SDK is included in Windows Updates. It is recommended to use Windows 10 for working with Getting Started Template provided by the Sitecore. The .NET Framework 4.8 SDK was included as part of Windows 10 with May 2019 and November 2019 Update 528040 and Windows 10 with May 2020 Update 528372.

To check the version of your system, open the Registry Editor (Regedit) and open the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. The entry named Release should contain the value 528040 or 528372 for .NET Framework 4.8.


Visual Studio 2019

Visual Studio is used for performing more advanced development tasks and to work with a Visual Studio project created by Sitecore Getting Started Template.

Steps to install Getting Started Template

Firstly create a folder where you want to have your project (Getting Started Template).


Now open the PowerShell in admin mode and point to the location of the folder you created in the last step.


Now in the PowerShell window run the below command.

dotnet new -i Sitecore.DevEx.Templates --nuget-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json


The dotnet tool command does not provide feedback about the successful installation. But the install command ends by listing all of the installed templates and if the list includes sitecore.aspnet.gettingstarted then the installation is successful.

Now before installing the Getting Started Template we must check if any services are running on desired ports or not.

Firstly, check if you have an Internet Information Server running on port 443: Use the below command in PowerShell to check.

Get-Process -Id (Get-NetTCPConnection -LocalPort 443).OwningProcess


If Internet Information Server is running at 443, you must stop it: Use the below command in PowerShell to stop the IIS.

iisreset /stop


Now, check if you have Solr or any other service running on port 8984. Use the below command in PowerShell to check.

Get-Process -Id (Get-NetTCPConnection -LocalPort 8984).OwningProcess


Note: I got this error because there is no service running on port 8984.

If Solr or any other service is running at 8984, you must stop it: Use the below command in PowerShell to stop the service.

Stop-Service -Name <the name of your service>


Now in the same PowerShell use the below command to create project solutions and project files. In my case, the project name is "SC10Project".

dotnet new sitecore.aspnet.gettingstarted -n SC10Project


During this command, you may see a request for doing dotnet toll restore which is used for setting up the Sitecore CLI. So you need to press y to confirm.

Once the command is completed you can see a folder added with the name SC10Project. And inside it, all the necessary files required for running the project are added.


Now it's time to supply the path of the Sitecore license and admin password through the command.

But first, you have to change the path in your PowerShell to the project folder created in the last step and then run the below command.

.\init.ps1 -InitEnv -LicenseXmlPath <path to your license.xml file> -AdminPassword <your Sitecore admin password>


It is possible that you received an error while running this command that is because the execution policy is restricted for the current user. Now execute the below command to bypass the execution policies.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass


So after updating the execution policy rights try to run the script again. You may get a warning to update the NuGet Provider, so ensure that it is updated. It will also get asked to install a certificate so click Yes to continue the installation.

The last step is to run the up script which is used to create the containers for the Sitecore environment. The up script command not only creates the containers but also de-serializes the sample items into the Sitecore instance using the new Sitecore Content Serialization CLI. Use the below command to create containers.

.\up.ps1


Note: This process can take a lot of time.

Once the command is completed then you may see the Sitecore Instance opening automatically.


When you login into the Sitecore Instance you see device authorization. Click "Yes, Allow" to accept the device authentication.


Now, wait for the script to open browser tabs for Content Management and the rendering host.



Some commands necessary to work with Sitecore on Docker

For Cleaning or Removing the Sitecore instance on Docker run the following command. Run Windows PowerShell as an admin at the path of your project. Now execute the below command.

docker-compose down


For Stopping Sitecore instance without losing the changes run the following command. Run Windows PowerShell as an admin at the path of your project. Now execute the below command.

docker-compose stop


References



That's all for today
Chirag Goel

I am a developer, likes to work on different future technologies.

Post a Comment (0)
Previous Post Next Post