-
Notifications
You must be signed in to change notification settings - Fork 1
/
manifest.jps
271 lines (250 loc) · 9.21 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
jpsType: install
jpsVersion: '1.4'
id: openmage-cluster
homepage: https://github.com/proxiblue/openmage-cluster/tree/main
description:
text: Auto-scalable and highly-available OpenMage eCommerce cluster with out-of-box
auto-scaling, even load and traffic distribution, master-master data replication,
page caching and user session storage on certified Jelastic dockerized stack templates.
short: Auto-scalable and highly-available OpenMage cluster with load balancing, data
replication, content caching and user session storage.
categories:
- apps/clusters
- apps/e-commerce
logo: https://raw.githubusercontent.com/ProxiBlue/openmage-cluster/main/images/57708.png
name: Auto-Scalable OpenMage Cluster
globals:
PATH: https://raw.githubusercontent.com/ProxiBlue/openmage-cluster/main/
MAGE_ROOT: "/var/www/webroot/ROOT"
DB_USER: jelastic-${fn.random}
DB_PASS: "${fn.password(20)}"
DB_NAME: openmage
RD_PASS: "${fn.password(10)}"
ADMIN_PASSWD: "${fn.password(20)}"
ROOT_PASSWD: "${fn.password(20)}"
NGINX_PASSWD: "${fn.password(20)}"
ADMIN_URL: admin_${fn.random}
MG_ADMIN_USER: admin-${fn.random}
settings:
prepopulate: https://raw.githubusercontent.com/ProxiBlue/openmage-cluster/main/settings/populate.txt
fields:
- caption: "Select Locale"
type: list
required: true
name: LOCALE
- caption: "Select Timezone"
type: list
required: true
name: TIMEZONE
- caption: "Select Currency"
type: list
required: true
name: CURRENCY
- caption: Skip Install Let's Encrypt SSL with Auto-Renewal?
type: checkbox
name: le_addon
value: true
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 Sample Data?
type: checkbox
name: SAMPLE_DATA
value: true
- caption: "PHP Version"
type: list
values:
1.18.0-php-7.4.16 : 7.4
required: true
name: PHP_VERSION
value: 1.18.0-php-7.4.16
success:
text: |
# Environment details.
## store this information!!!!
* URL: https://${env.domain}
* Admin panel URL: https://${env.domain}/${globals.ADMIN_URL}
* Admin user: ${globals.MG_ADMIN_USER}
* Admin password: ${globals.ADMIN_PASSWD}
* ROOT Password on Web Nodes: ${globals.ROOT_PASSWD}
* NGINX Password on web nodes: ${globals.NGINX_PASSWD}
* DB USER: ${globals.DB_USER}
* DB_NAME: openmage
* DB_PASS: ${globals.DB_PASS}
* RD_PASS: ${globals.RD_PASS}
To add a custom domain name for your Magento Cluster installation, follow the steps described
in our documentation: http://docs.jelastic.com/custom-domains
ssl: false
skipNodeEmails: true
nodes:
- nodeType: nginxphp-dockerized
tag: ${settings.PHP_VERSION}
count: 2
cloudlets: 16
nodeGroup: cp
volumeMounts:
"/var/www/webroot/ROOT":
readOnly: false
sourcePath: "/data"
sourceNodeGroup: storage
displayName: AppServer
env:
PHPFPM_MAX_CHILDREN: 3
- nodeType: mariadb-dockerized
tag: 10.3.22
count: 2
cloudlets: 8
nodeGroup: sqldb
displayName: Database
env:
ON_ENV_INSTALL: ""
- nodeType: storage
cloudlets: 8
nodeGroup: storage
displayName: Storage
- nodeType: varnish-dockerized
tag: 5.2.1
cloudlets: 8
nodeGroup: bl
displayName: Balancer
- nodeType: redis
count: 2
cloudlets: 8
nodeGroup: nosqldb
onAfterScaleOut[nodeGroup:cp]:
forEach(event.response.nodes):
cmd [${@i.id}]: sudo service nginx reload
setNodeDisplayName [${@i.id}]: AppServer
onAfterScaleOut[nodeGroup:bl]:
forEach(event.response.nodes):
setNodeDisplayName [${@i.id}]: Load balancer
onInstall:
- setExtIpEnabled:
- enabled: true
nodeGroup: bl
- setGlobals:
protocol: https
- log: Auto Scaling Triggers
- script: https://raw.githubusercontent.com/ProxiBlue/openmage-cluster/main/scripts/addTriggers.js
params:
nodeGroup: cp
resourceType: CPU
scaleUpValue: 70
scaleUpLimit: 10
scaleUpLoadPeriod: 1
scaleDownValue: 20
scaleDownLimit: 2
scaleDownLoadPeriod: 10
cleanOldTriggers: true
- log: Set Display Name
setNodeDisplayName [cp]: AppServer
setNodeDisplayName [bl]: Load balancer
setNodeDisplayName[${nodes.nosqldb.first.id}]: Session Storage
setNodeDisplayName[${nodes.nosqldb.last.id}]: Cache Storage
- log: Load balancer Setup
- setupBL:
filter: bl
- if ('${settings.le_addon:true}' == 'false'):
- install:
jps: https://github.com/jelastic-jps/lets-encrypt/blob/stage/manifest.jps
envName: ${env.envName}
nodeGroup: bl
skipEmail: true
settings:
customDomains: ""
- log: Envs Setup for CP layer
- setEnvs:
filter: cp
- log: DB Cluster Setup
- installJps:
jps: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/scripts/ms-mm-configuration.jps
settings:
path: "https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master"
db_user: "${globals.DB_USER}"
db_pass: "${globals.DB_PASS}"
scheme: "slave"
custom_conf: "${globals.PATH}/configs/mysql/db.cnf"
nodeGroup: sqldb
- log: setup storage
- cmd[storage]:
- mkdir -p /data/
- chown 700:700 -Rh /data/
- log: Root Commands
- forEach(nodes.cp):
cmd[${@i.id}]:
- yum install composer
- composer self-update --1
- echo ${globals.NGINX_PASSWD}| passwd --stdin nginx &>> /var/log/run.log
- echo ${globals.ROOT_PASSWD}| passwd --stdin root &>> /var/log/run.log
- wget -q --no-verbose --no-check-certificate https://files.magerun.net/n98-magerun.phar -O /usr/bin/n98-magerun &>> /var/log/run.log
- chmod +x /usr/bin/n98-magerun
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" &>> /var/log/run.log
- unzip awscliv2.zip &>> /var/log/run.log
- ./aws/install &>> /var/log/run.log
user: root
- composerOpenMage
- cmd[storage]: wget ${globals.PATH}/configs/openmage/local.xml.template -O /data/app/etc/local.xml.template
- setupRDConnect:
config: /data/app/etc/local.xml.template
- setupCP
- if ('${settings.SAMPLE_DATA:false}' == 'true'):
- cmd[${nodes.cp.first.id}]:
- wget ${globals.PATH}/sampledata/compressed-magento-sample-data-1.9.1.0.tgz -O /tmp/compressed-magento-sample-data-1.9.1.0.tgz
- cmd[${nodes.cp.first.id}]:
- wget ${globals.PATH}/configs/varnish/varnish-probe.php -O ${globals.MAGE_ROOT}/health_check.php
- wget ${globals.PATH}/scripts/setupOpenMage.sh -O /tmp/setup.sh
- bash -x /tmp/setup.sh ${globals.DB_USER} ${globals.DB_PASS} DB_MASTER ${globals.DB_NAME} ${globals.ADMIN_PASSWD} ${globals.MAGE_ROOT} ${env.url} ${user.email} "${globals.ADMIN_URL}" ${globals.MG_ADMIN_USER} ${settings.LOCALE} ${settings.TIMEZONE} ${settings.CURRENCY} ${env.envName} ${settings.le_addon:false} ${settings.SAMPLE_DATA:false} &>> /var/log/run.log
actions:
composerOpenMage:
- log: OpenMage Setup
- cmd[${nodes.cp.first.id}]:
- cd /tmp
- curl -O ${globals.PATH}scripts/composerOpenMage.sh
- bash -x /tmp/composerOpenMage.sh ${globals.PATH} ${globals.MAGE_ROOT} &>> /var/log/run.log
setupCP:
- log: App Servers Setup
- cmd[cp]: |-
wget ${globals.PATH}/configs/nginx/site-default-openmage.conf -O /etc/nginx/conf.d/site-default.conf
wget ${globals.PATH}/configs/nginx/nginx.conf -O /etc/nginx/nginx.conf
wget ${globals.PATH}/configs/php/extensions.ini -O /etc/php.d/extensions.ini
echo "client_max_body_size 20M;" >>/etc/nginx/conf.d/client_max_body_size.conf
sudo /etc/init.d/nginx restart &>> /var/log/run.log
setEnvs:
- forEach(i:nodes.sqldb):
- if (${@i.ismaster}):
cmd [${this.filter}]:
echo ${@i.intIP} DB_MASTER >> /etc/hosts
user: root
- if (!${@i.ismaster}):
cmd [${this.filter}]:
echo ${@i.intIP} DB_SLAVE >> /etc/hosts
user: root
- cmd [${this.filter}]:
- echo ${nodes.nosqldb.first.intIP} RDS >> /etc/hosts
- echo ${nodes.nosqldb.last.intIP} RDC >> /etc/hosts
user: root
setupBL:
- cmd[bl]:
- wget ${globals.PATH}/scripts/varnish/jem_overrides/varnish_balancer.lib -O /var/lib/jelastic/overrides/varnish_balancer.lib
- wget ${globals.PATH}/configs/varnish/default.vcl -O /etc/varnish/default.vcl
user: root
- forEach(nodes.cp):
cmd[${this.filter}]:
- jem balancer addCommonHost -h ${@i.intIP}
- sudo service varnish reload &>> /var/log/run.log
user: root
setupRDConnect:
- setupRDconfig:
id: ${nodes.nosqldb.first.id}
passtype: RD_SESSION_PASS
config: ${this.config}
- setupRDconfig:
id: ${nodes.nosqldb.last.id}
passtype: RD_CACHE_PASS
config: ${this.config}
setupRDconfig:
script: |
var resp = jelastic.env.control.ExecCmdById(getParam('TARGET_APPID'), session, nodeid, toJSON([{ "command": "cat /etc/redis.conf | tail -1 | awk '{print $2}'"}]), false, "root");
var passwd = resp.responses[0].out;
resp = {result: 0, onAfterReturn: []};
resp = jelastic.env.control.ExecCmdByGroup('${env.envName}', session, "storage", toJSON([{ "command": 'sed -ri \"s/${this.passtype}/' + passwd + '/g\" ${this.config}' }]), false, false, "root");
return resp;
nodeid: ${this.id}