Setting up Habitat Project with Sitecore 9.2

After setting up my sitecore 9.2 instance , i then decided to setup the habitat project. I stumbled upon this Habitat Wiki page. Based on the same, I cloned the Habitat git repo. The next issue i faced was when loading the VS solution in VS 2019. The projects in the solution are compatible with .net framework 4.7.1  while my machine didn't have the same. So, i downloaded and tried installing .net framework 4.7.1 when I got this warning -

.NET Framework 4.7.1 or a later update is already installed on this computer
Also, I opened the habitat solution in Visual Studio 2019 and downgraded from .net framework 4.7.1 to 4.6.1 while loading the solution. Although the solution loaded, noticed a list of errors. So, decided to fix the .net framework issue. I tried to switch over to a higher version of .net framework - 4.7.2 in my case but that just added to the list of errors.
Then, i noticed that there is a Microsoft .NET Framework 4.7.1 Developer Pack download. The installation of this pack was successful. Now, i reset all the changes through GIT Extensions and re-opened my solution. This time, .NET Framework 4.7.1 can be seen in the framework list and the projects too loaded fine without any errors.

Rebuild Solution - works fine.
Since i already had the SIA downloaded for my Sitecore 9.2 installation, I  Copied over the required installation files to the assets folder based on the list in Habitat Wiki page
Since i cloned all my habitat code in c:\projects\habitat, i modified the settings.ps1 to reflect the correct solr url.
Run the install-xp0 ps script in admin mode.
I got this error -

Set Enable contained databases failed
Invoke-Sqlcmd : Login failed for user 'sa'.
At C:\projects\Habitat\install-xp0.ps1:55 char:9
+         Invoke-Sqlcmd -ServerInstance $SqlServer `
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
    + FullyQualifiedErrorId : SqlExceptionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
The above error is probably because the credentials to access my sql server is incorrect in settings.ps1 since this still has the default values. 


So, modified the same and re-run the ps script. This time the script execution gets through the sql db access step.
Then, i hit this error -
Install-SitecoreConfiguration : Could not complete request for https://solr:8984/solr - Unable to connect to the
remote server
At C:\projects\Habitat\install-xp0.ps1:148 char:9
+         Install-SitecoreConfiguration @singleDeveloperParams *>&1 | T ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

When i browsed https://solr:8984/solr, the solr page wasn't appearing. So, went and restarted the solr-7.5 service in the services list.
Now, i could reach the solr page. Note that the version is 7.5.0.

Now, re-run the ps script and solr seems to stop and start fine this time.
Cores created fine.
Run npm install in the same ps window (at the same folder since its the root) since its already in admin mode.

In case if npm install is unrecognized, install nodejs and add path to environment variables.

Switch back to Visual Studio 2019. Open View -> Other Windows -> Task Runner Explorer. Use the refresh button in the window to list the tasks.
Right click the default task -> Run to build and deploy the habitat sln.
During my first run, the process exited with a status code of 1 or, in other words, errored out midway. So, I stopped all the IIS processes related to this website in inetmgr and also the related app pool processes and ran the default build again to get past the error. 
Then, I got a 404 error at Sync-Unicorn step because understandably the site was stopped or not found. So, I restarted the IIS processes now and, ran just the Sync-Unicorn step and the site then popped fine.
Voila, Sitecore instance here.



Comments

Popular Posts