How to setup Sitecore 10.2 MVP Site and deploy changes from VS Sln to Docker Instance - Final Part

In this blog article, I setup the Sitecore 10.2 MVP project and then, make cshtml and code changes to check if view-related changes and pipeline processor-related changes are reflected in the Docker instance.

One thing I like about working on opensource Github projects is, there is no one to give you context. As a developer, it is always a good exercise to understand what you have on-hand and work-up from there. 

Also, if you add a couple of tools/technologies like Docker, the mix becomes eclectic! Recently, as part of setting up the latest Sitecore MVP 10.2  project locally, I faced a couple of issues and had to resolve those to get the instance up and running locally. Although I was involved in making the Sitecore MVP site compatible with 10.1 Docker instance earlier this year, the site has undergone a lot of changes since then and so, I was left with understanding what has been added since then and then make it work in my local environment.

Out of the two issues, this blog article covers the second series while the first one is in my earlier blog

So, this blog continues with my earlier blog of trying to setup the containers using .\up.ps1:

My CM instance was not reachable and I received the following error:

Waiting for CM to become available...

Invoke-RestMethod : Unable to connect to the remote server

At C:\MVP-Site\up.ps1:26 char:19

+ ...   $status = Invoke-RestMethod "http://localhost:8079/api/http/routers ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc

   eption

    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand


Tried docker-compose up -d and that resulted in the following message:

Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine' cannot be mapped. Only directories can be mapped on this platform

In the docker desktop settings, unchecked the following option, re-executed .\up.ps1 and the above issue was gone


The above fix helped in launching all containers except  the infamous traefik container failing with the following error: 

ERROR: for traefik  Container "a07af9c21b19" is unhealthy.
ERROR: Encountered errors while bringing up the project.
Waiting for CM to become available...
Invoke-RestMethod : Unable to connect to the remote server
At C:\MVP-Site\up.ps1:26 char:19
+ ...   $status = Invoke-RestMethod "http://localhost:8079/api/http/routers ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand



Based on the above error, I checked my last year's blog and checked if I had enough space and IIS setup! 

Note that Sitecore Docker instance needs a free space of 40 GB.

In spite of all these precautions, the traefik container was still unhealthy!

On checking the Docker logs, I couldn't infer much. So, I hard reset my local branch to an old commit to check if that has some impact. Personally I love the hard-reset option since it shows the true power of git!


When I executed the .\up.ps1 on an old commit for 10.1 instance I committed last year, the site was up and running without any issues and I could see that CM/ID server was getting  launched automatically for authorization:


In case of the latest version, CM wasn't getting launched, when I checked the .env file git history I could find a few new OKTA variables added after my changes earlier this year. This is where the importance of readme  page also comes in and I'm a bad reader!




So, this led me to think in lines of providing the OKTA variables and then trying compose up. So, I setup the Sitecore OKTA application integration

Now, back in the .env file, made the following changes to OKTA-related vars:


In the above list, ensure to prefix your domain name with https:// 

Then, as ever, did the usual docker rituals;

1. Compose down
2. Run clean.ps1 in the docker sub-folder
3. Compose Up

Now, traefik container was created and CM instance was able to reach the id server  to my relief:



Much needed publish:


Sitecore 10.2 MVP  Site running locally:


Based on the requested github enhancement, this is the current not found page that must look similar to other pages in the site:




Before working on the actual enhancement, I wanted to compile and publish changes from the VS sln to see if it reflects on the Docker instance.

So, open mvp.sln in the root folder, in my case it is C:\MVP-Site-new and I managed to find the concerned cshtml based on a hunch:


Next, 

1. Make changes to the above  cshtml and check the end-result
2. Add a patch config file and check if it is part of showconfig.aspx

Made the following changes in the sln:
1. In cshtml:


2.  The new pipeline processor:

Build the sln and ensure no compilation errors.

In PowerShell window, did a docker compose down, ran clean.ps1 and then executed .\up.ps1

End-result:

The view:


The pipeline patched:

I always feel that it is tough to setup and replicate an issue. Once you do it, fixing is not difficult. 

The next goal is to do the actual deep-dive and cover the enhancement of ensuring that the not found page is picked from CMS similar to other pages.

Comments

Popular Posts