docker-compose up is music to one’s Sitecore ear!

Don’t worry this is not another post about running Sitecore in a container! No this is a post about getting the Sitecore HabitatHome demo solution up and running quickly and I mean quickly without too much effort. I just happen to use docker in the process. HabitatHome is a solution built using SXA on Sitecore XP following Helix principles. It is extremely useful if you need to showcase SXA capabilities to an existing or a potential new customer.

This is where my good friend Andy Uzick found himself a few weeks ago but had already started down the path of standing up the SXA HabitatHome demo on a temporary Azure PAAS instance not using docker. I thought with docker surely this would be much easier.

habitathomedemo

Preresiquites

  • Docker Images – like I said this is not another post running Sitecore on docker so I’m assuming you already have docker images built for Sitecore 9.2 SXA 1.9. If not there is plenty of material out there to help you get started. Mark Cassidy wrote a recent Docker for Dummies Series – worth checking out.
  • Sitecore License File.
  • Visual Studio 2019.
  • Coffee – 1 cup is all you’ll really have time for.

Let’s make some music

A – Clone the Sitecore.HabitatHome.Platform repo.

git clone https://github.com/Sitecore/Sitecore.HabitatHome.Platform.git c:\code\habitathome

B – Within the repo open the .env file and check the variables WINDOWSSERVERCORE_CHANNEL and NANOSERVER_CHANNEL match your container OS version. Set your REGISTRY and also, check REMOTEDEBUGGER_PATH ensuring it matches the path to your remote debugger.

env

C – Review the docker-compose.yml file. Check the different services and their volumes: sql, solr, xconnect, xconnect-automationengine, xconnect-indexworker, cd (commented out by default) and last but not least the cm.

Depending on where you keep your Sitecore license file you don’t really need to do anything. Plus the cloned repo already contains all the mapped directory structures you don’t need to change them:

  • .\data\sql
  • .\data\solr
  • .\data\xconnect
  • .\data\xconnect-automationengine
  • .\data\xconnect-indexworker
  • .\scripts\Docker
  • .\publish\web
  • .\items
  • .\data\cm
  • .\data\creativeexchange

I added an additional alias for my cm – habitathome.dev.local

docker-compose

D – Fire up your container with: docker-compose up

Perform a quick check of the running containers: docker containers ls

dockercontainers

You should now be able to navigate to the cm server via the alias or [IP address]:[port] specified in the docker-compose.yml.

E – Sitecore.HabitatHome.Platform uses the Cake build automation utility for building and deploying the solution. Open the Cake-config.json and review the default settings. I’ve modified the following settings:

  • InstanceUrl – to match my containerized cm instance.
  • ProjectFolder and UnicornSerializationFolder to the correct path of the local repo.

cake-config

F – Now we are ready to build the Sitecore.HabitatHome.Platform solution and deploy it into the running docker container. The build.ps1 is a bootstrap script that will download NuGet if missing, restore NuGet tools (including Cake) and execute the Cake build script with the parameters you provide:

  • Script – the build script to execute.
  • Target – the build script target to run.
  • Configuration – the build configuration to use.
  • Verbosity – specifies the amount of information to be displayed.
  • ShowDescription – shows description about tasks.
  • DryRun – performs a dry run.
  • SkipToolPackageRestore – skips restoring of packages.
  • ScriptArgs – remaining arguments are added here.

run .\build.ps1 -Target “Docker-Unicorn” -Verbosity “Verbose”

buildps1

Hopefully, you should see the following list of completed Cake tasks:

caketaskscomplete

Just over 21 minutes on my laptop – not bad considering I had plenty of other things going on.

G – Fire up your Sitecore instance http://habitathome.dev.local/Sitecore login and navigate to the Desktop -> Powershell Toolbox -> SXA Site Manager. Open the HabitatHome Item and change the database to master and click OK.

sxamanager

You are ready to Demo SXA in all its glory http://habitathome.dev.local

home.png

experience_accelerator.png

Troubleshooting

When it first ran .\build.ps1 the Sync-Unicorn task threw an error:

sync-unicorn-errorsync-unicorn-error_details

On browsing to http://127.0.0.1:44001/unicorn.aspx I was able to access Unicorn just fine without any errors. Hmm!! I kicked off the .\build.ps1 again and it worked just fine without any errors. I’ve not dived into the exact cause for the initial error yet.

Pioneers

We are extremely fortunate to be standing on the shoulders of some dedicated folks who have handed us ready-to-go solutions all the way up the chain, from the SXA team, to the Demo team, to the contributors of the docker-images repo who have shielded us from most of the complexity of working with Docker. Thank you!

Useful Info

Enjoy the demo!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s