This repository has been archived by the owner on May 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.yml
523 lines (484 loc) · 16.1 KB
/
install.yml
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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
---
type: install
version: 1.5.2
name: Jahia - Install
logo: /images/jahia-logo-70x70.png
id: jahia-jelastic
description:
short: Jahia - Install
text: Digital Experience Manager gives you an agile customizable platform that
manages your entire digital ecosystem to innovate and deliver great customer
experiences, foster internal collaboration and support dynamic business
needs for sustainable growth.
globals:
haproxy_admin_stats_pass: ${fn.password(20)}
healthcheck_token: ${fn.password(20)}
db_user: jahia-db-${fn.random}
db_pass: ${fn.password(20)}
db_user_datadog: ${fn.password(20)}
redis_pass: ${fn.password(20)}
mngr_user: manager
dx_version: ${settings.productVersion}
operating_mode: ${settings.mode}
datadog_key: ${settings.ddogApikey}
shortdomain: ${settings.shortdomain}
jahia_docker_image: ${settings.jahiaDockerImage}
vault_role_id: ${settings.vaultRoleId}
vault_secret_id: ${settings.vaultSecretId}
vault_cluster_url: ${settings.vaultClusterUrl}
dbnodeType: mariadb-dockerized
xms: 256M
xmx: 2584M
expandImportedFilesOnDisk: "true"
jahiaFileUploadMaxSize: 268435456
imageService: ImageMagickImageService
jahiaImageMagickPath: /opt/magick/bin
org_jahia_ehcachemanager_maxBytesLocalHeap_dev: 700M
org_jahia_ehcachemanager_big_maxBytesLocalHeap_dev: 700M
org_jahia_ehcachemanager_maxBytesLocalHeap_prod: 800M
org_jahia_ehcachemanager_big_maxBytesLocalHeap_prod_cp: 2500M
org_jahia_ehcachemanager_big_maxBytesLocalHeap_prod_proc: 700M
java_opts:
-DDB_USER=${DB_USER}
-DDB_PASSWORD=${DB_PASSWORD}
-DREDIS_PASSWORD=${REDIS_PASSWORD}
-DMANAGER_USER=${MANAGER_USER}
-DHOST_NAME=$(hostname)
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=7199
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-XX:MaxPermSize=512m
-XX:+HeapDumpOnOutOfMemoryError
-XX:+PrintConcurrentLocks
-XX:+UseParallelGC
-XX:SurvivorRatio=8
-Xmn1G
ssl: true
skipNodeEmails: true
mixins:
- common/common_actions.yml
- haproxy/haproxy_actions.yml
- jahia/jahia_actions.yml
- database/mariadb_actions.yml
- database/galera_actions.yml
- database/proxysql_actions.yml
onBeforeInstall: |
nodes = []
var cp_cloudlets = '${globals.operating_mode}' == 'production' ? 64 : 40;
var proc_cloudlets = cp_cloudlets;
var db_cloudlets = '${globals.operating_mode}' == 'production' ? 40 : 32;
var db_scheme = '${globals.operating_mode}' == 'production' ? 'galera' : 'galera';
var db_count = '${globals.operating_mode}' == 'production' ? 3 : 1;
var xmx_browsing = '${globals.operating_mode}' == 'production' ? '5000M' : '${globals.xmx}';
var xmx_processing = '${globals.operating_mode}' == 'production' ? '3584M' : '${globals.xmx}';
var dockerImage = "${globals.jahia_docker_image}";
node_haproxy = {
"displayName": "Haproxy",
"nodeGroup": "bl",
"nodeType": "haproxy",
"tag": "2.1.4",
"count": 2,
"cloudlets": 8,
"env": {
"DATADOGAPIKEY": "${globals.datadog_key}",
"_PROVIDE": "haproxy",
"_ROLE": "reverse_proxy",
"envName": "${globals.shortdomain}",
"jahia_cfg_healthcheck_token": "${globals.healthcheck_token}",
"VAULT_ROLE_ID": "${globals.vault_role_id}",
"VAULT_SECRET_ID": "${globals.vault_secret_id}",
"VAULT_CLUSTER_URL": "${globals.vault_cluster_url}",
},
"distribution": {
"mode": "STRICT",
"zones": [
{high_iops: false}
]
},
"volumes": [
"/etc/haproxy"
]
}
nodes.push(node_haproxy);
node_cp = {
"displayName": "Browsing",
"count": "${settings.browsingCount}",
"cloudlets": cp_cloudlets,
"nodeGroup": "cp",
"links": "sqldb:" + db_scheme,
"startServiceOnCreation": false,
"isSLBAccessEnabled": false,
"env": {
"DB_USER": "${globals.db_user}",
"DB_PASSWORD": "${globals.db_pass}",
"MANAGER_USER": "${globals.mngr_user}",
"REDIS_PASSWORD": "${globals.redis_pass}",
"XMS": "${globals.xms}",
"XMX": xmx_browsing,
"DATADOGAPIKEY": "${globals.datadog_key}",
"DX_VERSION": "${globals.dx_version}",
"jahia_cfg_operatingMode": "${globals.operating_mode}",
"_PROVIDE": "jahia",
"_ROLE": "Browsing",
"envName": "${globals.shortdomain}",
"DB_ENDPOINT": db_scheme,
"jahia_cfg_healthcheck_token": "${globals.healthcheck_token}",
"VAULT_ROLE_ID": "${globals.vault_role_id}",
"VAULT_SECRET_ID": "${globals.vault_secret_id}",
"VAULT_CLUSTER_URL": "${globals.vault_cluster_url}",
"HEALTHCHECK_DURATION": "240",
},
"distribution": {
"mode": "STRICT",
"zones": [
{high_iops: false}
]
}
}
if (dockerImage == "undefined") {
node_cp['nodeType'] = "jahia";
node_cp['tag'] = "${globals.dx_version}";
} else {
node_cp['image'] = dockerImage;
}
nodes.push(node_cp);
node_proc = {
"displayName": "Processing",
"count": "1",
"cloudlets": proc_cloudlets,
"nodeGroup": "proc",
"links": "sqldb:" + db_scheme,
"startServiceOnCreation": false,
"isSLBAccessEnabled": false,
"env": {
"DB_USER": "${globals.db_user}",
"DB_PASSWORD": "${globals.db_pass}",
"MANAGER_USER": "${globals.mngr_user}",
"REDIS_PASSWORD": "${globals.redis_pass}",
"XMS": "${globals.xms}",
"XMX": xmx_processing,
"DATADOGAPIKEY": "${globals.datadog_key}",
"DX_VERSION": "${globals.dx_version}",
"jahia_cfg_operatingMode": "${globals.operating_mode}",
"_PROVIDE": "jahia",
"_ROLE": "Processing",
"envName": "${globals.shortdomain}",
"DB_ENDPOINT": db_scheme,
"jahia_cfg_healthcheck_token": "${globals.healthcheck_token}",
"VAULT_ROLE_ID": "${globals.vault_role_id}",
"VAULT_SECRET_ID": "${globals.vault_secret_id}",
"VAULT_CLUSTER_URL": "${globals.vault_cluster_url}",
"HEALTHCHECK_DURATION": "240",
},
"distribution": {
"mode": "STRICT",
"zones": [
{high_iops: false}
]
}
}
if (dockerImage == "undefined") {
node_proc['nodeType'] = "jahia";
node_proc['tag'] = "${globals.dx_version}";
} else {
node_proc['image'] = dockerImage;
}
nodes.push(node_proc);
node_mariadb = {
"nodeType": "${globals.dbnodeType}",
"nodeGroup": "sqldb",
"tag": "10.4.13",
"count": db_count,
"cloudlets": db_cloudlets,
"isSLBAccessEnabled": false,
"env": {
"ADMINPANEL_ENABLED": false,
"DATADOGAPIKEY": "${globals.datadog_key}",
"DB_USER_DATADOG": "${globals.db_user_datadog}",
"PHPMYADMIN_ENABLED": false,
"DB_USER": "${globals.db_user}",
"DB_PASS": "${globals.db_pass}",
"_PROVIDE": "Database",
"_ROLE": db_scheme,
"envName": "${globals.shortdomain}",
"jahia_cfg_operatingMode": "${globals.operating_mode}",
},
"distribution": {
"mode": "STRICT",
"zones": [
{high_iops: false}
]
}
}
nodes.push(node_mariadb);
var resp = {
result: 0,
nodes: nodes
};
return resp;
nodes: definedInOnBeforeInstall
# --Events --
onInstall:
- log: "## Beginning installation of Jahia"
- setJournaldLimit
- installDatabase
- finishProxysqlInstall
- installJahia
- installHaproxy
- getLogEventScript: bl, proc, cp, sqldb
- setupDatadogAgentSql: sqldb
- setupDatadogAgent: cp, proc
- setupDatadogAgentHaproxy: bl
- getReleaseMajorVersion
- setEnvVersion: ${globals.envVersion}
- startupJahiaHealthCheck: cp, proc
onBeforeScaleIn[cp]:
- forEach(event.response.nodes):
- removeNodeFromHaproxy:
nodeId: ${@i.id}
nodeIp: ${@i.intIP}
onAfterScaleIn[cp]:
- refreshProxysqlInstancesList
onAfterServiceScaleOut[cp]:
- forEach(event.response.nodes):
- onAfterBrowsingScaleOut:
newNode: ${@i.id}
- resetHaproxyBackends
- refreshProxysqlInstancesList
onBeforeRestartNode[cp]:
removeNodeFromHaproxy:
nodeId: ${event.params.nodeId}
onAfterRestartNode[cp]:
forEach(nodes.cp):
if ("${event.params.nodeId}" == "${@i.id}"):
- startupJahiaHealthCheck: ${event.params.nodeId}
- addNodeToHaproxy:
nodeId: ${@i.id}
nodeIp: ${@i.intIP}
onAfterRestartNode[proc]:
startupJahiaHealthCheck: ${event.params.nodeId}
onBeforeRedeployContainer[cp]:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
- forEach(nodes.cp):
removeNodeFromHaproxy:
nodeId: ${@i.id}
- cmd [cp]: |-
service tomcat stop
user: root
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
- removeNodeFromHaproxy:
nodeId: ${event.params.nodeId}
- cmd [${event.params.nodeId}]: |-
service tomcat stop
user: root
onAfterRedeployContainer[cp]:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
- onAfterRedeployJahiaContainer: ${event.params.nodeGroup}
- startupJahiaHealthCheck: ${event.params.nodeGroup}
- resetHaproxyBackends
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
- onAfterRedeployJahiaContainer: ${event.params.nodeId}
- forEach(nodes.cp):
if ("${event.params.nodeId}" == "${@i.id}"):
- startupJahiaHealthCheck: ${event.params.nodeId}
- addNodeToHaproxy:
nodeId: ${@i.id}
nodeIp: ${@i.intIP}
onBeforeRedeployContainer[proc]:
- cmd [proc]: |-
service tomcat stop
user: root
onAfterRedeployContainer[proc]:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
- onAfterRedeployJahiaContainer: ${event.params.nodeGroup}
- cmd [proc]: |-
echo $JAHIA_UPGRADE
user: root
- if ('${response.out}' == ''):
startupJahiaHealthCheck: ${event.params.nodeGroup}
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
- onAfterRedeployJahiaContainer: ${event.params.nodeId}
- startupJahiaHealthCheck: ${event.params.nodeId}
onAfterRedeployContainer[bl]:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
- setSudoer: ${event.params.nodeGroup}
- splitHaproxyConf: ${event.params.nodeGroup}
- setupDatadogAgentHaproxy: ${event.params.nodeGroup}
- environment.control.ApplyNodeGroupData [bl]:
data:
productName: haproxy
productVersion: ${nodes.bl.first.version}
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
- setSudoer: ${event.params.nodeId}
- splitHaproxyConf: ${event.params.nodeId}
- setupDatadogAgentHaproxy: ${event.params.nodeId}
- environment.control.ApplyNodeGroupData [bl]:
data:
productName: haproxy
productVersion: ${nodes.bl.first.version}
onBeforeRedeployContainer[sqldb]:
# disable mysql autostart because JEM will do it
- if ('${event.params.nodeGroup:}'):
- mysqlService:
target: ${event.params.nodeGroup}
action: disable
- elif ('${event.params.nodeId:}'):
- mysqlService:
target: ${event.params.nodeId}
action: disable
onAfterRedeployContainer[sqldb]:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
- setSudoer: ${event.params.nodeGroup}
- setupDatadogAgentSql: ${event.params.nodeGroup}
- mysqlService:
target: ${event.params.nodeGroup}
action: enable
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
- setSudoer: ${event.params.nodeId}
- setupDatadogAgentSql: ${event.params.nodeId}
- mysqlService:
target: ${event.params.nodeId}
action: enable
onBeforeStop:
- stopJahia: cp, proc
- stopGalera
- logEvent:
target: ${nodes.proc.first.id}
title: "Stopping environment $envName"
text: "$envName is going to stop"
onAfterStart:
- startupJahiaHealthCheck: cp, proc
- logEvent:
target: ${nodes.proc.first.id}
title: "$envName environment started"
text: "$envName is started"
onBeforeMigrate:
logEvent:
target: ${nodes.proc.first.id}
title: "Migration triggered for $envName environment"
text: "$envName going to be migrate"
onAfterMigrate:
- logEvent:
target: ${nodes.proc.first.id}
title: "Environment $envName migrated"
text: "$envName has been migrated"
- refreshProxysqlInstancesList
onBeforeRestartNode:
logEvent:
target: ${event.params.nodeId}
title: "Restarting node ${event.params.nodeId}"
text: "${event.params.nodeId} node is going to be restarted"
onAfterRestartNode:
logEvent:
target: ${event.params.nodeId}
title: "Node ${event.params.nodeId} restarted"
text: "Node ${event.params.nodeId} has restarted"
onBeforeRedeployContainer:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
logEvent:
target: ${event.params.nodeGroup}
title: "Redeploying ${event.params.nodeGroup} nodes to ${event.params.tag} version"
text: "${event.params.nodeGroup} nodes are going to be redeploy to ${event.params.tag} version"
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
logEvent:
target: ${event.params.nodeId}
title: "Redeploying node ${event.params.nodeId} to ${event.params.tag} version"
text: "Node ${event.params.nodeId} is going to be redeploy to ${event.params.tag} version"
onAfterRedeployContainer:
- if ('${event.params.nodeGroup:}'):
# Handle RedeployContainersByGroup
- getLogEventScript: ${event.params.nodeGroup}
- logEvent:
target: ${event.params.nodeGroup}
title: "${event.params.nodeGroup} nodes have been redeployed to ${event.params.tag} version"
text: "${event.params.nodeGroup} nodes have been redeployed to ${event.params.tag} version"
- elif ('${event.params.nodeId:}'):
# Handle RedeployContainerById
- getLogEventScript: ${event.params.nodeId}
- logEvent:
target: ${event.params.nodeId}
title: "Node ${event.params.nodeId} redeployed to ${event.params.tag} version"
text: "Node ${event.params.nodeId} has been redeploy to ${event.params.tag} version"
onBeforeScaleIn:
forEach(event.response.nodes):
logEvent:
target: ${@i.id}
title: "Scaling in ${event.params.nodeGroup} node group"
text: "Node ${@i.id} is going to be removed"
onAfterServiceScaleOut:
forEach(event.response.nodes):
logEvent:
target: ${@i.id}
title: "Scaled out ${event.params.nodeGroup} node group"
text: "Node ${@i.id} has been added"
onBeforeDelete:
- logEvent:
target: ${nodes.proc.first.id}
title: "Deleting environment $envName"
text: "$envName is going to be deleted"
- deleteEnvLink
success: /text/success.md
settings:
fields:
- name: productVersion
type: string
caption: Jahia version
required: true
- name: rootpwd
type: string
caption: Jahia root password
vtype: string
required: true
- name: toolspwd
type: string
caption: Jahia tools password
vtype: string
required: true
- name: browsingCount
type: string
caption: Number of Jahia browsing nodes
vtype: string
required: true
default: 2
- name: shortdomain
type: envname
caption: Environment
required: true
- name: mode
type: radio-fieldset
caption: Operating Mode
values:
production: production
development: development
default: production
- name: ddogApikey
type: string
caption: Datadog API KEY
required: true
- name: jahiaDockerImage
inputType: hidden
type: string
default: 'undefined'
- name: vaultRoleId
type: string
caption: Vault Role Id
- name: vaultSecretId
inputType: password
type: string
caption: Vault Secret Id
- name: vaultClusterUrl
type: string
caption: Vault Cluster Url