Revised common.yml
parent
16c461129c
commit
b760a8cb30
|
@ -1,4 +1,4 @@
|
||||||
globals:
|
globals:
|
||||||
version_lscache: 6.2.0.1
|
version_lscache: 6.5.0.2
|
||||||
version_wordpress: 6.5
|
version_wordpress: 6.6.2
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
jpsType: install
|
||||||
|
jpsVersion: '1.7.2'
|
||||||
|
id: wordpress
|
||||||
|
name: MightyBox WordPress Kit
|
||||||
|
categories:
|
||||||
|
- apps/blogs
|
||||||
|
- apps/content-management
|
||||||
|
- apps/wordpress
|
||||||
|
logo: https://raw.githubusercontent.com/jelastic-jps/wordpress/master/images/wp-standalone.png
|
||||||
|
homepage: http://wordpress.org/
|
||||||
|
description:
|
||||||
|
text: MightyBox standalone WordPress kit with built-in tools for optimizing application servers and advanced features for running websites efficiently. The lightweight WordPress CMS is deployed in its own container with minimal resources to keep costs low.
|
||||||
|
short: MightyBox WordPress Standalone with built-in kit for choosing optimal application servers and a set of advanced features for running websites and blogs
|
||||||
|
|
||||||
|
baseUrl: https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main
|
||||||
|
|
||||||
|
onBeforeInit: /scripts/beforeInit.js?_r=${fn.random}
|
||||||
|
onBeforeInstall: /scripts/beforeInstall.js?_r=${fn.random}
|
||||||
|
nodes: definedInOnBeforeInstall
|
||||||
|
|
||||||
|
skipNodeEmails: true
|
||||||
|
|
||||||
|
mixins:
|
||||||
|
- https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main/configs/vers.yaml
|
||||||
|
|
||||||
|
globals:
|
||||||
|
isSingleDeploy: true
|
||||||
|
ls-addon: true
|
||||||
|
wp_protect: true
|
||||||
|
waf: true
|
||||||
|
le-addon: true
|
||||||
|
cdn-addon: false
|
||||||
|
mu-addon: false
|
||||||
|
woocommerce: false
|
||||||
|
BASE_URL: https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main
|
||||||
|
WP_CLUSTER_PATH: https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/v2.2.0
|
||||||
|
DB_USER: user-${fn.random}
|
||||||
|
DB_PASS: ${fn.password(10)}
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
PROTOCOL: http
|
||||||
|
WP_ADMIN_PASS: ${fn.password(10)}
|
||||||
|
SUCCESS: default
|
||||||
|
flexibleCloudlets: 16
|
||||||
|
fixedCloudlets: 1
|
||||||
|
storage_flexibleCloudlets: 6
|
||||||
|
storage_fixedCloudlets: 1
|
||||||
|
project: default
|
||||||
|
projectScope: production
|
||||||
|
success_email: false
|
||||||
|
|
||||||
|
onInstall:
|
||||||
|
- limits
|
||||||
|
- initLEsettings
|
||||||
|
- setupNode:
|
||||||
|
nodeId: cp
|
||||||
|
- if (${globals.isSingleDeploy}):
|
||||||
|
- setProtocol
|
||||||
|
- setDomain
|
||||||
|
- createUserDB
|
||||||
|
- installWordpress
|
||||||
|
- if (${globals.le-addon}):
|
||||||
|
- installLEaddon
|
||||||
|
- setupLEdomain
|
||||||
|
- installMBaddons
|
||||||
|
- install:
|
||||||
|
- jps: /scripts/events.jps?_r=${fn.random}
|
||||||
|
- jps: ${globals.BASE_URL}/scripts/addons.jps?_r=${fn.random}
|
||||||
|
- if (${globals.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[cp]:
|
||||||
|
data:
|
||||||
|
project: ${globals.project}
|
||||||
|
projectScope: ${globals.projectScope}
|
||||||
|
validation :
|
||||||
|
maxCount: 1
|
||||||
|
|
||||||
|
setProtocol:
|
||||||
|
- script: |
|
||||||
|
return {
|
||||||
|
result: 0,
|
||||||
|
ssl: jelastic.billing.account.GetQuotas('environment.jelasticssl.enabled').array[0].value
|
||||||
|
}
|
||||||
|
- if (${response.ssl} || ${globals.le-addon}):
|
||||||
|
setGlobals:
|
||||||
|
PROTOCOL: https
|
||||||
|
|
||||||
|
setDomain:
|
||||||
|
- script: ${globals.BASE_URL}/scripts/idna.js
|
||||||
|
domains: ${env.domain}
|
||||||
|
- setGlobals:
|
||||||
|
DOMAIN: ${response.domains}
|
||||||
|
|
||||||
|
installLEaddon:
|
||||||
|
- install: https://github.com/jelastic-jps/lets-encrypt/blob/master/manifest.jps?_r=${fn.random}
|
||||||
|
nodeGroup: cp
|
||||||
|
skipEmail: true
|
||||||
|
settings:
|
||||||
|
test: false
|
||||||
|
fallbackToX1: true
|
||||||
|
withExtIp: ${globals.isExtIP}
|
||||||
|
|
||||||
|
initLEsettings:
|
||||||
|
- script: |
|
||||||
|
return {
|
||||||
|
result: 0,
|
||||||
|
extIP: Boolean(jelastic.billing.account.GetQuotas('environment.externalip.enabled').array[0].value)
|
||||||
|
}
|
||||||
|
- setGlobals:
|
||||||
|
isExtIP: ${response.extIP}
|
||||||
|
|
||||||
|
- cmd[cp]: |-
|
||||||
|
[ ! -d /var/lib/jelastic/keys/letsencrypt ] && mkdir -p /var/lib/jelastic/keys/letsencrypt;
|
||||||
|
echo "webroot=true" > /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[cp]: |-
|
||||||
|
source /opt/letsencrypt/settings;
|
||||||
|
bash ~/bin/setupWP.sh --url https://${DOMAIN};
|
||||||
|
|
||||||
|
installWordpress:
|
||||||
|
- install: ${globals.BASE_URL}/scripts/installWP.jps
|
||||||
|
settings:
|
||||||
|
db_host: ${globals.DB_HOST}
|
||||||
|
db_user: ${globals.DB_USER}
|
||||||
|
db_pass: ${globals.DB_PASS}
|
||||||
|
redis_host: /var/run/redis/redis.sock
|
||||||
|
redis_port: 0
|
||||||
|
wp_admin_pass: ${globals.WP_ADMIN_PASS}
|
||||||
|
wp_title: "Hello World"
|
||||||
|
wp_url: ${globals.PROTOCOL}://${globals.DOMAIN}/
|
||||||
|
cluster: false
|
||||||
|
|
||||||
|
installMBaddons:
|
||||||
|
- install: https://deploy.mightybox.io/addons/mb-backup-manager/raw/branch/main/manifest.jps
|
||||||
|
nodeGroup: cp
|
||||||
|
|
||||||
|
- install: https://deploy.mightybox.io/addons/instant-login/raw/branch/main/manifest.jps
|
||||||
|
nodeGroup: cp
|
||||||
|
|
||||||
|
- install: https://deploy.mightybox.io/tony/mb-admin/raw/branch/main/mbadmin.jps
|
||||||
|
nodeGroup: cp
|
||||||
|
|
||||||
|
setupNode:
|
||||||
|
- log: OPTIMIZATION
|
||||||
|
- install: https://raw.githubusercontent.com/jelastic/templates/master/config_v2.jps?_r=${fn.random}
|
||||||
|
settings:
|
||||||
|
targetGroup: cp
|
||||||
|
targetNodes: ${this.nodeId}
|
||||||
|
optimization: wordpress
|
||||||
|
|
||||||
|
createUserDB:
|
||||||
|
- log: Create user for DataBase
|
||||||
|
- cmd[cp]: |-
|
||||||
|
wget https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/master/configs/sqldb/wordpress.cnf -O /etc/mysql/conf.d/wordpress.cnf &>> /var/log/run.log;
|
||||||
|
wget ${globals.BASE_URL}/scripts/setupUser.sh -O ~/setupUser.sh &>> /var/log/run.log;
|
||||||
|
bash ~/setupUser.sh ${globals.DB_USER} ${globals.DB_PASS} &>> /var/log/run.log;
|
||||||
|
jem passwd set -p ${globals.DB_PASS} &>> /var/log/run.log;
|
||||||
|
user: root
|
||||||
|
|
||||||
|
startPage: ${env.url}
|
54
manifest.jps
54
manifest.jps
|
@ -1,5 +1,5 @@
|
||||||
jpsType: install
|
jpsType: install
|
||||||
jpsVersion: '0.1'
|
jpsVersion: '1.7.2'
|
||||||
id: wordpress
|
id: wordpress
|
||||||
name: MightyBox WordPress Kit
|
name: MightyBox WordPress Kit
|
||||||
categories:
|
categories:
|
||||||
|
@ -22,21 +22,34 @@ skipNodeEmails: true
|
||||||
|
|
||||||
mixins:
|
mixins:
|
||||||
- https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main/configs/vers.yaml
|
- https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main/configs/vers.yaml
|
||||||
- /scripts/common.yml
|
|
||||||
|
|
||||||
globals:
|
globals:
|
||||||
isSingleDeploy: ${settings.isSingleDeploy:true}
|
isSingleDeploy: true
|
||||||
|
ls-addon: true
|
||||||
|
wp_protect: true
|
||||||
|
waf: true
|
||||||
|
le-addon: true
|
||||||
|
cdn-addon: false
|
||||||
|
mu-addon: false
|
||||||
|
woocommerce: false
|
||||||
BASE_URL: https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main
|
BASE_URL: https://deploy.mightybox.io/kits/wp-mb-kit/raw/branch/main
|
||||||
DB_USER: ${settings.DB_USER:user-[fn.random]}
|
WP_CLUSTER_PATH: https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/v2.2.0
|
||||||
DB_PASS: ${settings.DB_PASS:[fn.password(10)]}
|
DB_USER: user-${fn.random}
|
||||||
|
DB_PASS: ${fn.password(10)}
|
||||||
DB_HOST: 127.0.0.1
|
DB_HOST: 127.0.0.1
|
||||||
PROTOCOL: http
|
PROTOCOL: http
|
||||||
WP_ADMIN_PASS: ${settings.WP_ADMIN_PASS:[fn.password(10)]}
|
WP_ADMIN_PASS: ${fn.password(10)}
|
||||||
SUCCESS: default
|
SUCCESS: default
|
||||||
|
flexibleCloudlets: 16
|
||||||
|
fixedCloudlets: 1
|
||||||
|
storage_flexibleCloudlets: 6
|
||||||
|
storage_fixedCloudlets: 1
|
||||||
|
project: default
|
||||||
|
projectScope: production
|
||||||
|
success_email: false
|
||||||
|
|
||||||
onInstall:
|
onInstall:
|
||||||
- addLimits
|
- limits
|
||||||
- addMetadata
|
|
||||||
- initLEsettings
|
- initLEsettings
|
||||||
- setupNode:
|
- setupNode:
|
||||||
nodeId: cp
|
nodeId: cp
|
||||||
|
@ -45,40 +58,35 @@ onInstall:
|
||||||
- setDomain
|
- setDomain
|
||||||
- createUserDB
|
- createUserDB
|
||||||
- installWordpress
|
- installWordpress
|
||||||
- if (${settings.le-addon:false}):
|
- if (${globals.le-addon}):
|
||||||
- installLEaddon
|
- installLEaddon
|
||||||
- setupLEdomain
|
- setupLEdomain
|
||||||
- installMBaddons
|
- installMBaddons
|
||||||
- install:
|
- install:
|
||||||
- jps: /scripts/events.jps?_r=${fn.random}
|
- jps: /scripts/events.jps?_r=${fn.random}
|
||||||
- jps: ${globals.BASE_URL}/scripts/addons.jps?_r=${fn.random}
|
- jps: ${globals.BASE_URL}/scripts/addons.jps?_r=${fn.random}
|
||||||
- if ('${settings.success_email}' != 'false'):
|
- if (${globals.success_email} != 'false'):
|
||||||
- return:
|
- return:
|
||||||
type: success
|
type: success
|
||||||
message: /success/text/success-${globals.SUCCESS}.md?_r=${fn.random}
|
message: /success/text/success-${globals.SUCCESS}.md?_r=${fn.random}
|
||||||
email: /success/email/success-${nodes.cp.master.nodeType}-${globals.SUCCESS}.md?_r=${fn.random}
|
email: /success/email/success-${nodes.cp.master.nodeType}-${globals.SUCCESS}.md?_r=${fn.random}
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
addLimits:
|
limits:
|
||||||
- env.control.ApplyNodeGroupData[cp]:
|
- env.control.ApplyNodeGroupData[cp]:
|
||||||
data:
|
data:
|
||||||
|
project: ${globals.project}
|
||||||
|
projectScope: ${globals.projectScope}
|
||||||
validation :
|
validation :
|
||||||
maxCount: 1
|
maxCount: 1
|
||||||
|
|
||||||
addMetadata:
|
|
||||||
script: |
|
|
||||||
var metadata = { project: "${settings.project:default}", projectScope: "${settings.projectScope:production}" };
|
|
||||||
return api.env.control.ApplyEnvProperty ?
|
|
||||||
api.env.control.ApplyEnvProperty('${env.name}', session, metadata) :
|
|
||||||
api.env.control.ApplyNodeGroupData('${env.name}', session, 'cp', metadata);
|
|
||||||
|
|
||||||
setProtocol:
|
setProtocol:
|
||||||
- script: |
|
- script: |
|
||||||
return {
|
return {
|
||||||
result: 0,
|
result: 0,
|
||||||
ssl: jelastic.billing.account.GetQuotas('environment.jelasticssl.enabled').array[0].value
|
ssl: jelastic.billing.account.GetQuotas('environment.jelasticssl.enabled').array[0].value
|
||||||
}
|
}
|
||||||
- if (${response.ssl} || ${settings.le-addon:false}):
|
- if (${response.ssl} || ${globals.le-addon}):
|
||||||
setGlobals:
|
setGlobals:
|
||||||
PROTOCOL: https
|
PROTOCOL: https
|
||||||
|
|
||||||
|
@ -94,7 +102,6 @@ actions:
|
||||||
skipEmail: true
|
skipEmail: true
|
||||||
settings:
|
settings:
|
||||||
test: false
|
test: false
|
||||||
skipEmail: true
|
|
||||||
fallbackToX1: true
|
fallbackToX1: true
|
||||||
withExtIp: ${globals.isExtIP}
|
withExtIp: ${globals.isExtIP}
|
||||||
|
|
||||||
|
@ -118,7 +125,7 @@ actions:
|
||||||
setupLEdomain:
|
setupLEdomain:
|
||||||
- cmd[cp]: |-
|
- cmd[cp]: |-
|
||||||
source /opt/letsencrypt/settings;
|
source /opt/letsencrypt/settings;
|
||||||
bash ~/bin/setupWP.sh --url https://${domain};
|
bash ~/bin/setupWP.sh --url https://${DOMAIN};
|
||||||
|
|
||||||
installWordpress:
|
installWordpress:
|
||||||
- install: ${globals.BASE_URL}/scripts/installWP.jps
|
- install: ${globals.BASE_URL}/scripts/installWP.jps
|
||||||
|
@ -140,6 +147,9 @@ actions:
|
||||||
- install: https://deploy.mightybox.io/addons/instant-login/raw/branch/main/manifest.jps
|
- install: https://deploy.mightybox.io/addons/instant-login/raw/branch/main/manifest.jps
|
||||||
nodeGroup: cp
|
nodeGroup: cp
|
||||||
|
|
||||||
|
- install: https://deploy.mightybox.io/tony/mb-admin/raw/branch/main/mbadmin.jps
|
||||||
|
nodeGroup: cp
|
||||||
|
|
||||||
setupNode:
|
setupNode:
|
||||||
- log: OPTIMIZATION
|
- log: OPTIMIZATION
|
||||||
- install: https://raw.githubusercontent.com/jelastic/templates/master/config_v2.jps?_r=${fn.random}
|
- install: https://raw.githubusercontent.com/jelastic/templates/master/config_v2.jps?_r=${fn.random}
|
||||||
|
@ -152,7 +162,7 @@ actions:
|
||||||
- log: Create user for DataBase
|
- log: Create user for DataBase
|
||||||
- cmd[cp]: |-
|
- cmd[cp]: |-
|
||||||
wget https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/master/configs/sqldb/wordpress.cnf -O /etc/mysql/conf.d/wordpress.cnf &>> /var/log/run.log;
|
wget https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/master/configs/sqldb/wordpress.cnf -O /etc/mysql/conf.d/wordpress.cnf &>> /var/log/run.log;
|
||||||
wget https://deploy-proxy.mightybox.io/kits/wp-mb-kit/raw/branch/main/scripts/setupUser.sh -O ~/setupUser.sh &>> /var/log/run.log;
|
wget ${globals.BASE_URL}/scripts/setupUser.sh -O ~/setupUser.sh &>> /var/log/run.log;
|
||||||
bash ~/setupUser.sh ${globals.DB_USER} ${globals.DB_PASS} &>> /var/log/run.log;
|
bash ~/setupUser.sh ${globals.DB_USER} ${globals.DB_PASS} &>> /var/log/run.log;
|
||||||
jem passwd set -p ${globals.DB_PASS} &>> /var/log/run.log;
|
jem passwd set -p ${globals.DB_PASS} &>> /var/log/run.log;
|
||||||
user: root
|
user: root
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import com.hivext.api.Response;
|
||||||
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
import com.hivext.api.core.utils.Transport;
|
||||||
|
|
||||||
|
var lsAppid = "9e6afcf310004ac84060f90ff41a5aba";
|
||||||
|
var isLS = jelastic.dev.apps.GetApp(lsAppid);
|
||||||
|
|
||||||
|
// Define settings statically as form fields are removed
|
||||||
|
var settings = {
|
||||||
|
"php_version": "php8.3", // PHP version is always set to PHP 8.3
|
||||||
|
"ls-addon": { "hidden": false, "value": true }, // Always enabled
|
||||||
|
"waf-addon": { "hidden": false, "value": true }, // Always enabled
|
||||||
|
"wp_protect-addon": { "hidden": false, "value": true } // Always enabled
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
result: 0,
|
||||||
|
settings: settings
|
||||||
|
};
|
|
@ -6,13 +6,14 @@ var resp = {
|
||||||
nodes: []
|
nodes: []
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('${settings.ls-addon:false}'== 'true') {
|
|
||||||
resp.nodes.push({
|
resp.nodes.push({
|
||||||
nodeType: "llsmp",
|
nodeType: "llsmp",
|
||||||
|
engine: "${settings.php_engine:php8.3}",
|
||||||
count: 1,
|
count: 1,
|
||||||
flexibleCloudlets: ${settings.flexibleCloudlets:16},
|
cloudlets: "${settings.cloudlets:16}",
|
||||||
fixedCloudlets: ${settings.fixedCloudlets:1},
|
diskLimit: "${settings.diskspace:[quota.disk.limitation]}",
|
||||||
nodeGroup: "cp",
|
nodeGroup: "cp",
|
||||||
|
skipNodeEmails: "true",
|
||||||
displayName: "AppServer",
|
displayName: "AppServer",
|
||||||
env: {
|
env: {
|
||||||
SERVER_WEBROOT: "/var/www/webroot/ROOT",
|
SERVER_WEBROOT: "/var/www/webroot/ROOT",
|
||||||
|
@ -22,19 +23,5 @@ if ('${settings.ls-addon:false}'== 'true') {
|
||||||
WP_PROTECT_LIMIT: 100
|
WP_PROTECT_LIMIT: 100
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
resp.nodes.push({
|
|
||||||
nodeType: "lemp",
|
|
||||||
count: 1,
|
|
||||||
flexibleCloudlets: ${settings.flexibleCloudlets:16},
|
|
||||||
fixedCloudlets: ${settings.fixedCloudlets:1},
|
|
||||||
nodeGroup: "cp",
|
|
||||||
displayName: "AppServer",
|
|
||||||
env: {
|
|
||||||
SERVER_WEBROOT: "/var/www/webroot/ROOT",
|
|
||||||
REDIS_ENABLED: "true"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp;
|
return resp;
|
|
@ -2,96 +2,18 @@ actions:
|
||||||
applyEnvSettings:
|
applyEnvSettings:
|
||||||
script: |
|
script: |
|
||||||
var envs = '${this.targetAppid}'.split(',');
|
var envs = '${this.targetAppid}'.split(',');
|
||||||
let nodes = [];
|
|
||||||
let nodeGroups = [], node, nodesByGroup, cloudlets, diskspace, count;
|
|
||||||
|
|
||||||
function getNodesByGroup(targetAppid, group) {
|
|
||||||
let groupNodes = [];
|
|
||||||
let resp = jelastic.env.control.GetEnvInfo(targetAppid, session);
|
|
||||||
if (resp.result != 0) return resp;
|
|
||||||
let nodes = resp.nodes;
|
|
||||||
for (let i = 0, n = nodes.length; i < n; i++) {
|
|
||||||
if (nodes[i].nodeGroup == group) {
|
|
||||||
groupNodes.push(nodes[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { result: 0, nodes: groupNodes }
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var i=0, n = envs.length; i < n; i++) {
|
for (var i=0, n = envs.length; i < n; i++) {
|
||||||
let targetAppid = envs[i];
|
let targetAppid = envs[i];
|
||||||
let resp = jelastic.env.control.GetEnvInfo(targetAppid, session);
|
let resp = jelastic.env.control.GetEnvInfo(targetAppid, session);
|
||||||
if (resp.result != 0) return resp;
|
if (resp.result != 0) return resp;
|
||||||
|
let node = resp.nodes[0];
|
||||||
var env = resp.env;
|
if (String(node.flexibleCloudlets) != '${this.cloudlets}') {
|
||||||
|
resp = jelastic.env.control.SetCloudletsCountByGroup({ appid: targetAppid, session: session, nodeGroup: node.nodeGroup, fixedCloudlets: node.fixedCloudlets, flexibleCloudlets: '${this.cloudlets}'});
|
||||||
for (let i = 0, n = resp.nodes.length; i < n; i++) {
|
if (resp.result != 0) return resp;
|
||||||
node = resp.nodes[i];
|
|
||||||
|
|
||||||
if (nodeGroups.indexOf(String(node.nodeGroup)) == -1) {
|
|
||||||
nodeGroups.push(String(node.nodeGroup));
|
|
||||||
|
|
||||||
nodesByGroup = getNodesByGroup(targetAppid, node.nodeGroup);
|
|
||||||
if (nodesByGroup.result != 0) return nodesByGroup;
|
|
||||||
|
|
||||||
cloudlets = node.flexibleCloudlets;
|
|
||||||
diskspace = node.diskLimit / 1000;
|
|
||||||
count = nodesByGroup.nodes.length;
|
|
||||||
|
|
||||||
if (node.nodeGroup == 'bl') {
|
|
||||||
if (!/cloudlets/.test('${this.bl.cloudlets}'))
|
|
||||||
cloudlets = String(node.flexibleCloudlets) != '${this.bl.cloudlets}' ? '${this.bl.cloudlets}' : node.flexibleCloudlets;
|
|
||||||
if (!/diskspace/.test('${this.bl.diskspace}'))
|
|
||||||
diskspace = String(diskspace) != '${this.bl.diskspace}' ? '${this.bl.diskspace}' : diskspace;
|
|
||||||
if (!/nodes/.test('${this.bl.nodes}'))
|
|
||||||
count = String(nodesByGroup.nodes.length) != '${this.bl.nodes}' ? '${this.bl.nodes}' : nodesByGroup.nodes.length;
|
|
||||||
}
|
}
|
||||||
|
if (String(node.diskLimit) != '${this.diskspace}') {
|
||||||
if (node.nodeGroup == 'cp') {
|
resp = jelastic.env.control.SetDiskLimitByGroup({ appid: targetAppid, session: session, nodeGroup: node.nodeGroup, limit: '${this.diskspace}' });
|
||||||
if (!/cloudlets/.test('${this.cp.cloudlets}'))
|
if (resp.result != 0) return resp;
|
||||||
cloudlets = String(node.flexibleCloudlets) != '${this.cp.cloudlets}' ? '${this.cp.cloudlets}' : node.flexibleCloudlets;
|
|
||||||
if (!/diskspace/.test('${this.cp.diskspace}'))
|
|
||||||
diskspace = String(node.diskLimit) != '${this.cp.diskspace}' ? '${this.cp.diskspace}' : node.diskLimit;
|
|
||||||
if (!/nodes/.test('${this.cp.nodes}'))
|
|
||||||
count = String(nodesByGroup.nodes.length) != '${this.cp.nodes}' ? '${this.cp.nodes}' : nodesByGroup.nodes.length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.nodeGroup == 'sqldb') {
|
|
||||||
if (!/cloudlets/.test('${this.sqldb.cloudlets}'))
|
|
||||||
cloudlets = String(node.flexibleCloudlets) != '${this.sqldb.cloudlets}' ? '${this.sqldb.cloudlets}' : node.flexibleCloudlets;
|
|
||||||
if (!/diskspace/.test('${this.sqldb.diskspace}'))
|
|
||||||
diskspace = String(node.diskLimit) != '${this.sqldb.diskspace}' ? '${this.sqldb.diskspace}' : node.diskLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.nodeGroup == 'nosqldb') {
|
|
||||||
if (!/cloudlets/.test('${this.nosqldb.cloudlets}'))
|
|
||||||
cloudlets = String(node.flexibleCloudlets) != '${this.nosqldb.cloudlets}' ? '${this.nosqldb.cloudlets}' : node.flexibleCloudlets;
|
|
||||||
if (!/diskspace/.test('${this.nosqldb.diskspace}'))
|
|
||||||
diskspace = String(node.diskLimit) != '${this.nosqldb.diskspace}' ? '${this.nosqldb.diskspace}' : node.diskLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.nodeGroup == 'storage') {
|
|
||||||
if (!/cloudlets/.test('${this.storage.cloudlets}'))
|
|
||||||
cloudlets = String(node.flexibleCloudlets) != '${this.storage.cloudlets}' ? '${this.storage.cloudlets}' : node.flexibleCloudlets;
|
|
||||||
if (!/diskspace/.test('${this.storage.diskspace}'))
|
|
||||||
diskspace = String(node.diskLimit) != '${this.storage.diskspace}' ? '${this.storage.diskspace}' : node.diskLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes.push({
|
|
||||||
flexibleCloudlets: cloudlets,
|
|
||||||
fixedCloudlets: node.fixedCloudlets,
|
|
||||||
nodeType: node.nodeType,
|
|
||||||
nodeGroup: node.nodeGroup,
|
|
||||||
diskLimit: diskspace,
|
|
||||||
count: count
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resp = api.env.control.ChangeTopology({
|
|
||||||
envName: targetAppid,
|
|
||||||
session: session,
|
|
||||||
env: env,
|
|
||||||
nodes: nodes
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return { result: 0 };
|
return { result: 0 };
|
Loading…
Reference in New Issue