-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcluster.yml
211 lines (182 loc) · 7.17 KB
/
cluster.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
type: install
jpsVersion: 7.1.1
id: wp-edition-cluster
categories:
- wordpress
targetEditions: wordpress
name: Cluster
baseUrl: https://raw.githubusercontent.com/jelastic-jps/wordpress-edition/master
logo: /images/logo/cluster.svg
description:
text: /text/cluster.md
short: WordPress Cluster powered by LiteSpeed
onBeforeInit: /scripts/onBeforeInit.js
settings:
fields:
- caption: Advanced Features
type: displayfield
name: displayfield
markup:
- 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"
- 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: false
disabled: false
hidden: true
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."
- type: displayfield
hideLabel: true
hidden: true
name: bl_count
markup:
- type: separator
- caption: Topology
type: displayfield
name: topology
tooltip: "<h2 align=center>Cluster powered<br>by LiteSpeed</h2><br><img width='300' height='400' src='https://raw.githubusercontent.com/jelastic-jps/wordpress-edition/master/images/topo/woocommerce-cluster.svg?sanitize=true'><br>"
- type: envname
name: envName
caption: Environment
dependsOn: region
required: true
- type: string
name: displayName
caption: Display Name
default: Cluster
- caption: Region
type: regionlist
name: region
disableInactive: true
selectFirstAvailable: true
stateId: "wp"
dependsOn: ownerUid
- type: owner
name: ownerUid
caption: Owner
globals:
wp_jps: https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/v2.2.0
wp_admin_pass: ${fn.password(10)}
ls_admin_pass: ${fn.password(10)}
db_user: user-${fn.random}
db_pass: ${fn.password(10)}
PROTOCOL: http
onInstall:
- script: /scripts/setGlobals.js?_r=${fn.random}
- install:
jps: ${globals.wp_jps}/manifest.yml?_r=${fn.random}
envName: ${settings.envName}
region: ${settings.region}
loggerName: ${settings.envName}
displayName: ${settings.displayName}
envGroups: ${globals.envGroups}
ownerUid: ${settings.ownerUid}
settings:
ls-addon: true
waf: ${settings.waf:true}
glusterfs: ${settings.glusterfs:false}
wp_protect: ${settings.wp_protect:true}
galera: true
le-addon: ${settings.le-addon:true}
cdn-addon: false
mu-addon: false
woocommerce: false
DB_USER: ${globals.db_user}
DB_PASS: ${globals.db_pass}
WP_ADMIN_PASS: ${globals.wp_admin_pass}
LS_ADMIN_PASS: ${globals.ls_admin_pass}
success_email: false
project: ${settings.project:default}
projectScope: ${settings.projectScope:production}
is_trigger: false
bl.nodes: ${settings.bl.nodes:2}
bl.cloudlets: ${settings.bl.cloudlets:8}
bl.diskspace: ${settings.bl.diskspace:[quota.disk.limitation]}
cp.count: ${settings.cp.nodes:2}
cp.cloudlets: ${settings.cp.cloudlets:8}
cp.diskspace: ${settings.cp.diskspace:[quota.disk.limitation]}
sqldb.cloudlets: ${settings.sqldb.cloudlets:16}
sqldb.diskspace: ${settings.sqldb.diskspace:[quota.disk.limitation]}
nosqldb.cloudlets: ${settings.nosqldb.cloudlets:8}
nosqldb.diskspace: ${settings.nosqldb.diskspace:[quota.disk.limitation]}
storage.cloudlets: ${settings.storage.cloudlets:8}
storage.diskspace: ${settings.storage.diskspace:[quota.disk.limitation]}
- setGlobals:
installationId: ${response.uniqueName}
- initNodes:
envName: ${settings.envName}
namespace: targetNodes
- env.control.ApplyNodeGroupData[cp]:
envName: ${settings.envName}
data:
fixedTopologyLayers: 1
- setProtocol
- if ('${settings.success_email}' != 'false'):
- return:
type: success
message: /success/text/cluster.md?_r=${fn.random}
email: /success/email/cluster.md?_r=${fn.random}
actions:
setProtocol:
if (${quota.environment.jelasticssl.enabled} || ${settings.le-addon:false}):
setGlobals:
PROTOCOL: https
initNodes:
envName: ${this.envName}
namespace: ${this.namespace}
script: |
let nodes = {}, resp = api.env.control.GetEnvInfo(envName, session);
if (resp.result != 0) return resp;
resp.nodes.sort((node1, node2) => node1.id - node2.id);
for (let node of resp.nodes) {
nodes[node.nodeGroup] = nodes[node.nodeGroup] || [];
nodes[node.nodeGroup].push(node);
if (node.ismaster) {
nodes.master = nodes.master || {};
nodes.master[node.nodeGroup] = node;
}
}
let globals = {};
globals[namespace] = nodes;
return { result: 0, onAfterReturn: { setGlobals: globals } }
onApplySubscriptionSettings:
marketplace.installation.ExecuteAction:
appUniqueName: ${globals.installationId}
action: applyEnvSettings
settings:
targetAppid: ${event.params.targetAppid}
bl.nodes: ${event.params.settings.bl.nodes}
bl.cloudlets: ${event.params.settings.bl.cloudlets}
bl.diskspace: ${event.params.settings.bl.diskspace}
cp.nodes: ${event.params.settings.cp.nodes}
cp.cloudlets: ${event.params.settings.cp.cloudlets}
cp.diskspace: ${event.params.settings.cp.diskspace}
sqldb.cloudlets: ${event.params.settings.sqldb.cloudlets}
sqldb.diskspace: ${event.params.settings.sqldb.diskspace}
nosqldb.cloudlets: ${event.params.settings.nosqldb.cloudlets}
nosqldb.diskspace: ${event.params.settings.nosqldb.diskspace}
storage.cloudlets: ${event.params.settings.storage.cloudlets}
storage.diskspace: ${event.params.settings.storage.diskspace}