Friday, March 31, 2023

Sitecore JSS-Next JSS Local Environment Setup


  DOCUMENT REFERENCES


 S.NO

Document name 

Document Location  

 1

Sitecore next jss installation

https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/walkthrough--setting-up-a-development-environment-with-the-sitecore-containers-template-for-next-js.html

  

2.1   Prerequisites

Before Setting Up the local dev environment, the VM/local system should be equipped with the below softwares,

 

·       Sitecore 10.2 Instance

·       Docker for Windows

·       Windows PowerShell

·       A valid Sitecore license file.

·       Windows PowerShell 5.1. PowerShell 7 is not supported at this time.

·       The current long-term support (LTS) version of Node.js (16.15.1) version.

·       .NET Core 3.1 SDK (check your installed version with the dotnet --version command).

·       .NET Framework 4.8 SDK (see the Microsoft procedure for checking .NET Framework versions).

·       Visual Studio 2022

·       Visual Studio Code

Install System Installer 64-bit configuration



·       Visual Studio Docker Extension

·       Docker for Windows, (4.8.1) version with Windows Containers enabled.

 

 

3    Switching Docker from Linux to Windows

 

·       By default, Docker will be in Linux mode.

·       To Switch from Linux to Windows, Right click on the Docker icon in the taskbar and select “switch to Windows containers”. After successfully switching to Windows containers, the docker status looks like below

 


 

·       Restart the PowerShell windows and Docker if it opened already.

4     Installing the Sitecore container for Next.js Application

4.1        Removing All Unused Docker Objects

The docker system prune command removes all stopped containers, dangling images, and unused networks. Run the below command in cmd under C:\Users\<User name> 

“Docker system prune --all” 

 

4.2        Creating a Project Folder

·       Create a folder named “ABC 

 

4.3        To Install JSS CLI Utility

·       Open the cmd and navigate to the path C:\ ABC

·       Run the below command. This allows us to run JSS CLI commands

    “npm install -g @sitecore-jss/sitecore-jss-cli” 

 

 

4.4        To Install .NET tool

·       Open the cmd and navigate to the path C:\ ABC

·       Run the below command. This allows us to install dotnet tool. Dotnet tool installs sitecore.nextjs.gettingstarted template.

 

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

 

4.5        To Install JSS Project solution

·       Open the cmd and navigate to the path C:\ ABC

·       Run the below command. This command helps us to create project solutions with respective folders.

                    “dotnet new sitecore.nextjs.gettingstarted -n ABC” 

Note:

Once Step 4.5 runs successfully, it will ask us a few questions. Answer the questions asked with answers mentioned in the above screenshot: 

·       Choose -> REST

·       Choose -> SSG

·       Sitecore localhost URL -> cm.ABC.localhost

·       Additional language ->

·       Enter

4.6        Prepare the Sitecore container environment

·       Open the Windows PowerShell in Administrator mode

·       Go to C:\ ABC \XYZ and run the init.ps1 script using the below command

               .\init.ps1 -InitEnv -LicenseXmlPath "C:\ ABC\sitecore-license\license.xml" -AdminPassword "Password12345"

     

4.7        Download and Install Sitecore Docker images and Containers

·       Open the Windows PowerShell in Administrator mode

·       Go to C:\ ABC \XYZ and run the .\up.ps1 script using the below command

 

            .\up.ps1

 

4.8        Sitecore Initial login

·       Once step 4.7 runs successfully, we will be getting a prompt window to do a Sitecore login.

·       When prompted in our browser, log in to Sitecore and accept the device authorization.

 

4.9        Remedy the certificate error

All the scripts of up.ps1 will run and then it will fail in the last step 4.7 “jss deploy items -c -d” with a certificate error.          

        To resolve the above certificate error, we need to follow the below steps

·       Open the cmd

·       Go to C:\ ABC \ XYZ \src\rendering and run the below command

jss deploy items -c -d --acceptCertificate <Thumbprint>

         

To confirm the Certificate error being resolved. Please check the following steps

·       The yellow highlighted should be replaced with your local certificate thumbprint.

                             




                                        


4.10     Sitecore Publish

·       Open the cmd

·       Go to C:\ ABC \XYZ\src\rendering and run the below command

            dotnet sitecore publish

 

4.11     Sitecore Login page

·       Once Step 4.10 runs successfully

·       we can log in to Sitecore using Admin credentials and the Sitecore launchpad will open       

                             

4.12     Sitecore Next JSS page

To Confirm Sitecore's next jss working in connected mode.

·       Go to  https://www.ABC.localhost/ 

                                


 

                                                                          Happy Learnings!                


 

 

 

 


Friday, March 3, 2023

Script to issue/renew local SSL certificates and update configuration for Sitecore sites

 How to renew the SSL certificates for Sitecore websites?

This blog is created as a spike to help people who are looking for an easy solution for renewing the SSL certificates.

One of the community contributors has created the PowerShell script to renew the SSL certificates and posted it on the Sitecore community site.

Please find the reference link given below,

https://community.sitecore.com/community?id=community_question&sys_id=66ab9a391be2c19038a46421b24bcbe4


                    

                                                            Happy learning!

How to Create a Public Link Using the Sitecore Content Hub REST API

Creating a public link using the Sitecore Content Hub REST API is a straightforward process that enables you to share content externally whi...