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 2
/
unomi.yml
360 lines (325 loc) · 10.4 KB
/
unomi.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
---
type: install
version: 1.5.2
name: Unomi - Install
logo: /images/jahia-logo-70x70.png
id: jahia-unomi
description:
short: Unomi - Install
text: This is the Jahia Cloud package for Unomi.
Apache Unomi is a Java Open Source customer data platform, a Java server
designed to manage customers, leads and visitors data and help personalize
customers experiences while also offering features to respect visitor
privacy rules (such as GDPR).
globals:
unomi_version: ${settings.productVersion}
unomi_root_password: ${fn.password(20)}
ssl: true
skipNodeEmails: true
mixins:
- common/common_actions.yml
- jcustomer/jcustomer_actions.yml
- elasticsearch/elasticsearch_actions.yml
onBeforeInstall: |
var unomiVersion = '${settings.productVersion}'
var resp = {
result: 0,
nodes: []
}
// Elasticsearch port and version changes from jCustomer 1.5
if (unomiVersion >= "1.5") {
esPort = "9200";
esVersion = 7;
} else {
esPort = "9300";
esVersion = 5;
}
node_es = {
nodeType: "jahiastic-elasticsearch",
tag: esVersion,
displayName: "Elasticsearch v" + esVersion,
count: ${settings.ESMode},
cloudlets: 40,
nodeGroup: 'es',
isSLBAccessEnabled: false,
startServiceOnCreation: false,
env: {
UNOMI_VERSION: unomiVersion,
jahia_cfg_operatingMode: '${settings.mode}',
_ROLE: 'unomi',
_PROVIDE: 'elasticsearch',
ES_VERSION: esVersion,
envmode: '${settings.mode}'
},
"volumes": [
"/var/lib/elasticsearch"
]
}
node_unomi = {
nodeType: "jcustomer",
tag: unomiVersion,
displayName: "Unomi v" + unomiVersion,
count: ${settings.UnomiMode},
cloudlets: 32,
nodeGroup: 'cp',
links: 'es:es',
startServiceOnCreation: false,
env: {
UNOMI_VERSION: unomiVersion,
jahia_cfg_operatingMode: '${settings.mode}',
UNOMI_HTTP_PORT: '80',
UNOMI_ELASTICSEARCH_ADDRESSES: 'es:' + esPort,
UNOMI_ELASTICSEARCH_CLUSTERNAME: 'jahia-dx',
_ROLE: 'unomi',
_PROVIDE: 'unomi',
ES_VERSION: esVersion,
envmode: '${settings.mode}'
},
"distribution": {
"mode": "STRICT",
"zones": [
{high_iops: false}
]
}
}
resp.nodes.push(node_unomi)
resp.nodes.push(node_es)
return resp
nodes: definedInOnBeforeInstall
# --Events --
onInstall:
- if (settings.rootPassword):
setGlobals:
unomi_root_password: ${settings.rootPassword}
- environment.control.ApplyNodeGroupData [cp, es]:
data:
productName: unomi
productVersion: ${globals.unomi_version}
- setJournaldLimit
- getLogEventScript: cp, es
- env.control.AddContainerEnvVars [*]:
vars: {"envName": "${env.envName}", "DATADOGAPIKEY": "${settings.ddogApikey}"}
- setupES: es
- setReplica
- updateReplica
- setupUnomi
- setupDatadogAgentUnomi: cp
- setupDatadogAgentEs: es
- getReleaseMajorVersion
- setEnvVersion: ${globals.envVersion}
- checkJcustomerHealthWhenStarting: cp
onBeforeScaleIn[cp]:
- saveUnomiRootPassword
onAfterScaleIn[cp]:
- getUnomiRootPassword
- updateHazelcast
- forEach(event.response.nodes):
- setReplica
onBeforeServiceScaleOut[cp]:
- saveUnomiRootPassword
onAfterServiceScaleOut[cp]:
- getUnomiRootPassword
- updateHazelcast
- forEach(event.response.nodes):
- setReplica
- setupDatadogAgentUnomi: cp
onBeforeRedeployContainer[cp]:
- saveUnomiRootPassword
onBeforeRedeployContainer[es]:
- if (nodes.es.length > 1):
- log: "This is an ES cluster, disable shards allocation and flush before stopping node"
- if ('${event.params.nodeGroup.print()}' != ''):
- setShardAllocation:
target: ${nodes.es.master.id}
allocation: "primaries"
- forEach(nodes.es):
- forceESFlush:
target: ${@i.id}
- elif ('${event.params.nodeId.print()}' != ''):
- setShardAllocation:
target: ${event.params.nodeId}
allocation: "primaries"
- forceESFlush:
target: ${event.params.nodeId}
onAfterRedeployContainer[cp]:
- getUnomiRootPassword
- setReplica
- setupUnomi
- setupDatadogAgentUnomi: cp
- if ('${event.params.nodeGroup.print()}' != ''):
checkJcustomerHealthWhenStarting: ${event.params.nodeGroup}
- elif ('${event.params.nodeId.print()}' != ''):
checkJcustomerHealthWhenStarting: ${event.params.nodeId}
onAfterRedeployContainer[es]:
- if ('${event.params.nodeGroup.print()}' != ''):
- setupES: ${event.params.nodeGroup}
- setupDatadogAgentEs: ${event.params.nodeGroup}
- if (nodes.es.length > 1):
- log: "This is an ES cluster, enable shards allocation"
- setShardAllocation:
target: ${nodes.es.master.id}
allocation: "null"
- elif ('${event.params.nodeId.print()}' != ''):
- setupES: ${event.params.nodeId}
- setupDatadogAgentEs: ${event.params.nodeId}
- if (nodes.es.length > 1):
- log: "This is an ES cluster, enable shards allocation"
- setShardAllocation:
target: ${event.params.nodeId}
allocation: "null"
onAfterServiceScaleOut[es]:
- forEach(event.response.nodes):
cmd[${@i.id}]: |-
service elasticsearch stop
rm -rf /var/lib/elasticsearch/nodes
- setupES: es
- setReplica
- updateReplica
- setupDatadogAgentEs: es
onAfterScaleIn[es]:
- setupES: es
- setReplica
- updateReplica
onBeforeDelete:
- logEvent:
target: ${nodes.cp.first.id}
title: "Deleting environment $envName"
text: "$envName is going to be deleted"
- deleteEnvLink
onBeforeStop:
- logEvent:
target: ${nodes.cp.first.id}
title: "Stopping environment $envName"
text: "$envName is going to stop"
- if (nodes.es.length > 1):
- log: "This is an ES cluster, disable shards allocation and flush before stopping the environment"
- setShardAllocation:
target: ${nodes.es.master.id}
allocation: "primaries"
- forEach(nodes.es):
- forceESFlush:
target: ${@i.id}
onAfterStart:
- logEvent:
target: ${nodes.cp.first.id}
title: "$envName environment started"
text: "$envName is started"
- if (nodes.es.length > 1):
- log: "This is an ES cluster, enable shards allocation"
- setShardAllocation:
target: ${nodes.es.master.id}
allocation: "null"
- checkJcustomerHealthWhenStarting: cp
onBeforeMigrate:
logEvent:
target: ${nodes.cp.first.id}
title: "Migration triggered for $envName environment"
text: "$envName going to be migrate"
onAfterMigrate:
logEvent:
target: ${nodes.cp.first.id}
title: "Environment $envName migrated"
text: "$envName has been migrated"
onBeforeRestartNode[es]:
- if (nodes.es.length > 1):
- log: "This is an ES cluster, disable shards allocation and flush before stopping node"
- setShardAllocation:
target: ${event.params.nodeId}
allocation: "primaries"
- forceESFlush:
target: ${event.params.nodeId}
onBeforeRestartNode:
- logEvent:
target: ${event.params.nodeid}
title: "Restarting node ${event.params.nodeid}"
text: "${event.params.nodeid} node is going to be restarted"
onAfterRestartNode[es]:
- if (nodes.es.length > 1):
- log: "This is an ES cluster, enable shards allocation"
- setShardAllocation:
target: ${event.params.nodeId}
allocation: "null"
onAfterRestartNode[cp]:
checkJcustomerHealthWhenStarting: ${event.params.nodeId}
onAfterRestartNode:
- logEvent:
target: ${event.params.nodeid}
title: "Node ${event.params.nodeid} restarted"
text: "Node ${event.params.nodeid} has restarted"
onBeforeRedeployContainer:
- if ('${event.params.nodeGroup.print()}' != ''):
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.print()}' != ''):
logEvent:
target: ${nodes.es.first.id}
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.print()}' != ''):
- 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.print()}' != ''):
- 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"
settings:
fields:
- name: productVersion
type: string
caption: jCustomer Version
required: true
- name: UnomiMode
type: list
caption: jCustomer mode
values:
"1": single
"2": 2 nodes cluster
"3": 3 nodes cluster
"4": 4 nodes cluster
"5": 5 nodes cluster
"6": 6 nodes cluster
"7": 7 nodes cluster
default: 1
- name: ESMode
type: list
caption: Elasticsearch mode
values:
"1": single
"3": 3 nodes cluster
"5": 5 nodes cluster
default: 1
- name: mode
type: radiolist
caption: Operating Mode
values:
production: production
development: development
default: production
- name: ddogApikey
type: string
caption: Datadog API KEY
required: true
vtype: text
- name: rootPassword
type: string
caption: Unomi root password