Setting up Sitecore MVP Site running on Docker Containers

The Sitecore MVP github page has straightforward instructions but I had a few setup issues and decided to blog those.

When running init.ps1 received the following error -

Error:

C:\MVP-Site-master\init.ps1 : The term 'git' is not recognized as the name of a cmdlet, function, script file, or

operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

again.

At line:1 char:1

+ .\init.ps1 -InitEnv -LicenseXmlPath "C:\license\license.xml" -AdminPa ...

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

    + CategoryInfo          : ObjectNotFound: (git:String) [init.ps1], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException,init.ps1


Since this is a new machine, I checked if git was installed by running the git command and received the following error:

git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the

spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ git

+ ~~~

    + CategoryInfo          : ObjectNotFound: (git:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException


You can also check the environment variables if you have a git-related path and it wasn't there in my case:


Downloaded git and installed. Installed the 64-bit version since my Azure VM was 64-bit.

After installation, reopen the environment variables window in case if you left it open prior to the installation.

I could then find the path: c:\program files\git\cmd


If you run the git command in the PS command now in an already open PS window, its common to still get the same error: git is not recognised  as the name of a cmdlet


Close and reopen the PS Script Window and try the git command and the command should be recognised:


Now, traverse to the necessary folder, re-execute the init.ps1 command, everything successful this time:


The next step is to docker-compose up and there is a readily available PS script named up.ps1. Execute the same -


Once docker compose up is successful, another error that you might receive is this:

File C:\MVP-Site-master\.config\dotnet-tools.json came from another computer and might be blocked to help protect this computer. For more information, including how to unblock, see https://aka.ms/motw


The error is fairly self-explanatory. You need to unblock the files before unzipping since I downloaded the files from github as a zip. 

Unzip the files and ensure .env file is populated and run the .\up.ps1


The next error I received is this:

Error:

ERROR: for traefik  Container "4619c36a9acf" 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:\latest\MVP-Site-master\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


No IIS on this machine.

Run docker system prune -a and then .\up.ps1

The above steps didn't work fine. So, I decided to install IIS -


Then stop IIS since its not needed. IIS stopped state:




On running the .\up.ps1 command and this time, the docker compose up was fine - 


If the MVP site doesn't open, ensure all containers are running in the above dashboard and start any stopped containers and refresh browser:


Sitecore Content tree:


In case if you need to peek into the file system of the container, issue this command -

docker exec -it mvp-site-master_cm_1 powershell


Now, you are in the webroot of the CM docker container. If you traverse to the bin folder, you can check the MVP site specific DLLs -




Comments

Popular Posts