-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSolr-SingleDeveloper.json
More file actions
336 lines (325 loc) · 15.1 KB
/
Solr-SingleDeveloper.json
File metadata and controls
336 lines (325 loc) · 15.1 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
{
"Parameters": {
"SolrVersion": {
"Type": "String",
"Description": "The version of Solr to install",
"DefaultValue": "8.1.1",
"Validate": "[variable('Test.Solr.Download.Availability')]"
},
"SolrDomain": {
"Type": "String",
"Description" : "The url/domain for Solr, used to create Self-Signed SSL Certificate",
"DefaultValue" : "localhost"
},
"SolrPort": {
"Type": "Int",
"Description": "The Solr port.",
"DefaultValue": 8983
},
"SolrServicePrefix": {
"Type": "String",
"Description": "The Solr service prefix name.",
"DefaultValue": ""
},
"SolrInstallRoot": {
"Type": "String",
"Description": "The file path to install Solr. This config will add the prefix and solr version e.g C:\\Solr becomes C:\\Solr\\[SolrServicePrefix]Solr-8.1.1",
"DefaultValue": "C:\\Solr\\"
},
"SolrSourceURL": {
"Type": "String",
"Description" : "Solr download archive location",
"DefaultValue" : "http://archive.apache.org/dist/lucene/solr"
},
"JavaDownloadURL": {
"Type": "String",
"Description": "Download location of AdoptOpenJDK",
"DefaultValue": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jre_x64_windows_hotspot_8u222b10.zip"
},
"ApacheCommonsDaemonURL" : {
"Type": "String",
"Description": "Download Location of Apache Commons Daemon",
"DefaultValue": "http://archive.apache.org/dist/commons/daemon/binaries/windows/commons-daemon-1.1.0-bin-windows.zip"
},
"TempLocation": {
"Type": "String",
"Description": "Alternative location to save downloads. If left on the default $Env:Temp will be used.",
"DefaultValue": "SIF-Default",
"Validate": "[TestPath(variable('Temp.Location'))]"
},
"ServiceLocation": {
"Type": "String",
"Description": "Registry location of Windows Services.",
"DefaultValue": "HKLM:SYSTEM\\CurrentControlSet\\Services"
}
},
"Variables": {
"Solr.Download.URL": "[join(Values:variable('Solr.Path'),Delimiter:'/')]",
"Solr.Path": [
"[parameter('SolrSourceURL')]",
"[parameter('SolrVersion')]",
"[concat(variable('Solr.FileName'),'.zip')]"
],
"Solr.FileName": "[concat('solr-',parameter('SolrVersion'))]",
"Solr.Service": "[concat(parameter('SolrServicePrefix'),variable('Solr.FileName'))]",
"Solr.Install.Path": "[JoinPath(parameter('SolrInstallRoot'),variable('Solr.Service'))]",
"Java.Install.Path": "[GetItem(Path:JoinPath(variable('Solr.Install.Path'),'jdk*'))]",
"ACD.Install.Path": "[JoinPath(variable('Solr.Install.Path'),'daemon')]",
"Temp.Location" : "[if(variable('Test.Temp.Location'),Environment('Temp'),parameter('TempLocation'))]",
"Test.Temp.Location" : "[equal(parameter('TempLocation'),'SIF-Default')]",
"Check.Solr.Path": "[if(variable('Test.Solr.Path'),'*** Solr install path is not available. ***','Solr install path is available.')]",
"Check.Solr.Service": "[if(variable('Test.Solr.Service'),'*** Solr service already exists. ***','Solr service name is available.')]",
"Check.Solr.Port": "[if(variable('Test.Solr.Port'),'*** Solr port is in use. ***','Solr port is available.')]",
"Test.Solr": "[or(variable('Test.Solr.Path'),variable('Test.Solr.Service'),variable('Test.Solr.Port'))]",
"Test.Solr.Path": "[TestPath(variable('Solr.Install.Path'))]",
"Test.Solr.Service": "[TestPath(JoinPath(parameter('ServiceLocation'),variable('Solr.Service')))]",
"Test.Solr.Port": "[SelectObject(InputObject:variable('Ping.Solr.Port'),ExpandProperty:'TCPTestSucceeded')]",
"Ping.Solr.Port": "[TestNetConnection(Port:parameter('SolrPort'),Computer:'Localhost',WarningAction:'SilentlyContinue')]",
"Test.Solr.Download.Availability": "[Equal(variable('Solr.Download.StatusCode'),200)]",
"Solr.Download.StatusCode": "[SelectObject(InputObject:variable('Get.Solr.Download.Availability'),ExpandProperty:'StatusCode')]",
"Get.Solr.Download.Availability":"[InvokeWebRequest(URI:variable('Solr.Download.URL'),Method:'head',UseBasicParsing:true)]",
"Java.Download.Temp": "[JoinPath(variable('Temp.Location'),'java.zip')]",
"ACD.Download.Temp": "[JoinPath(variable('Temp.Location'),'ACD.zip')]",
"Solr.Download.Temp" : "[JoinPath(variable('Temp.Location'),'solr.zip')]",
"KeyStoreFilePath": "[JoinPath(variable('Solr.Install.Path'),'server','etc')]",
"KeyStoreFile": "solr-ssl.keystore",
"Secure.Solr.Key.Password": "[ConvertToSecureString(String:variable('Plaintext.Solr.Key.Password'),AsPlainText:True,Force:True)]",
"Plaintext.Solr.Key.Password": "[RandomString(Length:20,DisAllowSpecial:True)]",
"Solr.JKS.Keystore.Path": "[concat(variable('Solr.Install.Path'),'\\server\\etc\\solr-ssl.keystore.jks')]",
"Solr.P12.Keystore.Path": "[concat(variable('Solr.Install.Path'),'\\server\\etc\\solr-ssl.keystore.p12')]",
"Java.KeyTool.Location": "[JoinPath(variable('Java.Install.Path'),'bin','keytool.exe')]",
"ACD.Binary.Location": "[JoinPath(variable('ACD.Install.Path'),'amd64','prunsrv.exe')]",
"Solr.Bin.Location": "[JoinPath(variable('Solr.Install.Path'),'bin')]",
"Solr.CMD.Location" : "[JoinPath(variable('Solr.Bin.Location'),'Solr.cmd')]",
"Solr.In.CMD.Location" : "[JoinPath(variable('Solr.Bin.Location'),'Solr.in.cmd')]"
},
"Register":{
"Tasks":{
"StartProcess" : "Start-Process",
"ExpandArchive" : "Expand-Archive",
"AddContent" : "Add-Content",
"RemoveItem": "Remove-Item",
"MoveItem": "Move-Item",
"WriteInformation": "Write-Information",
"WriteError": "Write-Error"
},
"ConfigFunction":{
"SelectObject": "Select-Object",
"InvokeWebRequest": "Invoke-WebRequest",
"ConvertToSecureString": "ConvertTo-SecureString",
"TestPath": "Test-Path",
"GetItem": "Get-Item",
"TestNetConnection": "Test-NetConnection"
}
},
"Tasks": {
"TestSolrPath":{
"Description": "Detects if Solr path has already been used.",
"Type": "WriteInformation",
"Params": {
"MessageData": "[variable('Check.Solr.Path')]",
"InformationAction": "Continue"
}
},
"TestSolrService":{
"Description": "Detects if Solr service name has already been used.",
"Type": "WriteInformation",
"Params": {
"MessageData": "[variable('Check.Solr.Service')]",
"InformationAction": "Continue"
}
},
"TestSolrPort":{
"Description": "Detects if the Solr port is in use.",
"Type": "WriteInformation",
"Params": {
"MessageData": "[variable('Check.Solr.Port')]",
"InformationAction": "Continue"
}
},
"ThrowIfTestsFail":{
"Description": "Errors out if any of the tests fail.",
"Type": "WriteError",
"Params": {
"Exception": "Solr cannot be installed. Check the logs for the reason."
},
"Skip": "[not(variable('Test.Solr'))]"
},
"CreateSolrFolder":{
"Description": "Ensures the Solr install folder is available.",
"Type": "EnsurePath",
"Params": {
"Exists": "[variable('Solr.Install.Path')]"
}
},
"DownloadSolr" :{
"Description": "Downloads Solr.",
"Type": "DownloadFile",
"Params" :{
"SourceUri" : "[variable('Solr.Download.URL')]",
"DestinationPath" : "[variable('Solr.Download.Temp')]"
}
},
"UnpackSolr" : {
"Description": "Unpacks Solr.",
"Type": "ExpandArchive",
"Params" : {
"Path" : "[variable('Solr.Download.Temp')]",
"DestinationPath" : "[variable('Temp.Location')]",
"Force": true
}
},
"MoveSolr": {
"Description": "Move Solr to working folder.",
"Type": "MoveItem",
"Params": {
"Path": "[JoinPath(variable('Temp.Location'),variable('Solr.Filename'),'*')]",
"Destination": "[variable('Solr.Install.Path')]"
}
},
"DownloadJavaX64": {
"Description": "Downloads Java x64.",
"Type": "DownloadFile",
"Params": {
"SourceUri" : "[parameter('JavaDownloadURL')]",
"DestinationPath" : "[variable('Java.Download.Temp')]"
}
},
"InstallJavaX64": {
"Description": "Installs Java x64.",
"Type": "ExpandArchive",
"Params": {
"Path": "[variable('Java.Download.Temp')]",
"DestinationPath": "[variable('Solr.Install.Path')]"
}
},
"CreateSolrSSL": {
"Description": "Creates a website certificate for the Solr website.",
"Type": "StartProcess",
"Params": {
"FilePath": "[variable('Java.KeyTool.Location')]",
"ArgumentList": "[concat('-genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore ',variable('Solr.JKS.Keystore.Path'),' -ext SAN=',concat('DNS:',parameter('solrdomain'),',DNS:localhost',',IP:127.0.0.1'),' -dname \"CN=solrcert, OU=Created by https://www.sitecore.com\"')]",
"Wait": true
}
},
"GenerateP12": {
"Description": "Generate P12 certificate.",
"Type": "StartProcess",
"Params": {
"FilePath": "[variable('Java.KeyTool.Location')]",
"ArgumentList": "[concat('-importkeystore -srckeystore ',variable('Solr.JKS.Keystore.Path'),' -destkeystore ',variable('Solr.P12.Keystore.Path'),' -srcstoretype jks -deststoretype pkcs12 -deststorepass secret -srcstorepass secret')]",
"Wait": true
}
},
"ImportSolrSSL" :{
"Description": "Import Certificate to store.",
"Type": "StartProcess",
"Params" : {
"FilePath": "certutil.exe",
"ArgumentList":
"[concat('-f -p secret -importpfx ',variable('Solr.P12.Keystore.Path'))]",
"Wait" : true
}
},
"AddSOLRConfiguration": {
"Description": "Adds the SSL keys and Java location to the configuration.",
"Type": "AddContent",
"Params": {
"Value": [
"[concat('set SOLR_JAVA_HOME=\"',variable('Java.Install.Path'),'\"')]",
"set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks",
"set SOLR_SSL_KEY_STORE_PASSWORD=secret",
"set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks",
"set SOLR_SSL_TRUST_STORE_PASSWORD=secret",
"[concat('set SOLR_HOST=\"',parameter('SolrDomain'),'\"')]",
"[concat('set SOLR_Port=',parameter('SolrPort'))]"
],
"Path": "[variable('Solr.In.CMD.Location')]"
}
},
"CreateACDFolder": {
"Type": "EnsurePath",
"Description": "Create path to install Apache Commons Daemon.",
"Params": {
"Exists" : "[variable('ACD.Install.Path')]"
}
},
"DownloadACD": {
"Description": "Downloads Apache Commons Daemon.",
"Type": "DownloadFile",
"Params": {
"SourceUri" : "[parameter('ApacheCommonsDaemonURL')]",
"DestinationPath" : "[variable('ACD.Download.Temp')]"
}
},
"InstallACD":{
"Description": "Unpacks Apache Commons Daemon",
"Type": "ExpandArchive",
"Params": {
"Path": "[variable('ACD.Download.Temp')]",
"DestinationPath": "[variable('ACD.Install.Path')]"
}
},
"CreateSOLRService":{
"Description": "Creates Solr Service",
"Type": "StartProcess",
"Params": {
"FilePath": "[variable('ACD.Binary.Location')]",
"ArgumentList": [
"[concat('install ',variable('Solr.Service'))]",
"[concat('--DisplayName=\"',variable('Solr.Service'),'\"')]",
"--Startup=auto",
"--StartMode=exe",
"[concat('--StartImage=\"',variable('Solr.CMD.Location'),'\"')]",
"[concat('--StartPath=\"',variable('Solr.Bin.Location'),'\"')]",
"++StartParams=\"start\"",
"--StopMode=exe",
"[concat('--StopImage=\"',variable('Solr.CMD.Location'),'\"')]",
"[concat('--StopPath=\"',variable('Solr.Bin.Location'),'\"')]",
"++StopParams=\"stop\"",
"--StopTimeout=10",
"--StdOutput=auto",
"--StdError=auto"
],
"Wait": true
}
},
"StartSolr": {
"Description": "Runs the Solr service.",
"Type": "ManageService",
"Params": {
"Name": "[variable('Solr.Service')]",
"Status": "Running",
"PostDelay": 8000
}
}
},
"UninstallTasks": {
"StopSolrService": {
"Description" : "Stops the Solr Service",
"Type": "ManageService",
"Params": {
"Name": "[variable('Solr.Service')]",
"Status": "Stopped",
"PostDelay": 4000
}
},
"RemoveSolrService": {
"Description": "Removes the Solr Service.",
"Type": "StartProcess",
"Params": {
"FilePath": "[variable('ACD.Binary.Location')]",
"ArgumentList": "[concat('delete ',variable('Solr.Service'))]",
"Wait": true
}
},
"RemoveSolrFiles": {
"Description": "Remove Solr folder and all files therein.",
"Type": "RemoveItem",
"Params": {
"Path": "[variable('Solr.Install.Path')]",
"Recurse": true
}
}
}
}