Installing Sitecore 9 (XP0) with Solr installed on remote server

When you are installing Sitecore 9 on premise, you need to choose whether you are installing XP on single server (XP0) or scaled (XP1) or installing XM scaled (XM1). This is based on download options that you have on Sitecore 9 Download page. Similar options you have also for Azure AppService where you can choose also XM on single server (XM0) and single (XDB0) or scaled XDB (XDB1) deployment.

If you have chosen XP on single server or XP0 and followed my series of blog posts or somebody else’s advices you should be ok when you have everything on one server. For dev machine this is probably the case.

If you have configuration where Sitecore is on one server and Solr on another one, you can have issues running deployment scripts through Sitecore Installation Framework (SIF) as described by David on Sitecore StackExchange (SSE).

Solution for deployment in this setup is to split powershell script into two pieces and running script partially on Sitecore machine and also on Solr machine.

Let’s take a look how to do that.

Normally you should end up with script that is something similar to this one:

#define parameters 
$prefix = "sc9u1" 
$PSScriptRoot = "C:\resourcefiles\"
$XConnectCollectionService = "$prefix.xconnect" 
$sitecoreSiteName = "$prefix.sc" 
$SolrUrl = "https://solrserver:8984/solr" 
$SolrRoot = "C:\Solr\solr-6.6.2\" 
$SolrService = "Solr" 
$SqlServer = ".\" 
$SqlAdminUser = "sa" 
$SqlAdminPassword= "b"

#$solrParams = @{ 
# Path = "$PSScriptRoot\sitecore-solr.json" 
# SolrUrl = $SolrUrl 
# SolrRoot = $SolrRoot 
# SolrService = $SolrService 
# CorePrefix = $prefix 
#}

#Install-SitecoreConfiguration @solrParams 
 
#install client certificate for xconnect 
$certParams = @{ 
 Path = "$PSScriptRoot\xconnect-createcert.json" 
 CertificateName = "$prefix.xconnect_client" 
 } 
 
Install-SitecoreConfiguration @certParams -Verbose 
 
#install solr cores for xdb 
$solrParams = 
@{ 
 Path = "$PSScriptRoot\xconnect-solr.json" 
 SolrUrl = $SolrUrl 
 SolrRoot = $SolrRoot 
 SolrService = $SolrService 
 CorePrefix = $prefix 
} 
Install-SitecoreConfiguration @solrParams -Verbose 
 
#deploy xconnect instance 
$xconnectParams = @{ 
 Path = "$PSScriptRoot\xconnect-xp0.json" 
 Package = "$PSScriptRoot\Sitecore 9.0.1 rev. 171219 (OnPrem)_xp0xconnect.scwdp.zip" 
 LicenseFile = "$PSScriptRoot\license.xml" 
 Sitename = $XConnectCollectionService 
 XConnectCert = $certParams.CertificateName 
 SqlDbPrefix = $prefix 
 SqlServer = $SqlServer 
 SqlAdminUser = $SqlAdminUser 
 SqlAdminPassword = $SqlAdminPassword 
 SolrCorePrefix = $prefix 
 SolrURL = $SolrUrl 
 }

Install-SitecoreConfiguration @xconnectParams -Verbose 
 
#install solr cores for sitecore $solrParams = 
$solrParams = @{ 
 Path = "$PSScriptRoot\sitecore-solr.json" 
 SolrUrl = $SolrUrl 
 SolrRoot = $SolrRoot 
 SolrService = $SolrService 
 CorePrefix = $prefix 
}

Install-SitecoreConfiguration @solrParams 
 
#install sitecore instance 
$xconnectHostName = "$prefix.xconnect" 
$sitecoreParams = 
@{ 
 Path = "$PSScriptRoot\sitecore-XP0.json" 
 Package = "$PSScriptRoot\Sitecore 9.0.1 rev. 171219 (OnPrem)_single.scwdp.zip" 
 LicenseFile = "$PSScriptRoot\license.xml" 
 SqlDbPrefix = $prefix 
 SqlServer = $SqlServer 
 SqlAdminUser = $SqlAdminUser 
 SqlAdminPassword = $SqlAdminPassword 
 SolrCorePrefix = $prefix 
 SolrUrl = $SolrUrl 
 XConnectCert = $certParams.CertificateName 
 Sitename = $sitecoreSiteName 
 XConnectCollectionService = "https://$XConnectCollectionService" 
} 
Install-SitecoreConfiguration @sitecoreParams

Problem is that you cannot run it on Sitecore instance as it doesn’t have access to Solr server or Solr Service to stop it and restart it during deployment.

You will end up with similar exception to this one:

>> TerminatingError(Invoke-WebRequest): "Unable to connect to the remote server"
>> TerminatingError(Invoke-ManageSolrSchemaTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Could not find Solr instance: https://solrserver:8984/solr"
>> TerminatingError(Invoke-ManageSolrSchemaTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Could not find Solr instance: https://solrserver:8984/solr"
Install-SitecoreConfiguration : Could not find Solr instance: https://solrserver:8984/solr
At D:\sc9_install\sc9_install.ps1:55 char:1
+ Install-SitecoreConfiguration @xconnectParams -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
Install-SitecoreConfiguration : Could not find Solr instance: https://solrserver:8984/solr
At D:\sc9_install\sc9_install.ps1:55 char:1
+ Install-SitecoreConfiguration @xconnectParams -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

 

As I already mentioned, solution is pretty easy and you need to split the script into two pieces. One that will be run on Sitecore Server:

#define parameters 
$prefix = "sc9u1" 
$PSScriptRoot = "C:\resourcefiles\"
$XConnectCollectionService = "$prefix.xconnect" 
$sitecoreSiteName = "$prefix.sc" 
$SolrUrl = "https://solrserver:8984/solr" 
$SolrRoot = "C:\Solr\solr-6.6.2\" 
$SolrService = "Solr" 
$SqlServer = ".\" 
$SqlAdminUser = "sa" 
$SqlAdminPassword= "b"

#install client certificate for xconnect 
$certParams = @{ 
 Path = "$PSScriptRoot\xconnect-createcert.json" 
 CertificateName = "$prefix.xconnect_client" 
 } 
 
Install-SitecoreConfiguration @certParams -Verbose 
 
#deploy xconnect instance 
$xconnectParams = @{ 
 Path = "$PSScriptRoot\xconnect-xp0.json" 
 Package = "$PSScriptRoot\Sitecore 9.0.1 rev. 171219 (OnPrem)_xp0xconnect.scwdp.zip" 
 LicenseFile = "$PSScriptRoot\license.xml" 
 Sitename = $XConnectCollectionService 
 XConnectCert = $certParams.CertificateName 
 SqlDbPrefix = $prefix 
 SqlServer = $SqlServer 
 SqlAdminUser = $SqlAdminUser 
 SqlAdminPassword = $SqlAdminPassword 
 SolrCorePrefix = $prefix 
 SolrURL = $SolrUrl 
 }

Install-SitecoreConfiguration @xconnectParams -Verbose 

#install sitecore instance 
$xconnectHostName = "$prefix.xconnect" 
$sitecoreParams = 
@{ 
 Path = "$PSScriptRoot\sitecore-XP0.json" 
 Package = "$PSScriptRoot\Sitecore 9.0.1 rev. 171219 (OnPrem)_single.scwdp.zip" 
 LicenseFile = "$PSScriptRoot\license.xml" 
 SqlDbPrefix = $prefix 
 SqlServer = $SqlServer 
 SqlAdminUser = $SqlAdminUser 
 SqlAdminPassword = $SqlAdminPassword 
 SolrCorePrefix = $prefix 
 SolrUrl = $SolrUrl 
 XConnectCert = $certParams.CertificateName 
 Sitename = $sitecoreSiteName 
 XConnectCollectionService = "https://$XConnectCollectionService" 
} 
Install-SitecoreConfiguration @sitecoreParams

 

and another one that will be run on Solr Server:

#define parameters 
$prefix = "sc9u1" 
$PSScriptRoot = "C:\resourcefiles\"
$XConnectCollectionService = "$prefix.xconnect" 
$sitecoreSiteName = "$prefix.sc" 
$SolrUrl = "https://solrserver:8984/solr" 
$SolrRoot = "C:\Solr\solr-6.6.2\" 
$SolrService = "Solr" 
$SqlServer = ".\" 
$SqlAdminUser = "sa" 
$SqlAdminPassword= "b"

 
#install solr cores for xdb 
$solrParams = 
@{ 
 Path = "$PSScriptRoot\xconnect-solr.json" 
 SolrUrl = $SolrUrl 
 SolrRoot = $SolrRoot 
 SolrService = $SolrService 
 CorePrefix = $prefix 
} 
Install-SitecoreConfiguration @solrParams -Verbose 
 
#install solr cores for sitecore $solrParams = 
$solrParams = @{ 
 Path = "$PSScriptRoot\sitecore-solr.json" 
 SolrUrl = $SolrUrl 
 SolrRoot = $SolrRoot 
 SolrService = $SolrService 
 CorePrefix = $prefix 
}

Install-SitecoreConfiguration @solrParams

 

Happy deployment 🙂

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 )

w

Connecting to %s