Guest User

Untitled

a guest
May 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.88 KB | None | 0 0
  1. <#
  2. .SYNOPSIS
  3. Installs the Sitecore Commerce Platform to the machine where this script is executed.
  4. .DESCRIPTION
  5. Installs the Sitecore Commerce Platform to the machine where this script is executed.
  6. First make sure you have installed all the pre-requisites for SC9 from the Installation Guide
  7. Then make sure you walk through 2.2 Download the Sitecore XC release package and prerequisites of the SC9 Installation Guide, before running this script
  8. .EXAMPLE(S)
  9. C:PS> Deploy-Sitecore-Commerce.ps1
  10. .NOTES
  11. Author(s): Alex Smagin
  12. Robbert Hock
  13. #>
  14.  
  15. #Requires -Version 3
  16.  
  17. #parameters
  18. param(
  19. [string]$Prefix = "sc9u1",
  20. [string]$SiteName = "sc9u1.sc",
  21. [string]$SiteHostHeader = "storefront.local",
  22. [string]$SqlDbPrefix = $Prefix,
  23. [string]$CommerceSearchProvider = "SOLR",
  24. [string]$CommerceSiteName = "$Prefix.commerce",
  25. [string]$Drive = $($Env:SYSTEMDRIVE),
  26. [string]$XConnectSiteHostHeaderName = "$($Prefix).xconnect",
  27. [string]$SolrUrl = "https://localhost:8984/solr",
  28. [string]$SolrInstallDir = "C:Sitecore9solr-6.6.2",
  29. [string]$SolrService = "SOLR",
  30. [string]$SqlServer = "DESKTOP-O8SPMPVSQLEXPRESS",
  31. [string]$SitecoreUsername = "sitecoreadmin",
  32. [string]$SitecoreUserPassword = "b",
  33. [string]$CommerceServerUserName = "CSRuntimeUser",
  34. [string]$CommerceServerUserPassword = "vagrant"
  35. )
  36.  
  37. # Hide progress bar to speed up installation
  38. $global:ProgressPreference = 'silentlyContinue'
  39. Clear-Host
  40.  
  41. # Import additional modules
  42. $global:DEPLOYMENT_DIRECTORY = Split-Path $MyInvocation.MyCommand.Path
  43. $modulesPath = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "Modules" )
  44. if ($env:PSModulePath -notlike "*$modulesPath*") {
  45. $p = $env:PSModulePath + ";" + $modulesPath
  46. [Environment]::SetEnvironmentVariable("PSModulePath", $p)
  47. }
  48.  
  49. $params = @{
  50. Path = Resolve-Path '.ConfigurationCommerceMaster_SingleServer.json'
  51.  
  52. # General configurations
  53. CommerceSearchProvider = $CommerceSearchProvider
  54. RootCertFileName = "SitecoreRootCert"
  55.  
  56. # SOLR
  57. SolrCorePrefix = $Prefix
  58. SolrInstallDir = $SolrInstallDir
  59. SolrSchemasDir = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "SolrSchemas" )
  60. SolrServiceName = $SolrService
  61. SolrUrl = $SolrUrl
  62.  
  63. # Azure Search
  64. AzureSearchIndexPrefix = $Prefix
  65. AzureSearchServiceName = ""
  66. AzureSearchAdminKey = ""
  67. AzureSearchQueryKey = ""
  68.  
  69. # CM instance and XConnect settings
  70. SiteName = $SiteName
  71. SiteHostHeader = $siteHostHeader
  72. SiteInstallDir = "$($Drive)inetpubwwwroot$Prefix.local"
  73. XConnectInstallDir = "$($Drive)inetpubwwwroot$Prefix.xconnect"
  74.  
  75. # SQL
  76. SqlCommerceServicesDbName = "$($Prefix)_SitecoreCommerce_SharedEnvironments"
  77. SqlCommerceServicesDbServer = $SqlServer #OR "SQLServerNameSQLInstanceName"
  78. SqlCommerceServicesGlobalDbName = "$($Prefix)_SitecoreCommerce_Global"
  79. SqlSitecoreCoreDbName = "$($Prefix)_Core"
  80. SqlSitecoreDbServer = $SqlServer #OR "SQLServerNameSQLInstanceName"
  81.  
  82. # Commerce Services
  83. CommerceAuthoring = "$CommerceSiteName-authoring"
  84. CommerceAuthoringCertificateDnsName = "*.$Prefix.local"
  85. CommerceAuthoringCertificateName = "all.$Prefix.local"
  86. CommerceAuthoringDir = "$($Env:SYSTEMDRIVE)inetpubwwwroot$CommerceSiteName-authoring"
  87. CommerceAuthoringHostHeader = "commerce-authoring.$SiteName"
  88. CommerceAuthoringServicesPort = "443"
  89.  
  90. CommerceMinions = "$CommerceSiteName-minions"
  91. CommerceMinionsCertificateDnsName = "*.$Prefix.local"
  92. CommerceMinionsCertificateName = "all.$Prefix.local"
  93. CommerceMinionsDir = "$($Env:SYSTEMDRIVE)inetpubwwwroot$CommerceSiteName-minions"
  94. CommerceMinionsHostHeader = "commerce-minions.$SiteName"
  95. CommerceMinionsServicesPort = "443"
  96.  
  97. CommerceOps = "$CommerceSiteName-ops"
  98. CommerceOpsCertificateDnsName = "*.$Prefix.local"
  99. CommerceOpsCertificateName = "all.$Prefix.local"
  100. CommerceOpsDir = "$($Env:SYSTEMDRIVE)inetpubwwwroot$CommerceSiteName-ops"
  101. CommerceOpsHostHeader = "commerce-ops.$SiteName"
  102. CommerceOpsServicesPort = "443"
  103.  
  104. CommerceShops = "$CommerceSiteName-shops"
  105. CommerceShopsCertificateDnsName = "*.$Prefix.local"
  106. CommerceShopsCertificateName = "all.$Prefix.local"
  107. CommerceShopsDir = "$($Env:SYSTEMDRIVE)inetpubwwwroot$CommerceSiteName-shops"
  108. CommerceShopsHostHeader = "commerce-shops.$SiteName"
  109. CommerceShopsServicesPort = "443"
  110.  
  111. SitecoreIdentityServer = "$CommerceSiteName-identity"
  112. SitecoreIdentityServerCertificateDnsName = "*.$Prefix.local"
  113. SitecoreIdentityServerCertificateName = "all.$Prefix.local"
  114. SitecoreIdentityServerDir = "$($Env:SYSTEMDRIVE)inetpubwwwroot$CommerceSiteName-identity"
  115. SitecoreIdentityServerHostHeader = "identity.$SiteName"
  116. SitecoreIdentityServerServicesPort = "443"
  117.  
  118. SitecoreBizFx = "$CommerceSiteName-bizfx"
  119. SitecoreBizFxCertificateDnsName = "*.$Prefix.local"
  120. SitecoreBizFxCertificateName = "all.$Prefix.local"
  121. SitecoreBizFxDir = "$($Env:SYSTEMDRIVE)inetpubwwwroot$CommerceSiteName-bizfx"
  122. SitecoreBizFxHostHeader = "bizfx.$SiteName"
  123. SitecoreBizFxServicesPort = "443"
  124.  
  125. CommerceServicesPrefix = $Prefix
  126. CommerceEngineCertificatePath = "c:certificates$CommerceSiteName.crt"
  127. CommerceEngineCertificateName = $CommerceSiteName
  128.  
  129. # Packages
  130. PackageAdventureWorksImagesPath = Resolve-Path -Path "..Adventure Works Images.zip"
  131. PackageCEConnectPath = Resolve-Path -Path "..Sitecore.Commerce.Engine.Connect*.update"
  132. PackageCommerceConnectPath = Resolve-Path -Path "..Sitecore Commerce Connect*.zip"
  133. PackageCommerceEngineDacPacPath = Resolve-Path -Path "..Sitecore.Commerce.Engine.SDK.2.1.10Sitecore.Commerce.Engine.DB.dacpac"
  134. PackageHabitatImagesPath = Resolve-Path -Path "..Sitecore.Commerce.Habitat.Images-*.zip"
  135. PackagePowerShellExtensionsPath = Resolve-Path -Path "..Sitecore PowerShell Extensions-4.7.2 for Sitecore 8.zip"
  136. PackageSitecoreBizFxServicesContentDir = Resolve-Path -Path "..Sitecore.BizFX.1.1.9"
  137. PackageSitecoreCommerceEnginePath = Resolve-Path -Path "..Sitecore.Commerce.Engine.2.*.zip"
  138. PackageSitecoreIdentityServerPath = Resolve-Path -Path "..Sitecore.IdentityServer.1.*.zip"
  139. PackageSXACommercePath = Resolve-Path -Path "..Sitecore Commerce Experience Accelerator 1.*.zip"
  140. PackageSXAPath = Resolve-Path -Path "..Sitecore Experience Accelerator 1.7 rev. 180410 for 9.0.zip"
  141. PackageSXAStorefrontCatalogPath = Resolve-Path -Path "..Sitecore Commerce Experience Accelerator Habitat Catalog*.zip"
  142. PackageSXAStorefrontPath = Resolve-Path -Path "..Sitecore Commerce Experience Accelerator Storefront 1.*.zip"
  143. PackageSXAStorefrontThemePath = Resolve-Path -Path "..Sitecore Commerce Experience Accelerator Storefront Themes*.zip"
  144.  
  145. # Tools
  146. ToolsSiteUtilitiesDir = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "SiteUtilityPages" )
  147. ToolsMergeToolPath = Resolve-Path -Path "..Microsoft.Web.XmlTransform.dll"
  148.  
  149. # Accounts
  150. SitecoreUsername = $SitecoreUsername
  151. SitecoreUserPassword = $SitecoreUserPassword
  152.  
  153. UserAccount = @{
  154. Domain = $Env:COMPUTERNAME
  155. UserName = $CommerceServerUserName
  156. Password = $CommerceServerUserPassword
  157. }
  158.  
  159. BraintreeAccount = @{
  160. MerchantId = ''
  161. PublicKey = ''
  162. PrivateKey = ''
  163. }
  164. }
  165.  
  166. ### --------- HACK IGNORE UNTRUSTED CERT IN PS -----------------------------------------------------
  167. # if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type) {
  168. # $certCallback = @"
  169. # using System;
  170. # using System.Net;
  171. # using System.Net.Security;
  172. # using System.Security.Cryptography.X509Certificates;
  173. # public class ServerCertificateValidationCallback
  174. # {
  175. # public static void Ignore()
  176. # {
  177. # if(ServicePointManager.ServerCertificateValidationCallback ==null)
  178. # {
  179. # ServicePointManager.ServerCertificateValidationCallback +=
  180. # delegate
  181. # (
  182. # Object obj,
  183. # X509Certificate certificate,
  184. # X509Chain chain,
  185. # SslPolicyErrors errors
  186. # )
  187. # {
  188. # return true;
  189. # };
  190. # }
  191. # }
  192. # }
  193. # "@
  194. # Add-Type $certCallback
  195. # }
  196. # [ServerCertificateValidationCallback]::Ignore()
  197. ### --------------------------------------------------------------
  198.  
  199. ### --------- HACK DISABLE PASSWORD COMPLEXITY -------------------
  200. secedit /export /cfg c:secpol.cfg
  201. (gc C:secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:secpol.cfg
  202. secedit /configure /db c:windowssecuritylocal.sdb /cfg c:secpol.cfg /areas SECURITYPOLICY
  203. rm -force c:secpol.cfg -confirm:$false
  204. ### --------------------------------------------------------------
  205.  
  206. if ($commerceSearchProvider -eq "SOLR") {
  207. Install-SitecoreConfiguration @params
  208. }
  209. elseif ($commerceSearchProvider -eq "AZURE") {
  210. Install-SitecoreConfiguration @params -Skip InstallSolrCores
  211. }
  212.  
  213. [------------------------------------- CreateWebAppPoolOps : ManageCommerceService -----------------------------------]
  214. [CreateWebAppPoolOps]:[Create-WebAppPool] sc9u1.commerce-ops
  215. Creating and starting the sc9u1.commerce-ops Services application pool
  216. Creation of the sc9u1.commerce-ops Services application pool completed
  217.  
  218. [---------------------------------------- CreateWebsiteOps : ManageCommerceService -----------------------------------]
  219. WARNING: Could not find Cert: *.sc9u1.local in cert:LocalMachineMy
  220. [CreateWebsiteOps]:[Create-Website] sc9u1.commerce-ops
  221. Creating and starting the sc9u1.commerce-ops web site
  222.  
  223. Name ID State Physical Path Bindings
  224. ---- -- ----- ------------- --------
  225. sc9u1.commerce-o 10 Started C:inetpubwwwrootsc9u1.comme http *:80:
  226. ps rce-ops
  227. Creation and startup of the sc9u1.commerce-ops Services web site completed
  228.  
  229. Using provided certificate:
  230. Removing default HTTP binding
  231. Removed default HTTP binding
  232. Adding HTTPS binding
  233. Added HTTPS binding
  234. Associating SSL certificate with site
  235. **********************
  236. Command start time: 20180521165058
  237. **********************
  238. PS>TerminatingError(Invoke-ManageCommerceServiceTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Value does not fall within the expected range."
  239. >> TerminatingError(Invoke-ManageCommerceServiceTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Value does not fall within the expected range."
  240. Install-SitecoreConfiguration : Value does not fall within the expected range.
  241. At C:Program FilesWindowsPowerShellModulesSitecoreInstallFrameworkPublicInstall-SitecoreConfiguration.ps1:253
  242. char:21
  243. + & $entry.Task.Command @paramSet | Out-Default
  244. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  245. + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
  246. + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
  247. Install-SitecoreConfiguration : Value does not fall within the expected range.
  248. At C:Program FilesWindowsPowerShellModulesSitecoreInstallFrameworkPublicInstall-SitecoreConfiguration.ps1:253
  249. char:21
  250. + & $entry.Task.Command @paramSet | Out-Default
  251. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  252. + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
  253. + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
  254.  
  255. [TIME] 00:01:35
Add Comment
Please, Sign In to add comment