/mvc-to-headless

Learn how to transform your Sitecore MVC site into a Headless site.

Primary LanguageCSSMIT LicenseMIT

Running the Example

Prerequisites

Ensure you have followed the steps listed on the installation documentation.

The Helix examples assume you have some experience with (or at least an understanding of) Docker container-based Sitecore development. For more information, see the Sitecore Containers Documentation.

Ensure the machine you are running the below has latest Node JS installed.

Initialize

Open a PowerShell administrator prompt and run the following command, replacing the -LicenseXmlPath with the location of your Sitecore license file.

.\init.ps1 -LicenseXmlPath C:\License\license.xml

You can also set the Sitecore admin password using the -SitecoreAdminPassword parameter (default is "b").

This will perform any necessary preparation steps, such as populating the Docker Compose environment (.env) file, configuring certificates, and adding hosts file entries.

Build the solution and start Sitecore

Run the following command in PowerShell.

.\up.ps1

The process involves downloading necessary Docker images, installing NextJs and its dependencies along with Sitecore runtime images, and finally launching the containers. In the given scenario, the topology being used is Sitecore Experience Management (XM1).

Once complete, you can access the instance with the following.

Publish

The serialized items will automatically sync when the instance is started, but you'll need to publish them.

Login to Sitecore at https://cm.basic-company-unicorn.localhost/sitecore and perform a site smart publish. Use "admin" and the password you specified on init ("b" by default).

For the Products page to work, you'll also need to Populate Solr Managed Schema and rebuild indexes from the Control Panel. You may also need to docker-compose restart cd due to workaround an issue with the Solr schema cache on CD.ad

You should now be able to view the Basic Company site at https://www.basic-company-unicorn.localhost and Next JS Rendering Host at https://rendering.basic-company-unicorn.localhost

Stop Sitecore

When you're done, stop and remove the containers using the following command.

docker-compose down