In one of my previous posts, I've explained how Install-SitecoreConfiguration works in SIF and how to use it for package installation.
As time passed, more and more functionality got natively embedded into SIF, that included some useful things such as config transformations, publishing, rebuilding indexes, and of course, packages/modules installation. I decided to inspect what actually went into the platform and extracted this functionality out of Commerce product for those who want to benefit from package installations with SIF bit does not want to bother with XC9.
So, actually, there is not a big change compared with my previous post. On the lower level, there is still a temporal folder being exposed and *.aspx page placed for actual job to be done. The good thing is that plenty of that functionality now supported out of the box
For legal reasons I cannot include downloadable ready to use package, since the code and scripts belong to Sitecore who only can share it. Instead I will tell you how you can make it on your own copy of Sitecore Commerce 9.0 update 2.
You'll need three parts - Configuration, Modules and SiteUtilityPages, all carefully from within SIF.Sitecore.Commerce.1.2.14 folder:
- Configurations (json files) taken out of
Configuration\Commerce\Master_SingleServer.json
and Configuration\SitecoreUtilities\InstallModule.json
- Then you'll need three modules from
Modules
folder: InstallSitecoreConfiguration
, ManageCommerceService
, SitecoreUtilityTasks
- Also you need
SiteUtilityPages
folder with InstallModules.aspx
file within
If you do not keep a structure as from Commerce Installer (as didn't I) - please make adjust paths of dependencies correspondingly.
Last but not the least, you need to modify main Deploy-Sitecore-Commerce.ps1
PowerShell script, removing everything apart from package installation out of it. I renamed it into Install.ps1
and here is what I end up with:
param(
[string]$SiteName = "habitat91.dev.local", # your sitecore instance name
[string]$ModulePath = "p:\PowerShell Extensions-5.0.zip" # path to the module to be installed
)
$global:DEPLOYMENT_DIRECTORY=Split-Path $MyInvocation.MyCommand.Path
$modulesPath=( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "Modules" )
if ($env:PSModulePath -notlike "*$modulesPath*")
{
$p = $env:PSModulePath + ";" + $modulesPath
[Environment]::SetEnvironmentVariable("PSModulePath",$p)
}
$params = @{
Path = Resolve-Path '.\Configuration\Master.json'
SiteName = $SiteName
InstallDir = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$SiteName"
SiteUtilitiesSrc = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "SiteUtilityPages" )
ModuleFullPath = Resolve-Path -Path $ModulePath
}
Install-SitecoreConfiguration @params
and below there is my tree structure:
There are two parameters to be configured for Install.ps1
script to run:
In case you are working outside of inetpub\wwwroot
folder, please also adjust the path for InstallDir
variable.
Hope this helps your DevOps!