-
Notifications
You must be signed in to change notification settings - Fork 52
/
manifest.jps
334 lines (293 loc) · 12.9 KB
/
manifest.jps
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
type: install
jpsVersion: '1.7.2'
name: WordPress Cluster Kit v2
id: wordpress-cluster
categories:
- apps/clusters
- apps/content-management
description:
text: WordPress Cluster Kit with highly available Load Balancer and Shared Storage with GlusterFS, database clustering, and scaling mode to create an optimal environment for highly-loaded projects. The package provides integrated autoscaling and high availability for development and production environments. Clustered topology ensures effective handling of heavy workload.
short: WordPress Cluster with built-in kit v2 for choosing optimal servers, database clustering type, scaling mode and a set of advanced features for highly-loaded projects
logo: /images/wp-cluster-kit.svg
baseUrl: https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/v2.2.0
onBeforeInit: /scripts/beforeInit.js?_r=${fn.random}
onBeforeInstall: /scripts/beforeInstall.js?_r=${fn.random}
skipNodeEmails: true
nodes: definedInOnBeforeInstall
settings:
fields:
- caption: Scaling Strategy
type: list
name: loadGrowth
default: slow
required: true
width: 225
tooltip: |
Configure auto-scaling triggers, i.e. how fast the system responds to load spikes by adding or removing nodes.
<p>Read more about <a href="https://docs.jelastic.com/automatic-horizontal-scaling">Automatic Horizontal Scaling</a></p>
values:
- value: slow
caption: Low Load
tooltip: <h2>Low load scaling strategy</h2>add 1 new node when CPU > 70% <p>remove when CPU < 20%</p>
- value: medium
caption: Medium Load
tooltip: <h3>Medium load scaling strategy</h3>add 1 new node when CPU > 50% <p>remove when CPU < 20%</p>
- value: fast
caption: High Load
tooltip: <h3>High load scaling strategy</h3>add 2 new nodes when CPU > 30% <p>remove when CPU < 10%</p>
- 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 MariaDB Galera Cluster
type: checkbox
name: galera
value: true
disabled: false
tooltip: "<h3>Requirements for All Tables:</h3> * run on InnoDB storage engine <p>* have a primary key</p>Read more about <a href='https://mariadb.com/kb/en/library/mariadb-galera-cluster-known-limitations/'>limitations</a>"
- 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 updating trusted custom SSL certificates."
- caption: Install Lightning-Fast Premium CDN
type: checkbox
name: cdn-addon
value: 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."
- caption: 'Install GlusterFS Cluster'
type: checkbox
name: glusterfs
value: false
disabled: false
tooltip: "Shared Storage auto-clustering is based on GlusterFS software that provides a fault-tolerant distributed file system with automatic data synchronization across the cluster nodes."
- caption: Install WordPress Multisite Network
type: checkbox
name: mu-addon
value: false
disabled: false
tooltip: "Multisite is a type of WordPress installation that allows you to create and manage a network of multiple websites from a single WordPress dashboard. This lets you easily make changes and keep all of your websites updated from one place."
- caption: Install WooCommerce
type: checkbox
name: woocommerce
value: false
disabled: false
tooltip: "WooCommerce is a free open-source e-commerce plugin designed specifically for WordPress. This is a great platform for a store of any size."
- type: displayfield
hideLabel: true
hidden: true
name: bl_count
value: 2
markup:
mixins:
- https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/master/configs/vers.yaml
globals:
PATH: ${baseUrl}
DB_USER: ${settings.DB_USER:user-[fn.random]}
DB_PASS: ${settings.DB_PASS:[fn.password(10)]}
DB_HOST: sqldb
PROTOCOL: http
WP_ADMIN_PASS: ${settings.WP_ADMIN_PASS:[fn.password(10)]}
LS_ADMIN_PASS: ${settings.LS_ADMIN_PASS:[fn.password(10)]}
SUCCESS: default
onInstall:
- limits
- setProtocol
- setDomain
- initLEsettings
- if (${settings.is_trigger:true}): setTriggers
- optimization
- setupCacheSync
- storageHealthCheck
- storageMount: NFS4
- if (/litespeed/.test("${nodes.cp.nodeType}")): setPassword
- getRedisPswd
- installWordpress
- if ('${settings.mu-addon:false}' == 'true'): configureMultisite
- if (${settings.woocommerce:false}): installWoocommerce
- if (('${settings.le-addon:false}' == 'true') || ('${settings.cdn-addon:false}' == 'true')):
- script: |
var actions = [];
if ('${settings.le-addon:false}' == 'true')
actions.push({
jps: "https://github.com/jelastic-jps/lets-encrypt/blob/master/manifest.jps?_r=${fn.random}?_r=${fn.random}",
nodeGroup: "bl",
skipEmail: "true",
settings: {
customDomains: "${globals.DOMAIN}",
fallbackToX1: "true",
withExtIp: "${globals.isExtIP}"
}
});
if ('${settings.cdn-addon:false}' == 'true')
actions.push({
jps: "https://raw.githubusercontent.com/edgeport/cdn/master/manifest.yml?_r=${fn.random}",
nodeGroup: "bl",
skipEmail: "true",
settings: {
note: "${settings.noteCDN:}"
}
});
return { result: 0, onAfterReturn: { install: actions } };
- if ('${settings.le-addon:false}' == 'true'): setupLEdomain
- if ('${settings.cdn-addon:false}' == 'true'): setupCDN
- install:
- jps: /scripts/cacheClean.jps?_r=${fn.random}
- jps: /scripts/addons.jps?_r=${fn.random}
- jps: /scripts/events.jps?_r=${fn.random}
- if ('${settings.success_email}' != 'false'):
- return:
type: success
message: /success/text/success-${globals.SUCCESS}.md?_r=${fn.random}
email: /success/email/success-${nodes.cp.master.nodeType}-${globals.SUCCESS}.md?_r=${fn.random}
actions:
limits:
- env.control.ApplyNodeGroupData[bl,cp,sqldb,storage,nosqldb]:
data:
project: ${settings.project:default}
projectScope: ${settings.projectScope:production}
isRequired: true
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
setDomain:
- script: /scripts/idna.js
domains: ${env.domain}
- setGlobals:
DOMAIN: ${response.domains}
setTriggers:
- log: Auto Scaling Triggers
- script: /scripts/addTriggers.js
nodeGroup: cp
resourceType: CPU
loadGrowth: ${settings.loadGrowth}
cleanOldTriggers: true
scaleDownLimit: ${nodes.cp.length}
initLEsettings:
- script: |
return {
result:0,
extIP: Boolean(jelastic.billing.account.GetQuotas('environment.externalip.enabled').array[0].value)
}
- setGlobals:
isExtIP: ${response.extIP}
- cmd[cp, bl]: |-
[ ! -d /var/lib/jelastic/keys/letsencrypt ] && mkdir -p /var/lib/jelastic/keys/letsencrypt;
echo "webroot=false" > /var/lib/jelastic/keys/letsencrypt/settings-custom;
echo "webrootPath=/var/www/webroot/ROOT" >> /var/lib/jelastic/keys/letsencrypt/settings-custom;
echo "test=false" >> /var/lib/jelastic/keys/letsencrypt/settings-custom;
echo "withExtIp=${globals.isExtIP}" >> /var/lib/jelastic/keys/letsencrypt/settings-custom;
user: root
setupLEdomain:
- cmd[${nodes.bl.master.id}]: source /opt/letsencrypt/settings && echo $domain
- cmd[${nodes.cp.master.id}]: bash ~/bin/setupWP.sh --url https://${response.out};
optimization:
- log: Load Balancers and App servers optimization
- install:
- jps: https://raw.githubusercontent.com/jelastic/templates/master/config_v2.jps?_r=${fn.random}
settings:
targetGroup: bl
targetNodes: bl
optimization: wordpress
- jps: https://raw.githubusercontent.com/jelastic/templates/master/config_v2.jps?_r=${fn.random}
settings:
targetGroup: cp
targetNodes: cp
optimization: wordpress
- cmd[cp, bl]: if test -f /usr/local/sbin/optimization.sh; then bash /usr/local/sbin/optimization.sh &>> /var/log/run.log; fi
setPassword:
- cmd[cp, bl]: jem passwd set -p ${globals.LS_ADMIN_PASS}
user: root
storageMount:
- log: Mount Storage
- api:
- method: jelastic.environment.file.AddMountPointByGroup
params:
nodeGroup: cp
sourceNodeId: ${nodes.storage.master.id}
sourcePath: /data
path: /var/www/webroot/ROOT
sourceAddressType: NODE_GROUP
protocol: ${this}
storageHealthCheck:
- cmd[cp]: |-
echo "<?php http_response_code(500); ?>" > /var/www/webroot/ROOT/index.php
setupCDN:
- script: return jelastic.dev.scripting.Eval("c05ffa5b45628a2a0c95467ebca8a0b4", session, "cdn.info", {partnerCode:1})
- setGlobals:
CDN_URL: ${globals.PROTOCOL}://${env.envName}-${response.response.partnerCode}.cdn.jelastic.net/
CDN: ${env.envName}-${response.response.partnerCode}.cdn.jelastic.net
SUCCESS: cdn
- install: /scripts/setupCDN.jps
configureMultisite:
- install: /addons/multisite.jps
getRedisPswd:
- cmd[nosqldb]: cat /etc/redis.conf | tail -1 | awk '{print $2}';
- setGlobals:
REDIS_PSWD: ${response.out}
installWordpress:
- install: /scripts/installWP.jps
settings:
db_host: ${globals.DB_HOST}
db_user: ${globals.DB_USER}
db_pass: ${globals.DB_PASS}
redis_host: nosqldb
redis_port: 6379
redis_user: admin
redis_pswd: ${globals.REDIS_PSWD}
wp_admin_pass: ${globals.WP_ADMIN_PASS}
wp_title: "Hello World"
wp_url: ${globals.PROTOCOL}://${globals.DOMAIN}/
version_wordpress: ${globals.version_wordpress}
setupCacheSync:
- if (/litespeed/.test("${nodes.bl.nodeType}")):
- install: /scripts/setupHA4LB.jps?_r=${fn.random}
updateTriggers:
if (!${event.params.auto:true}):
- log: update scaling trigger
- script: /scripts/updateTriggers.js
count: ${nodes.cp.length}
installWoocommerce:
cmd[${nodes.cp.master.id}]: |-
wp plugin install woocommerce --version=${globals.version_woocommerce} --activate --path=${SERVER_WEBROOT} &>> /var/log/run.log;