Tuesday, November 27, 2018

Installing SXA SOLR Indexes quick tips

Just a few quick tips and trick I have picked up when installing Sitecore SXA 1.7 (update 1) 

The process goes like this: 


  1. Install Sitecore 9 
  2. Install Powershell Extensions (Apparently version 5 of the full package works fine but I tend to stick with recommended versions so went with 


4.7.2 for Sitecore 8/9
Full 4.7.2 release for Sitecore 8/9

Find it here: 

https://marketplace.sitecore.net/Modules/Sitecore_PowerShell_console.aspx

3. Install SXA 

Download: https://dev.sitecore.net/~/media/1FF242BE683E4DE989925F74B78978FC.ashx
Installation Instructions: https://dev.sitecore.net/~/media/C9C535C21F8A4455BCF1F7F6C7AB1D1D.ashx

4. Rebuild indexes
5. Rebuild Link Databases

Should all be done right? I mean the indexes are defined in 

\App_Config\Include\Z.Foundation.Overrides\Sitecore.XA.Foundation.Search.Solr.config

And are shown in the indexing manager: 






But there's a bit in the installation manual you should read closely:

Create SOLR SXA cores 


After installing SOLR and connecting it to your Sitecore instance, you may notice that a number of default Sitecore platform cores have been added. In SOLR a core is an instance of a Lucene index and contains the configurations for that index. Each index should have its own core, therefore for each custom index you wish to create for SXA, you must create a core.

 To create your SOLR SXA core: 
1. Duplicate core directory created for sitecore_master_index (or company_name_master_index) twice and rename to: 


  • sitecore_sxa_master_index 
  • sitecore_sxa_web_index
You then need to add the cores to SOLR through the Solr Admin page usually: https://localhost:8983/



All good so far - but there is two tricks you also need to do or else when you try and re-index these two new indexes, it will take a micros-second and nothing will happen:

  • Restart the Solr service so it picks up the new indexes 

  • Restart IIS or your website 

You can then reindex properly and eveything will be hunky dory 

Also note missing these indexes will definitely cause errors later on. 

Lastly SXA 1.7 Update 1 supports custom indexes as described here:


 





Sunday, October 14, 2018

An amazing thing happened at Symposium

Well as I pack my bags to head back to Auckland, I have a million exciting things I have learnt this year and have come away with a huge goody bag of new tools, techniques, insights and pure excitement around the impending release of Sitecore 9.1 and SXA 1.8 (again thank you, thank you Adam Najmanowicz @adamnaj)

But the best thing that happened wasn't about Sitecore directly. It was about people and how a community of genuine, caring people can come together to make a huge difference.

If you don't know the MVP community lost one of their own a few weeks ago in a tragedy. Ryan Bailey was a true friend and a great guy who personified what it was to be a Sitecore MVP. Almost without exception when he found something new, whether a bug or a better way of doing something, he shared it with us all through his blog 

https://blog.ryanbailey.co.nz/

Ryan was the most prolific blogger I have ever seen and helped so many through so many channels.

And to be honest, his passing left me wondering if I would be able to go on working with Sitecore, it was a shared passion that bound us together and I didn't think it would ever be the same again, and it some ways it never will be.

But then a truly amazing thing happened.

Kamruz Jaman (@jammykam) , and Akshay Sura (@akshaysura13 ) - started chatting on the Slack channel after the news had broken and wanted to do something to send some support to his family. It started with flowers and very soon had grown into a givealittle page: https://givealittle.co.nz/cause/support-for-ryans-family

And before Symposium we had managed to raise around 5k which was great by me and I'd prepared myself that if we made that, I'd be satisfied.

In some ways I was dreading Symposium, I thought I had managed to tell most folk, but knew there would be many who would only find out in Orlando, so I was prepping for a heavy load, mostly I was planning to hide in a corner and try not to cry too much in public.

But again, an amazing thing happened. From day one I was humbled and continually moved by the support and kindness shown by every single person who knew Ryan, knew of Ryan or had the heard the devastating news. 

Then came the MVP summit and this is where things went next level real fast. Day one started with a minutes silence for Ryan and a memorial slideshow, and it is here I have to give a huge shout out to Pieter and Tamas for organising all of this and catching me as I skulked around the hall, making sure I had a heads up and had time to emotionally prepare - forever in their debt.

The rest of the day and the next morning was a blur of exciting recaps and deep dives, SXA, JSS, Universal Tracker, Horizon and much more, not sure I remember much detail but I took a lot of pictures and the slide decks are rolling out as we speak which sorts out my FOMO. 


For the whole afternoon on day two, the main room screens looked like this:





The shortened link lead them to this page:  https://givealittle.co.nz/cause/support-for-ryans-family


Well, the night before this fellow named Corey Smith (@sitecorey) who was a friend of Ryan's as well, (He lives in Atlanta Georgia and is a true Southern gentleman)



Check out that stache, it becomes very important later in the story


Well he promised on Twitter that if donations went past 10k he would shave off the hideous toilet brush we have teased him about for years.

He may have thought his stache was safe as we were only at about 6k but things rapidly took a different turn, as you might expect from a bunch of geeks.

Yes Twitter lit up, hash tags were created and the whole community piled in boots and all.


Then this guy weighed in and said he’s lose his beard if we made 12k – this is Kam Figy (@kamsar) by the way .


Well thanks to some very generous people we got to this in a little under 4 hours.


So this had to happen – live on stage in front of the whole MVP summit who all filmed it and gathered round to cheer and make jokes at Corey’s expense, the moustache was removed. ("little boy have you lost your Momma")


The whole shaving video can be seen on youtube here:



And here we are after, Kam lost the beard but understandably was nervous about Pete shaving it, so discretely did it himself.


But the day hadn't finished throwing up amazing stuff.




So this has now turned into an annual thing where we will all grow gross facial hair and then have a mass shave off at the end of our next summit, which is a great thing to come out of it. 

Not only have we provided incredible support to his family, we have also firmly embedded the notion that while we are just people who work with a software product, we are also a powerful community capable to helping, healing and doing some very good things. 

As Ryan's sister said to me "I'm just so happy he had you and the others. I've never come across a workplace where the people were family. Hopefully one day" 

Bearing in mind we are a geographically distributed family, this is truly an amazing thing and we can all be proud of what we achieved.

Shout Outs!

  • Pieter, Tamas, Jason and the the whole MVP team at Sitecore
  • Corey Smith - mate you are a rare gem indeed
  • Kam Figy - I know you loved that beard and doing a #SitecoreStacheExchange couldn't have been easy 
  • To all the MVPs who leaped into the spirit of the things and generously donated both in kind words, money and fabulous jokes.
  • Horizontal Integration  for making absolutely sure the shaving happened - nailed it!
  • Mike Reynolds for his steady support, never ending humour and sensitivity
  • Pete Navarra for fussing around the chair arrangement on stage, working with the hotel to provide towels, water and the most tender shave I have ever seen (sorry about the blunt razors Corey) and MCing the whole show.
To one and all, I will never forget this incredible event that brought healing and closure to so many of us, such good things coming from a tragedy are a tribute to you all and I thank you from the bottom of my heart.

Bruce Davis-Goff (@NZsitecore)





















Tuesday, March 20, 2018

System.Collections.Concurrent.ConcurrentBag Has a hissy fit.


It's well acknowledged that installing Sitecore Commerce 8.2.1 can be beastly to install and more so in a scaled environment. I have done many times now, I was beginning to find it straightforward... let your guard down for a moment and BOOM! Microsoft come a'callin. 

All credit to Tan Vu from Sitecore support, he's great ! - I'm just the documenter. 

Unable to cast object of type 'System.Collections.Concurrent.ConcurrentBag`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]' to type 'System.Collections.Generic.IReadOnlyCollection`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Collections.Concurrent.ConcurrentBag`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]' to type 'System.Collections.Generic.IReadOnlyCollection`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]'.

 


This is what might have happened to you:
  • .NET framework 4.5.2 contains System.Collections.Concurrent.ConcurrentBag<T> class from System.dll which implement IReadOnlyCollection<T> interface, but due to the some security updates from Microsoft side, ConcurrentBag<T> was changed, and as a result, it does not implement IReadOnlyCollection<T>. In order to check whether one of the aforementioned security updates was installed on your server, you can review the version of C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll 
    For the regular .NET framework 4.5.2 this version looks like 4.5.2... , but if security update was installed it will look like 4.0.30319.36388 (It seems to me that these security updates were built based on .NET framework 4.0 which did not have IReadOnlyCollection<T> interface at all.
  • In this way, if the server has .NET framework 4.5.2 without aforementioned security updates, provided by Microsoft, then System.dll will have System.Collections.Concurrent.ConcurrentBag<T> which implement IReadOnlyCollection<T> interface, in contrast to .NET framework 4.5.2 with security update. This error may happen because of these security updates.
Thus, to fix this problem, please update the .NET framework version on your server to at least 4.6.1
Then, please update the following configuration on your Web.config file:

  • <compilation defaultLanguage="c#" debug="false" targetFramework="4.6.1">
  • <httpRuntime targetFramework="4.6.1" ..

Thanks again Vu Tan!

Hope this helps someone out there who doesn't have a Vu Tan to lean on :-) 










Sunday, March 4, 2018

Hackathon 2018 in New Zealand



Azure 

As a pseudo developer (with impostor syndrome 50% of the time) I am over it! - By that I mean configuration -  hours of of messing around in config files, searching, replacing (seriously guys JSON is for machines), SIF and SIFLess are fun, but I think all this is headed for automation.

It doesn't mean developers will disappear, (though sometimes the marketing department wishes they would) but I believe we will become accustomed to telling a machine how to do our job a lot more than we do now. 

With all that in mind, I spun up a quick instance of Sitecore on an Azure portal, everything just worked and it took 52 minutes. I'm completely sold on how easy it was and hope to never do it any other way. 



Just to balance that, here's the costs for a day and a half with minimal usage.

The Poutineers 

Sitecore List & Contact Knowledge Share - Slacks


Kiwis and Canadians have a natural affinity I feel, so it was a delight to be considered by Chris Williams. My fellow Marmite Muncher Ryan Bailey was also onboard. 

Now I have to say, our concept is a good one, really good. Privacy advocates might shrink back while marketing types shriek with delight, but I love the idea of preemptively building anonymous Contacts from likely channels using machine learning to sift for targeted profiles.  

One could then do some cool strategies to identify and connect these Contacts and bingo! Instant in-depth profile!!



It's a big idea and Chris was sensible to contain it to a simple demo where we displayed a list of articles based on the keywords and IDs extracted from a single slack channel.  

Even so were still firing stuff up minutes before the cut-off and it's pretty raw, but exciting.

The real fun bit will be wiring up the ML and pulling in cognitive services. Want to know how my site knows you like kittens? Well you sure have posted a lot of pictures of them all over the net :-)  This would work even better with identified contacts, rainbow unicorn dragon kittens.

Thank you Chris and Ryan you letting me participate, a very cool idea came out it so I feel like we've already won.
I also learnt Surface Books can overheat doing video rendering,  mmm toasty.  










Sunday, November 26, 2017

Adventures with Sitecore Commerce 8.2.1

Now I'll start by saying I'm am nowhere near the developer skill level of MVPs like  @mike_i_reynolds  or @jammykam or even @ryanbaileynz, but I think I can make a fairly decent job of deploying and configuring Sitecore solutions. Having recently installed Sitecore Commerce 8.2.1 five times in a row I'd thought I'd share some tips for those that are going to have a crack at it for the first time. 

The Steps 


Create a local account


http://commercesdn.sitecore.net/SitecoreCommerce/DeploymentGuide/en-us/index.html#Concepts/c_M_DeploymentCreateLocalAccount.html

 While CSFRuntime user may be ok for development deployments, if you are setting up on a multi-server environment or heading to production, you'll need more granular security accounts to provide an auditable separation of privileges.  This is described here in the Devops guide : 

http://commercesdn.sitecore.net/SitecoreCommerce/DevOpsGuide/en-us/index.html#Concepts/c_M_SitecoreCommerce_Accounts_and_Groups.html

Big important note, these accounts need to installed on a common domain controller across all servers (CM, CD, SQL) 



Install ASP.NET Core and related software



  1. Download and install ASP.NET MVC 4 (available at https://www.asp.net/mvc/mvc4). For more information on MVC, go to Set up Visual Studio to work with Sitecore MVC.
Note: Make sure that the installed version of the .NET Framework is the DevPack/SDK edition, not the Runtime edition. The dotnet publish command used later  will fail if only the Runtime edition is installed.
  1. Download and install .NET Core 1.0.3 SDK Preview 2 build 3156.
No worries 
  1. Download and install .NET Core Windows Server Hosting 1.x.x.
No worries 
  1. Optionally, download and install .NET Core 1.0.1 Visual Studio 2015 Tooling Preview 2. This is only required for a development environment.
  2. Download and install Microsoft Web Deploy 3.6 (the 64 bit file is available at: WebDeploy_amd64_en-US.msi).
No worries
  1. Download and install Microsoft HttpPlatformHandler v1.0 (the 64 bit file is available at httpPlatformHandler_amd64.msi).
No worries 
  1. Restart the server, or open a command prompt and execute the iisreset command to apply the changes to the system path.

Install Sitecore Experience Platform



This should be a no-brainer but careful with this instruction: 

After you have installed Sitecore XP, change the Sitecore web site's application pool identity to .\CSFndRuntimeUser.

If this account does not have database permissions on your Sitecore databases you will run into publishing issues

Also when assigning app pool identities take care here: 

The local account must be prefixed with .\ or MachineName\, otherwise the Initialize-CSSite command (executed later in this workflow) cannot grant proper permissions for Commerce Server databases.

When using a domain controller use the fully qualified domain name i.e. MyDomain\AccountName

Additional Sitecore XP configuration



If you are using a different domain make sure you: 

Change the hostName in Website\App_Config\Include\Reference.Storefront\Reference.Storefront.config

Also remember you have done this, it becomes important later.

Don't forget you'll need a SSL cert, either a domain wildcard or self signed since no one runs on http anymore and certainly not on a commerce site. 



Install Commerce Server



This part contains virtually no tricky bits  and should be a breeze, note the port assignment though 1004

Install Sitecore modules



This is done through the installation wizard and while it may take a while, I had no issues 

Install Sitecore update packages



Again problem free on all installs, clearing the event que on the master database timed out (Azure VM) but everything installed eventually, can take a fair amount of time as well so don't panic.

Also the last package 
  • Sitecore.Reference.Storefront.Powered.by.SitecoreCommerce.10.x.xxx.update
will most likely throw an error when it finishes (see below) - you are safe to ignore it and carry on with your installation, we will fix it later 





Let the Powershell fun begin!!

As long as you fill in the script values correctly this should be easy too, i.e. 

New-CSWebService -Name "CFSolutionStorefrontsite" -Resource Catalog -IISSite "CSServices" -AppPool "CSServices" -Identity 'CSFndRuntimeUser' -Password 'YourPassword'

Update the Commerce Server Profile Schema


Create encryption keys for the CFSolutionStorefrontSite.

This bit is easy, just make sure you run the command in the directory where the ProfileKeyManager.exe

i.e.  C:\Program Files (x86)\Commerce Server 11\Tools

Update the Commerce Server Profile schema by deploying the Commerce Storefront Profile Database DAC package, using the following command. 

This bit is not so easy as it requires permissions on the database to match the username password the process is being run by. Admittedly it was late at night but this one confounded me for a bit. 

The executable  SqlPackage.exe is required and it's location varies depending on your set up so you will have to find it and make sure the path to the .exe, the package and the database server are both correct. 

"C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" /Action:Publish /SourceFile:".\Database\Profiles\Commerce.Storefront.ProfileDatabase.dacpac" /TargetDatabaseName:CFSolutionStorefrontSite_profiles /TargetServerName:"127.0.0.1" 

In the end I went for jumping onto the SQL server and running it through the command line there. This DACPAC is very important as it sets up the YourStoreName_CommerceProfiles table correctly. 

Also don't be like me and try running it through SQL Management Studio as a Data Tier Update, it will destroy your tables, fortunately years of bumbling my way through things have taught me the value of BACKUP FIRST, BACKUP FIRST BACKUP FIRST !

If you got the error at the end of installing 
  • Sitecore.Reference.Storefront.Powered.by.SitecoreCommerce.10.x.xxx.update
Now is the time to go back to the UpdateInstallationWizard and do it again, no errors this time buddy!


Compile the Commerce Engine




The only trick here is making sure that the installed version of the .NET Framework is the DevPack/SDK edition, not the Runtime edition. The dotnet publish command  will fail if only the Runtime edition is installed.

The publish command will create a folder called Deplopy on you C: Drive which you will copy to the CommerceAuthoring folder specified in your new IIS site. 


Bootstrap and initialize the Commerce Server environment





Now let the fun with JSON configuration files begin

These three commands 


Rely on these JSON files in your commerce authoring site: 

C:\inetpub\CommerceAuthoring\wwwroot\bootstrap\global.json

And all the json files found here: 

C:\inetpub\CommerceAuthoring\wwwroot\data\Environments

Major tip: All the configuration settings must be correct or you will have issues, including but not limited to 

Bad Gateway 

Currency set ‘{4B494292-598E-4A61-A156-D7501F7953ED}’ was not found


Things to check: 

  • Your database strings are correct throughout (Notepad ++ search and replace will save you time) 

 "$type":  "Sitecore.Commerce.Plugin.SQL.EntityStoreSqlPolicy, Sitecore.Commerce.Plugin.SQL",
                                         "TrustedConnection":  true,
                                         "UserName":  "xxxxxx",
                                         "Password":  "XXXXXX",
                                         "Server":  "MACHINENAME\SQLEXPRESS",
                                         "Database":  "SitecoreCommerce_SharedEnvironments",
                                         "AdditionalParameters":  "",
                                         "ConnectTimeout":  120000,
                                         "CleanEnvironmentTimeout":  120000 

  • Your Sitecore admin account settings are correct if you are not using the defaults
  • Your host is correct if you have changed it as mentioned above 


  "$type":  "Sitecore.Commerce.Plugin.Management.SitecoreConnectionPolicy, Sitecore.Commerce.Plugin.Management",
                                         "Host":  "cf.reference.storefront.com",
                                         "SitecoreDatabase":  "master",
                                         "UserName":  "admin",
                                         "Domain":  "sitecore",
                                         "Password":  "b"

Make sure you are thorough with all the JSON files - if either of these fail you will have to go and clear out the  tables before you can run them again. 

DELETE FROM tablename

Also if you do have to run them again, restart the CommerceAuthoring site

Rerun the http://localhost:5000/commerceops/Bootstrap() command to read in any config changes you have made 

Then re run the two commands 


At this stage you should be breathing vast sighs of relief and be as happy as a sand boy

Final configuration



Don't forget to carefully merge the new settings into your web config and watch out for duplicates

Also note one of the merge files is merged into the /Views web.config, I mean you'd have to be half asleep to try and put them anywhere else wouldn't you ....

Reindex the Sitecore and Commerce Server indexes


Check you have sorted your index config before this especially is you are running Solr

Last thoughts 


Bring on Commerce 9 even if it does have JSON configuration , its uses the new Sitecore Installation Framework so it's just going to keep getting easier: 

Sitecore Commerce Server profile definitions not found


http://blog.ryanbailey.co.nz/2017/06/sitecore-commerce-server-profile.html

Sitecore Commerce catalog web service error


http://blog.ryanbailey.co.nz/2017/05/sitecore-commerce-catalog-web-service.html

Also if your Commerce Server Manager wont let you view Profile definitions, make sure that you have added localhost into your trusted sites using IE Internet options, silly old enhanced security !

Sitecore Authorization Manager needs to have your runtime accounts assigned to the administrator roles of the Catalog and Profile web services, usually done as part of the install but can be checked by running azman.msc

If the authorization stores are missing add them from the 2 web services folders

C:\inetpub\CSServices\CFSolutionStorefrontsite_CatalogWebService

CatalogAuthorizationStore.xml

C:\inetpub\CSServices\CFSolutionStorefrontsite_ProfilesWebService

ProfilesAuthorizationStore.xml



Other Resources: 

sitecorechat.slack.com  #ecommerce

Me on Twitter:  @NZsitecore