-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmanifest.yml
323 lines (288 loc) · 11.6 KB
/
manifest.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
type: install
name: Multi-Region WordPress Standalone
id: wordpress-multiregion-standalone
targetEditions: any
categories:
- apps/clusters
- apps/content-management
- wordpress
description:
text: /text/wordpress-multiregion-standalone.md
short: WordPress single instances in multi-region powered by LiteSpeed.
logo: /images/logo/new-logo-multiregion-standalone.svg
baseUrl: https://raw.githubusercontent.com/jelastic-jps/wordpress-multiregion-standalone/master
onBeforeInit: /scripts/onBeforeInit.js
mixins:
- https://raw.githubusercontent.com/jelastic-jps/wordpress/master/configs/vers.yaml
- https://raw.githubusercontent.com/jelastic-jps/wordpress-multiregion-standalone/master/configs/additionalGlobals.yaml
settings:
fields:
- caption: Advanced Features
type: displayfield
name: displayfield
markup:
- caption: Install LiteSpeed High-Performance Web Server
type: checkbox
name: ls-addon
value: true
disabled: false
tooltip: "If this option is disabled, the cluster will be installed using NGINX load balancer and application servers"
showIf:
true:
- caption: WordPress Brute Force Attack Protection
type: checkbox
name: wp_protect
value: true
disabled: false
tooltip: "Secure WordPress Admin Panel with <a href='https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:wordpress-protection' target='_blank'>LiteSpeed Brute Force Protection</a> that limits failed login attempts. Default action is <b>Throttle</b> and number of allowed attempts is <b>100</b>"
- caption: Web Application Firewall
type: checkbox
name: waf
value: true
disabled: false
tooltip: "Protect web sites with <a href='https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:waf' target='_blank'>LiteSpeed built-in WAF</a> based on Free ModSecurity Rules from Comodo"
false:
- caption: WordPress Brute Force Attack Protection
type: checkbox
name: wp_protect
value: false
disabled: true
tooltip: "Secure WordPress Admin Panel with <a href='https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:wordpress-protection' target='_blank'>LiteSpeed Brute Force Protection</a> that limits failed login attempts. Default action is <b>Throttle</b> and number of allowed attempts is <b>100</b>"
- caption: Web Application Firewall
type: checkbox
name: waf
value: false
disabled: true
tooltip: "Protect web sites with <a href='https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:waf' target='_blank'>LiteSpeed built-in WAF</a> based on Free ModSecurity Rules from Comodo"
- caption: Install Let's Encrypt SSL with Auto-Renewal
type: checkbox
name: le-addon
value: true
disabled: false
tooltip: "Advanced integration with Let's Encrypt certificate authority that simplifies and automates the process of issuing, configuring and renewing trusted SSL certificates."
- caption: Install Lightning-Fast Premium CDN with 160+ PoPs
type: checkbox
name: cdn-addon
value: false
hidden: true
disabled: false
tooltip: "Jelastic CDN is an HTTP/3 premium content delivery network of 160+ Super PoPs (points of presence) with bandwidth capacity up to 115 Tbps, advanced caching and acceleration strategies based on best-in-class IP Anycast technology."
- type: displayfield
hideLabel: true
hidden: true
name: message
value: 1
markup:
- type: separator
- caption: Topology
type: displayfield
name: topology
tooltip: "<h3>Multi-Region Standalone</h3><br><img width='375' height='340' src='https://raw.githubusercontent.com/jelastic-jps/wordpress/master/wordpress-edition/images/topo/multi-region-standalone.svg?sanitize=true'>"
- caption: Regions
type: regionlist
name: regions
disableInactive: true
selectFirstAvailable: false
multiSelect: true
required: true
min: 2
max: 2
- caption: Environment
type: envname
name: envName
dependsOn: region
randomName: true
showFullDomain: false
required: true
globals:
db_user: user-${fn.random}
db_pass: ${fn.password(10)}
sync_pass: ${fn.password(10)}
repl_user: repl-${fn.random}
repl_pass: ${fn.password(10)}
protocol: http
wp_admin_pass: ${fn.password(10)}
success: default
stack: LEMP
onInstall:
- initGlobals
- setGlobals:
domain: ${settings.envName}-1.${globals.domain-1}
- checkDomainsLength
- setProtocol
- createEnvs
- configureLEaddon
- installAdditionals
- getEnvNodes
- installReplications
- installWordpress
- if (${settings.cdn-addon:false}):
- installCDNaddon
- setGlobals:
success: cdn
- if (${settings.ls-addon:false}):
setGlobals:
stack: LLSMP
actions:
initGlobals:
- script: |
var regions = '${settings.regions}'.split(','),
envGroups = eval('(' + MANIFEST + ')').envGroups, index,
onAfterReturn = { setGlobals: {} },
glbs = onAfterReturn.setGlobals,
resp, domain;
resp = jelastic.env.control.GetRegions(appid, session);
if (resp.result != 0) return resp;
resp = resp.array;
for (var i = 0, n = regions.length; i < n; i ++) {
index = i + 1;
glbs["region-" + index] = regions[i];
for (var a = 0, b = resp.length; a < b; a++) {
for (var k = 0, l = resp[a].hardNodeGroups.length; k < l; k++) {
if (resp[a].hardNodeGroups[k].uniqueName == regions[i])
glbs["domain-" + index] = resp[a].domain;
}
}
glbs["displayName-" + index] = "WP Standalone " + index;
}
glbs["envGroups"] = envGroups;
glbs["regionsCount"] = regions.length;
glbs["master_env_name"] = "${settings.envName}-1";
return { result: 0, onAfterReturn: onAfterReturn };
createEnvs:
- script: |
var regions = '${settings.regions}'.split(','), actions = [];
var envGroups = eval('(' + MANIFEST + ')').envGroups;
for (var cluster = 1, n = regions.length + 1; cluster < n; cluster ++) {
actions.push({
jps: "${globals.wp_standalone_path}/manifest.yml?_r=${fn.random}",
envName: "${settings.envName}-" + cluster,
loggerName: "${settings.envName}-" + cluster,
envGroups: envGroups,
displayName: "${globals.displayName-" + cluster + "}",
region: "${globals.region-" + cluster + "}",
settings: {
"ls-addon": "${settings.ls-addon}",
"waf": "${settings.waf}",
"wp_protect": "${settings.wp_protect}",
"le-addon": "false",
"cdn-addon": "false",
"isSingleDeploy": "false"
}
});
}
return { result: 0, onAfterReturn: { 'marketplace.jps.install': actions } };
installAdditionals:
- script: |
var regions = '${settings.regions}'.split(','), actions = [];
for (var cluster = 1, n = regions.length + 1; cluster < n; cluster ++) {
actions.push({
jps: "/scripts/additionals.jps?_r=${fn.random}",
envName: "${settings.envName}-" + cluster,
});
}
return { result: 0, onAfterReturn: { 'install': actions } };
getEnvNodes:
- script: |
var regions = '${settings.regions}'.split(','),
onAfterReturn = { setGlobals: {} },
glbs = onAfterReturn.setGlobals;
for (var cluster = 1, n = regions.length + 1; cluster < n; cluster ++) {
var resp = jelastic.env.control.GetEnvInfo('${settings.envName}-' + cluster, session);
if (resp.result != 0) return resp;
for (var i = 0, k = resp.nodes; i < k.length; i++) {
if (k[i].nodeGroup == 'cp')
k[i].ismaster ? glbs["master_id_cp-" + cluster] = k[i].id : 0;
}
}
return { result: 0, onAfterReturn: onAfterReturn };
installReplications:
- install:
- jps: /scripts/primaryReplicationManager.jps
envName: ${settings.envName}-1
settings:
db_user: ${globals.db_user}
db_pass: ${globals.db_pass}
repl_user: ${globals.repl_user}
repl_pass: ${globals.repl_pass}
cluster_name: ${settings.envName}
- jps: /scripts/contentSynchronizationManager.jps
envName: ${settings.envName}-1
settings:
sync_pass: ${globals.sync_pass}
cluster_name: ${settings.envName}
installWordpress:
- install: ${globals.wp_cluster_path}/scripts/installWP.jps
envName: ${settings.envName}-1
settings:
db_host: 127.0.0.1
db_user: ${globals.db_user}
db_pass: ${globals.db_pass}
wp_admin_pass: ${globals.wp_admin_pass}
wp_title: "Hello World"
wp_url: ${globals.protocol}://${globals.domain}
version_wordpress: ${globals.version_wordpress}
cluster: false
configureLEaddon:
install:
jps: /scripts/configureLEaddon.jps
envName: ${settings.envName}-1
settings:
domain: ${globals.domain}
baseUrl: ${baseUrl}
le-addon: ${settings.le-addon:false}
installCDNaddon:
- install:
jps: https://raw.githubusercontent.com/jelastic-jps/cdn/master/manifest.yml?_r=${fn.random}
envName: ${settings.envName}-1
skipEmail: true
nodeGroup: cp
settings:
note: ${settings.noteCDN:}
- script: return jelastic.dev.scripting.Eval("c05ffa5b45628a2a0c95467ebca8a0b4", session, "cdn.info", {partnerCode:1})
- setGlobals:
cdn_url: ${globals.protocol}://${settings.envName}-1-${response.response.partnerCode}.cdn.jelastic.net/
setProtocol:
- script: |
return {
result:0,
ssl: jelastic.billing.account.GetQuotas('environment.jelasticssl.enabled').array[0].value
}
- if (${response.ssl} || ${settings.le-addon:false}):
setGlobals:
protocol: https
checkDomainsLength:
script: |
var regionsList = "${settings.regions}";
var envName = "${settings.envName}", value, region;
var regions = api.environment.control.GetRegions();
if (regions.result != 0) return regions;
if (regions.array) {
for (var i = 0, n = regions.array.length; i < n; i++) {
region = regions.array[i];
if (region.hardNodeGroups && region.hardNodeGroups.length) {
for (var k = 0, l = region.hardNodeGroups.length; k < l; k++) {
if (regionsList.indexOf(region.hardNodeGroups[k].uniqueName) != -1) {
value = envName + "-1." + regions.array[i].domain;
var messageValue = (50 - regions.array[i].domain.length);
if (value.length > 52) {
return {
result: 1009,
message: "Domain name length for current regions must be less than " + messageValue
}
}
}
}
}
}
}
return {
result: 0
}
responses:
1009:
type: warning
success:
email: /success/email/${globals.stack}/success-${globals.success}.md?_r=${fn.random}
text: /success/text/${globals.stack}/success-${globals.success}.md?_r=${fn.random}
startPage: ${globals.protocol}://${globals.domain}/