Installing on CD/CM environment
This section covers how to install Ucommerce, when running Sitecore Content Delivery and Content Management as seperate entities.
Overview
Once you have decided to go down the route with a scaled CM / CD environment for your webshop, it is important to note the different moving pieces and what it means for your setup.
SQL server
Your SQL server must exist in a place where both the CM and CD can access it. This goes solely for the Ucommerce database as we do not have the notion of moving data between different SQL databases. This means that your CM and CD read and write to the same sql server thus they need shared access. This can be embedded into your existing databases, or sit in a seperate database.
NHibernate second level cache
You must also use a shared second level cache (distributed cache). We recommend installing redis for the purpose. This must be enabled on both the CM and the CD. How to set up and use Redis for the 2nd level cache.
Search indexes
Ucommerce ship Out of the box with Lucene and Elasticsearch as possible index providers for searching and presenting data. Out of the box Lucene is enabled, but you must enable Elasticsearch in a scaled setup as Lucene can't be scaled and shared across instances. This must be enabled on both the CM and the CD. Setup Elasticsearch to power the search indexes
The Content Management setup
- Install Sitecore.
- Create separate database for Ucommerce.
-
Add reference to database in ConnectionStrings.config
- As shown on this documentation page
- Install Ucommerce via the Sitecore installation wizard.
- Configure a distributed second level cache for NHibernate
- Setup Elasticsearch to power the search indexes
The Content Delivery setup
- Install Sitecore.
- Configure a distributed second level cache for NHibernate
- Setup Elasticsearch to power the search indexes
- Change role to ContentDelivery in web.config:
<add key="role:define" value="ContentDelivery" />
- Remove connectionstring to master database:
<!-- <add name="master" connectionString="user id=?;password=?;Data Source=.;Database=cd_env_Sitecore.Master" /> -->
- Add connectionstring to the Ucommerce database from the Content Management environment:
<add name="ucommerce" connectionString="user id=?;password=?;Data Source=.;Database=cm_env_Ucommerce" />
-
Copy Ucommerce files into the folderstructure (these can be taken from the Content Management project):
- Add assemblies starting with Ucommerce to bin folder (they have the format Ucommerce.*.dll)
- Add the /bin/ucommerce folder along with its contents.
- Add Ucommerce folder to the sitecore modules/Shell folder along with its contents.
-
Add Ucommerce config files to App_Config/Include (they have the format Sitecore.uCommerce.*.config)
-
Disable the following by deleting or adding .disabled to their name:
- Sitecore.uCommerce.initialize.config
- Sitecore.uCommerce.Pipelines.ModifyPipelines.config
- Sitecore.uCommerce.Databases.config
- Sitecore.uCommerce.Dataproviders.config
-
Disable the following by deleting or adding .disabled to their name:
-
In sitecore modules/Shell/Ucommerce/Configuration/Shell.config change nameOfContentDatabase to web
<nameOfContentDatabase>web</nameOfContentDatabase>
- The implementation needs to override a hardcoded master database in ISitecoreContext:
using Sitecore.Configuration; using Sitecore.Data; using Ucommerce.Sitecore.Extensions; using Ucommerce.Sitecore.SitecoreDataProvider; namespace Ucommerce.Sitecore { /// <summary> /// Sitecore Context implementation. /// </summary> public class SitecoreContext : ISitecoreContext { private string NameOfContentDatabase { get; set; } public SitecoreContext(string backEndDomainName, string nameOfContentDatabase, bool shouldPullTemplatesFromSitecore) { BackendDomainName = backEndDomainName; NameOfContentDatabase = nameOfContentDatabase; ShouldPullTemplatesFromSitecore = shouldPullTemplatesFromSitecore; } public virtual Database MasterDatabase { get { return DatabaseForContent; } } public virtual Database DatabaseForContent { get { return Factory.GetDatabase(NameOfContentDatabase); } } public DataProviderMasterDatabase DataProviderMaster { get { return MasterDatabase != null ? MasterDatabase.GetUcommerceDataProvider() : null; } } public string BackendDomainName { get; private set; } public bool ShouldPullTemplatesFromSitecore { get; private set; } } }
- Register a custom implementation of ISitecoreContext as a new app in the apps folder, As shown in this piece of documentation In the configuration of this component, the nameOfContentDatabase parameter should be changed to 'web'.
<configuration> <components> <component id="SitecoreContext" service="Ucommerce.Sitecore.ISitecoreContext, Ucommerce.Sitecore" type="Ucommerce.Sitecore.SitecoreContext, Ucommerce.Sitecore"> <parameters> <backEndDomainName>sitecore</backEndDomainName> <nameOfContentDatabase>web</nameOfContentDatabase> <shouldPullTemplatesFromSitecore>false</shouldPullTemplatesFromSitecore> </parameters> </component> </components> </configuration>
Make changes to web.config:
- Add to
<configSections>
:
<section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler, NHibernate.Caches.SysCache, Version=5.5.0.0, Culture=neutral, PublicKeyToken=6876f2ea66c9f443" requirePermission="false"/> <section name="clientDependency" type="ClientDependency.Core.Config.ClientDependencySection, ClientDependency.Core, Version=1.8.2.1" requirePermission="false"/>
- Add to
<modules runAllManagedModulesForAllRequests="true">
:
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core, Version=1.8.2.1, Culture=neutral"/>
- Add to
<handlers>
:
<add verb="*" path="PaymentRequest.axd" preCondition="integratedMode" name="PaymentRequest" type="Ucommerce.Transactions.Payments.PaymentRequestForm, Ucommerce"/> <add verb="*" path="PaymentProcessor.axd" preCondition="integratedMode" name="PaymentProcessor" type="Ucommerce.Transactions.Payments.PaymentProcessor, Ucommerce"/> <add verb="*" name="ClientDependency" preCondition="integratedMode" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core, Version=1.8.2.1, Culture=neutral"/>
- Add to
<controls>
:
<add tagPrefix="commerce" namespace="Ucommerce.Presentation.Web.Controls" assembly="Ucommerce.Presentation"/>
- Add to
<assemblies>
:
<add assembly="ClientDependency.Core, Version=1.8.2.1, Culture=neutral"/>
- Add to
<assemblyBinding>
:
<dependentAssembly> <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc"/> <codeBase version="4.4.0.0" href="bin\ucommerce\Castle.Core.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc"/> <codeBase version="5.0.0.0" href="bin\ucommerce\Castle.Windsor.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="ClientDependency.Core"/> <codeBase version="1.8.2.1" href="bin\ucommerce\ClientDependency.Core.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="FluentNHibernate"/> <codeBase version="2.1.2" href="bin\ucommerce\FluentNHibernate.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="NHibernate.Caches.SysCache" publicKeyToken="6876f2ea66c9f443"/> <codeBase version="5.5.0.0" href="bin\ucommerce\NHibernate.Caches.SysCache.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4"/> <codeBase version="4.0.4" href="bin\ucommerce\Iesi.Collections.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a"/> <codeBase version="1.2.11.0" href="bin\ucommerce\log4net.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Infralution.Licensing" publicKeyToken="3e7e8e3744a5c13f"/> <codeBase version="4.7.1.0" href="bin\ucommerce\Infralution.Licensing.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="AuthorizeNet"/> <codeBase href="bin\ucommerce\AuthorizeNet.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Braintree-2.22.0"/> <codeBase href="bin\ucommerce\Braintree-2.22.0.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="paypal_base"/> <codeBase href="bin\ucommerce\paypal_base.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Lucene.Net" publicKeyToken="85089178b9ac3181"/> <codeBase version="3.0.3.0" href="bin\ucommerce\Lucene.Net.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Lucene.Net.Contrib.Spatial.NTS" publicKeyToken="85089178b9ac3181"/> <codeBase version="3.0.3.0" href="bin\ucommerce\Lucene.Net.Contrib.Spatial.NTS.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="ICSharpCode.NRefactory.CSharp" publicKeyToken="d4bfe873e7598c49"/> <codeBase version="5.0.0.0" href="bin\ucommerce\ICSharpCode.NRefactory.CSharp.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="ICSharpCode.NRefactory" publicKeyToken="d4bfe873e7598c49"/> <codeBase version="5.0.0.0" href="bin\ucommerce\ICSharpCode.NRefactory.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Esent.Interop" publicKeyToken="8dd49bbdae3f61af"/> <codeBase version="1.7.0.0" href="bin\ucommerce\Esent.Interop.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Spatial4n.Core.NTS" publicKeyToken="9f9456e1ca16d45e"/> <codeBase version="0.3.0.0" href="bin\ucommerce\Spatial4n.Core.NTS.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Remotion.Linq" publicKeyToken="5fa384605d304122"/> <codeBase version="2.2.0.0" href="bin\ucommerce\Remotion.Linq.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Remotion.Linq.EagerFetching" publicKeyToken="5fa384605d304122"/> <codeBase version="2.2.0.0" href="bin\ucommerce\Remotion.Linq.EagerFetching.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-5.2.5.0" newVersion="5.2.0.0"/> </dependentAssembly>
- Add at the end of the file, right before
</configuration>
:
<syscache> <!-- Cache catalog objects for 60 mins before refreshing --> <cache region="CatalogFoundation" expiration="3600" priority="5"/> <cache region="MarketingFoundation" expiration="3600" priority="5"/> <cache region="SecurityFoundation" expiration="3600" priority="5"/> <cache region="Backend" expiration="3600" priority="5"/> </syscache> <location path="ucommerceapi"> <system.web> <httpHandlers> <add path="*" type="Ucommerce.Sitecore.Web.SessionHttpHandlerFactory, Ucommerce.Sitecore" verb="*"/> </httpHandlers> </system.web> </location> <clientDependency version="20195" fileDependencyExtensions=".js,.css"> <compositeFiles defaultProvider="defaultFileProcessingProvider" compositeFileHandlerPath="~/DependencyHandler.axd"> <fileProcessingProviders> <add name="CompositeFileProcessor" type="ClientDependency.Core.CompositeFiles.Providers.CompositeFileProcessingProvider, ClientDependency.Core, Version=1.8.2.1" enableCssMinify="true" enableJsMinify="true" persistFiles="true" compositeFilePath="~/App_Data/TEMP/ClientDependency" urlType="Base64QueryStrings" pathUrlFormat="{dependencyId}/{version}/{type}"/> </fileProcessingProviders> </compositeFiles> </clientDependency> <location path="sitecore modules/Shell/ucommerce"> <system.web> <httpRuntime maxRequestLength="512000" executionTimeout="600" enableKernelOutputCache="false" relaxedUrlToFileSystemMapping="true" requestValidationMode="2.0"/> </system.web> </location>