-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetupContentDelivery.ps1
More file actions
414 lines (322 loc) · 23.2 KB
/
SetupContentDelivery.ps1
File metadata and controls
414 lines (322 loc) · 23.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# The general idea with this script is that it should be mostly 'declarative'. In other words
# the choices you want to make about how your CD should be set up belong here. Detailed config-hacking
# grunge belongs in some more detailed script or other.
# Port numbers: default for Live. For staging add 1000
# TODO: Set up the DependsOn relationships
# REVIEW: Staging services are running with different names. The uninstallService.ps1 scripts /do/ look for serviceName.txt. Is that robust enough?
param(
[ValidateScript({Test-Path $_ -PathType 'Container'})]
[string]$InstallerDirectoryPath='C:\Users\Administrator.WEB85\Downloads\SDL Web 8.5',
[ValidateScript({Test-Path $_ -PathType 'Container'})]
[string]$DXAInstallerDirectoryPath='C:\Users\Administrator.WEB85\Downloads\SDL.DXA.Java.2.0.CTP.2',
[string]$ServicesDirectoryPath='C:\SDLServices',
[string]$LoggingOutputPath='C:\SDLServiceLogs',
[string]$DeployerStorage='C:\SDLDeployerStorage',
[ValidateScript({Test-Path -PathType Leaf -Path $_})]
$licenseLocation='C:\SdlLicenses\cd_licenses.xml',
$databaseServer='localhost',
[Parameter(Mandatory=$false, HelpMessage='The name clients will use to find the services')]
$domainName='sdlweb'
)
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
. "$scriptPath\Utilities.ps1"
if (-not (isAdministrator) ) {throw "There's a bad moon rising. Best to get admin rights!"}
# ValidateScript won't check the default value, so do it here
if (-not (Test-Path ($InstallerDirectoryPath + '\Content Delivery'))) {throw "That doesn't look like the installation directory: bailing...."}
if (-not (Test-path $ServicesDirectoryPath) ){
$ServicesDirectory = New-Item -ItemType Directory -Path $ServicesDirectoryPath
}
else {
$ServicesDirectory = Get-Item $ServicesDirectoryPath
}
set-location $ServicesDirectory
# DISCOVERY SERVICE - LIVE
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\discovery\standalone" "Discovery"
Copy-Item "$InstallerDirectoryPath\Content Delivery\roles\discovery\registration\discovery-registration.jar" "Discovery\config"
$discoveryStorageConfig = (resolve-path ("Discovery\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $discoveryStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Discovery' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
& "$ScriptPath\Merge-ConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-discoveryHost $domainName
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-roleName 'TokenServiceCapability' `
-roleUrl "http://$domainName`:8082/token.svc"
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("Discovery\config\logback.xml")) `
-logFolder "$LoggingOutputPath\Discovery"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebDiscoveryService --Description="SDL Web Discovery Service" `
--DisplayName="SDL Web Discovery Service" --server.port=8082
'@ > .\Discovery\bin\Invoke-InstallService.ps1
& .\Discovery\bin\Invoke-InstallService.ps1
# DISCOVERY SERVICE - STAGING
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\discovery\standalone" "StagingDiscovery"
Copy-Item "$InstallerDirectoryPath\Content Delivery\roles\discovery\registration\discovery-registration.jar" "StagingDiscovery\config"
$stagingDiscoveryStorageConfig = (resolve-path ("StagingDiscovery\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Discovery_Staging' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
& "$ScriptPath\Merge-ConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-discoveryHost $domainName `
-discoveryPort 9082 `
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'TokenServiceCapability' `
-roleUrl "http://$domainName`:9082/token.svc"
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("StagingDiscovery\config\logback.xml")) `
-logFolder "$LoggingOutputPath\StagingDiscovery"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebStagingDiscoveryService --Description="SDL Web Staging Discovery Service" `
--DisplayName="SDL Web Staging Discovery Service" --server.port=9082
'@ > .\StagingDiscovery\bin\Invoke-InstallService.ps1
& .\StagingDiscovery\bin\Invoke-InstallService.ps1
# DEPLOYER SERVICES
# Either deployer-combined or deployer/deployer-worker
# We'll start with deployer-combined
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\deployer\deployer-combined\standalone" "Deployer"
$deployerStorageConfig = (resolve-path ("Deployer\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $deployerStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Broker' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
$deployerConfig = (resolve-path ("Deployer\config\deployer-conf.xml"))
& "$ScriptPath\Merge-Deployer.ps1" -deployerConfig $deployerConfig `
-dbAdapter 'mssql' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Deployer_State' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-binaryStoragePath "$DeployerStorage\Live\Binary" `
-queuePath "$DeployerStorage\Live\Queue" `
-licenseLocation $licenseLocation `
-stripComments
# <Role Name="DeployerCapability" Url="${deployerurl:-http://localhost:8084/httpupload}">
# <Property Name="encoding" Value="UTF-8" />
# </Role>
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-roleName 'DeployerCapability' `
-roleUrl "http://$($domainName):8084/httpupload" `
-roleProperties @{encoding='UTF-8'}
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("Deployer\config\logback.xml")) `
-logFolder "$LoggingOutputPath\Deployer"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebDeployerService --Description="SDL Web Deployer Service" `
--DisplayName="SDL Web Deployer Service" --server.port=8084
'@ > .\Deployer\bin\Invoke-InstallService.ps1
& .\Deployer\bin\Invoke-InstallService.ps1
# STAGING DEPLOYER
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\deployer\deployer-combined\standalone" "StagingDeployer"
$stagingDeployerStorageConfig = (resolve-path ("StagingDeployer\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $stagingDeployerStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Broker_Staging' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
$stagingDeployerConfig = (resolve-path ("StagingDeployer\config\deployer-conf.xml"))
& "$ScriptPath\Merge-Deployer.ps1" -deployerConfig $stagingDeployerConfig `
-dbAdapter 'mssql' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Deployer_State_Staging' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-binaryStoragePath "$DeployerStorage\Staging\Binary" `
-queuePath "$DeployerStorage\Staging\Queue" `
-licenseLocation $licenseLocation `
-stripComments
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'DeployerCapability' `
-roleUrl "http://$($domainName):9084/httpupload" `
-roleProperties @{encoding='UTF-8'}
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("StagingDeployer\config\logback.xml")) `
-logFolder "$LoggingOutputPath\StagingDeployer"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebStagingDeployerService --Description="SDL Web Staging Deployer Service" `
--DisplayName="SDL Web Staging Deployer Service" --server.port=9084
'@ > .\StagingDeployer\bin\Invoke-InstallService.ps1
& .\StagingDeployer\bin\Invoke-InstallService.ps1
# Live Content service (therefore not Session-Enabled)
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\content\standalone" "Content"
$contentStorageConfig = (resolve-path ("Content\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $contentStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Broker' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-roleName 'ContentServiceCapability' `
-roleUrl "http://$($domainName):8081/content.svc"
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-roleName 'WebCapability'
# Content service needs to be able to find its discovery
& "$ScriptPath\Merge-ConfigRepository.ps1" -storageConfig $contentStorageConfig `
-discoveryHost 'localhost'
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("Content\config\logback.xml")) `
-logFolder "$LoggingOutputPath\Content"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebContentService --Description="SDL Web Content Service" `
--DisplayName="SDL Web Content Service" --server.port=8081
'@ > .\Content\bin\Invoke-InstallService.ps1
& .\Content\bin\Invoke-InstallService.ps1
# Staging Content service (therefore Session-Enabled)
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\session\service\standalone" "StagingContent"
$stagingContentStorageConfig = (resolve-path ("StagingContent\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $stagingContentStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Broker_Staging' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $stagingContentStorageConfig `
-storageToUpdate "/Configuration/Global/Storages/Wrappers/Wrapper[@Name='SessionWrapper']/Storage[@Id='sessionDb']" `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Preview' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1'
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'ContentServiceCapability' `
-roleUrl "http://$($domainName):9081/content.svc"
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'WebCapability'
& "$ScriptPath\Merge-ConfigRepository.ps1" -storageConfig $stagingContentStorageConfig `
-discoveryHost 'localhost' `
-discoveryPort 9082 `
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("StagingContent\config\logback.xml")) `
-logFolder "$LoggingOutputPath\StagingContent"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebStagingContentService --Description="SDL Web Staging Content Service" `
--DisplayName="SDL Web Staging Content Service" --server.port=9081
'@ > .\StagingContent\bin\Invoke-InstallService.ps1
& .\StagingContent\bin\Invoke-InstallService.ps1
#Preview
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\preview\standalone" "Preview"
$previewStorageConfig = (resolve-path ("Preview\config\cd_storage_conf.xml"))
# First fix up the normal storage
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $previewStorageConfig `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Broker_Staging' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1' `
-licenseLocation $licenseLocation `
-stripComments
# Then call the same script again to do the preview storage in the wrapper
& "$ScriptPath\Merge-Storage.ps1" -storageConfig $previewStorageConfig `
-storageToUpdate "/Configuration/Global/Storages/Wrappers/Wrapper[@Name='SessionWrapper']/Storage[@Id='sessionDb']" `
-dbType 'MSSQL' `
-dbHost $databaseServer `
-dbPort 1433 `
-dbName 'Tridion_Preview' `
-dbUser 'TridionBrokerUser' `
-dbPassword 'Tridion1'
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'PreviewWebServiceCapability' `
-roleUrl "http://$($domainName):8083/ws/preview.svc"
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("Preview\config\logback.xml")) `
-logFolder "$LoggingOutputPath\Preview"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLWebSessionPreviewService --Description="SDL Web Session Preview Service" `
--DisplayName="SDL Web Session Preview Service" --server.port=8083
'@ > .\Preview\bin\Invoke-InstallService.ps1
& .\Preview\bin\Invoke-InstallService.ps1
# Live DXA Model service
Copy-Item -Recurse "$DXAInstallerDirectoryPath\cis\dxa-model-service\standalone" "DxaModel"
$discoveryStorageConfig = (resolve-path ("Discovery\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-roleName 'ContentServiceCapability' `
-roleProperties @{'dxa-model-service'="http://$($domainName):8998"}
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("DxaModel\config\logback.xml")) `
-logFolder "$LoggingOutputPath\DxaModel"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLDXAModelService --Description="SDL DXA Model Service" `
--DisplayName="SDL DXA Model Service" --server.port=8998 --DependsOn=SDLWebDiscoveryService
'@ > .\DxaModel\bin\Invoke-InstallService.ps1
& .\DxaModel\bin\Invoke-InstallService.ps1
# Staging DXA Model service
Copy-Item -Recurse "$DXAInstallerDirectoryPath\cis\dxa-model-service\standalone" "StagingDxaModel"
$stagingDiscoveryStorageConfig = (resolve-path ("StagingDiscovery\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'ContentServiceCapability' `
-roleProperties @{'dxa-model-service'="http://$($domainName):9998"}
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("StagingDxaModel\config\logback.xml")) `
-logFolder "$LoggingOutputPath\StagingDxaModel"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLDXAStagingModelService --Description="SDL DXA Staging Model Service" `
--DisplayName="SDL DXA Staging Model Service" --server.port=9998 --DependsOn=SDLWebStagingDiscoveryService
'@ > .\StagingDxaModel\bin\Invoke-InstallService.ps1
& .\StagingDxaModel\bin\Invoke-InstallService.ps1
# CONTEXT SERVICE - LIVE
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\context\service\standalone" "Context"
$discoveryStorageConfig = (resolve-path ("Discovery\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $discoveryStorageConfig `
-roleName 'ContextServiceCapability' `
-roleUrl "http://$($domainName):8087"
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("Context\config\logback.xml")) `
-logFolder "$LoggingOutputPath\Context"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLContextService --Description="SDL Context Service" `
--DisplayName="SDL Context Service" --server.port=8087 --DependsOn=SDLWebDiscoveryService
'@ > .\Context\bin\Invoke-InstallService.ps1
& .\Context\bin\Invoke-InstallService.ps1
# CONTEXT SERVICE - STAGING
Copy-Item -Recurse "$InstallerDirectoryPath\Content Delivery\roles\context\service\standalone" "StagingContext"
$stagingDiscoveryStorageConfig = (resolve-path ("StagingDiscovery\config\cd_storage_conf.xml"))
& "$ScriptPath\Merge-RoleToConfigRepository.ps1" -storageConfig $stagingDiscoveryStorageConfig `
-roleName 'ContextServiceCapability' `
-roleUrl "http://$($domainName):9087"
& "$ScriptPath\Merge-Logback.ps1" -logbackFile (resolve-path ("StagingContext\config\logback.xml")) `
-logFolder "$LoggingOutputPath\StagingContext"
@'
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
& $scriptPath\installService.ps1 --Name=SDLStagingContextService --Description="SDL Staging Context Service" `
--DisplayName="SDL Staging Context Service" --server.port=9087 --DependsOn=SDLWebStagingDiscoveryService
'@ > .\StagingContext\bin\Invoke-InstallService.ps1
& .\StagingContext\bin\Invoke-InstallService.ps1
#REGISTER
pushd StagingDiscovery\config
& java -jar discovery-registration.jar update
popd
pushd Discovery\config
& java -jar discovery-registration.jar update
popd