Walkthrough: Using the Getting Started template
Sitecore provides a Getting Started template for Sitecore developers that want to try out Sitecore Headless Development with ASP.NET and Sitecore containers. It can be used to get you started quickly or to kickstart new customer projects.
The template does not implement Sitecore Helix conventions for solution architecture. As you begin building your Sitecore solution, we recommend that you review Sitecore Helix and the Sitecore Helix Examples for guidance on implementing a modular solution architecture.
The template includes:
-
A Docker environment for a Sitecore XP0 topology with an ASP.NET rendering host.
NoteThe included
docker-compose.ymlfile is a stock XP0 environment from the Sitecore Container Support Package. All changes for this solution are included in thedocker-compose.override.ymlfile. -
Serialized items for a one-page sample site. See the
src\Items.module.configfile for details. -
An MSBuild project named
Platformfor deploying configuration and code into the Sitecore Content Management role. See thesrc\platformfolder for details. -
An MSBuild project named
RenderingHostfor an ASP.NET rendering host. See thesrc\renderingfolder for details.
To create a solution from the Getting Started template, complete the following procedures:
Install the prerequisites
Before you can install the template and create a solution, make sure that you have these software components installed on your workstation:
-
.NET Core 3.1 SDK (check your installed version with the
dotnet --versioncommand) -
.NET Framework 4.8 SDK (see the Microsoft procedure for checking .NET Framework versions)
-
Docker for Windows (with Windows Containers enabled)
-
PowerShell 5.1 (PowerShell 7 is not supported)
See the Sitecore Containers documentation for more information on system requirements.
Install the template
You download and install the template in your file system. Afterward, you can create solutions based on the template.
To install the template:
-
Open PowerShell with administrator privileges.
-
Run the following command:
The dotnet tool does not provide obvious feedback that the installation was successful. However, the install command ends by listing all of the installed templates. If the install is successful, the list includes sitecore.aspnet.gettingstarted.
Create the MyProject solution
You can name your solution anything you like, but in this example, we name the solution MyProject.
To create the MyProject solution:
-
Open PowerShell with administrator privileges.
-
Check if you have Internet Information Server running on port 443:
If you do, you must to stop it:
-
Check if you have Apache Solr or any other service running on port 8984:
If you do, you must stop it:
Or, if you have started it with Non-Sucking Service Manager, stop it with this command:
-
Go to your solutions folder and create the
MyProjectsolution and project: -
Go to the
MyProject/folder. -
You use the provided
init.ps1script to prepare the following items for the Sitecore container environment:-
A valid/trusted wildcard certificate for
*.myproject.localhost. -
The hosts file entries for
myproject.localhost. -
The required environment variable values in the
.envfile for the Sitecore instance.
Important-
Using non-Latin characters in the project/folder name can give unexpected results because of character limitations in Docker registry names and URLs.
-
See the Sitecore Containers documentation for more information on these preparation steps.
To prepare the Sitecore container environment:
Provide an absolute path for the license file.
Out of the box, this example doesn't include a reference to the
.envfile in the.gitignorefile. This is so that developers can share initialized environment variables. If you check your.envfile into source control, other developers can prepare a certificate and hosts file entries by simply running theinit.ps1script.If your Sitecore solution and/or its data are sensitive, we recommend that you keep the
.envfile excluded from source control and provide another means of centrally configuring the information within. -
-
Download the Sitecore Docker images and install the containers:
The template creates the following entries in the Windows
hostsfile. Each of them points to a Sitecore container:-
https://id.myproject.localhost/points to themyproject_id_1container with a Sitecore instance hosting Sitecore Identity Server. -
https://cm.myproject.localhost/points to themyproject_cm_1container with a Sitecore instance hosting Content Management, Content Delivery, and Sitecore Layout Service. -
https://www.myproject.localhost/points to themyproject_rendering_1container with the rendering host.
-
-
Wait for the script to open a browser tab for the Sitecore Identity Server. Then log in and accept the device authorization.
-
Wait for the script to open browser tabs for Content Management and the rendering host.