From 03b0a41290f0fed27cb3347567e5981c025fc7c4 Mon Sep 17 00:00:00 2001 From: Dmytro Tsurko <22764205+dimkadt@users.noreply.github.com> Date: Mon, 2 May 2022 09:21:48 +0300 Subject: [PATCH 01/14] JE-61681 [Minio Cluster][MP] Update to the latest version (#5) * Update manifest.jps * Update manifest.jps * Update manifest.jps * Update manifest.jps * Update build-cluster.js * Update manifest.jps * Update build-cluster.js * Update manifest.jps * Update manifest.jps * JE-61681 [Minio Cluster][MP] Update to the latest version * JE-61681 [Minio Cluster][MP] Update to the latest version * JE-62560 [ Minio Cluster ] [ Updated version ] after scaling nodes count the new node is not added into servers list * JE-61681 [Minio Cluster][MP] Update to the latest version Co-authored-by: Dmitry Tsurko --- build-cluster.js | 4 ++-- manifest.jps | 32 +++++++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/build-cluster.js b/build-cluster.js index 34cb49b..86cdebd 100644 --- a/build-cluster.js +++ b/build-cluster.js @@ -1,5 +1,5 @@ //@auth -//@req(nodeGroup, volumePath) +//@req(nodeGroup, volumePath, port) var envName = '${env.envName}', nodes = jelastic.env.control.GetEnvInfo(envName, session).nodes, @@ -15,7 +15,7 @@ if (servers.length == 1) servers[0] = volumePath; for (var i = 0; i < nodes.length; i++) { if (nodes[i].nodeGroup != nodeGroup) continue; - resp.push(jelastic.env.control.SetDockerRunCmd(envName, session, nodes[i].id, "server " + servers.join(' ') + " --address :$PORT")); + resp.push(jelastic.env.file.ReplaceInBody(envName, session, '/etc/default/minio', '^MINIO_VOLUMES=.*', "MINIO_VOLUMES=" + servers.join(' ') + " --address :" + port + " --console-address :" + consolePort, 1, null, null, false, nodes[i].id )); } return { diff --git a/manifest.jps b/manifest.jps index 38aae12..3f8f306 100644 --- a/manifest.jps +++ b/manifest.jps @@ -19,6 +19,9 @@ description: globals: accessKey: ${fn.password} secretKey: ${fn.password} + port: 80 + consolePort: 4949 + exportPath: /export settings: fields: @@ -38,28 +41,31 @@ nodes: count: ${settings.nodes} cloudlets: 16 nodeGroup: cp - image: minio/minio:RELEASE.2020-12-03T05-49-24Z - env: - MINIO_ACCESS_KEY: ${globals.accessKey} - MINIO_SECRET_KEY: ${globals.secretKey} - PORT: 80 - cmd: --help - volumes: - - /export/ - -ssl: true + image: jelastic/minio:RELEASE.2022-03-22T02-05-10Z + password: ${globals.secretKey} + skipNodeEmails: true + validation: + maxCount: ${settings.nodes} + minCount: ${settings.nodes} onInstall: + - cmd[cp]: |- + jem passwd set -p ${globals.secretKey} -u ${globals.accessKey} + jem service stop + rm -rf /${globals.exportPath}/.minio.sys + user: root - build-cluster - restartContainers [cp] - + actions: build-cluster: script: build-cluster.js params: nodeGroup: cp - volumePath: /export - + volumePath: ${globals.exportPath} + port: ${globals.port} + consolePort: ${globals.consolePort} + success: text: /text/success.md email: /text/success.md From be26a839126f51e4d91c5c110952c84b8e578390 Mon Sep 17 00:00:00 2001 From: Dmytro Tsurko <22764205+dimkadt@users.noreply.github.com> Date: Tue, 21 Mar 2023 09:26:14 +0200 Subject: [PATCH 02/14] Minio 2023-02-27T18-10-45Z (#7) * JE-65493 Minio 2023-02-17T17-52-43 * Update manifest.jps * JE-65493 Minio update * Update manifest.jps * JE-65493 Minio 2023-02-27T18-10-45Z * JE-65493 Minio 2023-02-27T18-10-45Z * JE-65493 Minio 2023-02-27T18-10-45Z --- build-cluster.js | 3 ++- manifest.jps | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build-cluster.js b/build-cluster.js index 86cdebd..dffd718 100644 --- a/build-cluster.js +++ b/build-cluster.js @@ -15,7 +15,8 @@ if (servers.length == 1) servers[0] = volumePath; for (var i = 0; i < nodes.length; i++) { if (nodes[i].nodeGroup != nodeGroup) continue; - resp.push(jelastic.env.file.ReplaceInBody(envName, session, '/etc/default/minio', '^MINIO_VOLUMES=.*', "MINIO_VOLUMES=" + servers.join(' ') + " --address :" + port + " --console-address :" + consolePort, 1, null, null, false, nodes[i].id )); + resp.push(jelastic.env.file.ReplaceInBody(envName, session, '/etc/default/minio', '^MINIO_VOLUMES=.*', "MINIO_VOLUMES=\"" + servers.join(' ') + "\"", 1, null, null, false, nodes[i].id )); + resp.push(jelastic.env.file.ReplaceInBody(envName, session, '/etc/default/minio', '^MINIO_OPTS=.*', "MINIO_OPTS=\" --address :" + port + " --console-address :" + consolePort + "\"", 1, null, null, false, nodes[i].id )); } return { diff --git a/manifest.jps b/manifest.jps index 3f8f306..8d123a3 100644 --- a/manifest.jps +++ b/manifest.jps @@ -41,7 +41,7 @@ nodes: count: ${settings.nodes} cloudlets: 16 nodeGroup: cp - image: jelastic/minio:RELEASE.2022-03-22T02-05-10Z + image: jelastic/minio:RELEASE.2023-02-27T18-10-45Z password: ${globals.secretKey} skipNodeEmails: true validation: From 6887684a7a67327ecfb32552507969114cef0515 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Mon, 31 Jul 2023 17:49:18 +0300 Subject: [PATCH 03/14] JE-67057 [Minio] The variable MINIO_SERVER_URL is not defined --- manifest.jps | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifest.jps b/manifest.jps index 8d123a3..6f9e75e 100644 --- a/manifest.jps +++ b/manifest.jps @@ -54,6 +54,8 @@ onInstall: jem service stop rm -rf /${globals.exportPath}/.minio.sys user: root + - cmd[cp]: |- + echo "MINIO_SERVER_URL=${env.protocol}://${env.domain}" >> /etc/default/minio - build-cluster - restartContainers [cp] From 177618fbaea89c9cd5deac790a84b4dee7e338ca Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Mon, 31 Jul 2023 17:51:24 +0300 Subject: [PATCH 04/14] JE-67057 --- manifest.jps | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.jps b/manifest.jps index 6f9e75e..6830200 100644 --- a/manifest.jps +++ b/manifest.jps @@ -56,6 +56,7 @@ onInstall: user: root - cmd[cp]: |- echo "MINIO_SERVER_URL=${env.protocol}://${env.domain}" >> /etc/default/minio + echo "MINIO_BROWSER_REDIRECT_URL=${env.protocol}://${env.domain}" >> /etc/default/minio - build-cluster - restartContainers [cp] From 44741ae973316fda9dac89ccc2b4eb46181f1485 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Fri, 1 Sep 2023 11:51:47 +0300 Subject: [PATCH 05/14] JE-67057 --- manifest.jps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.jps b/manifest.jps index 6830200..866ce9d 100644 --- a/manifest.jps +++ b/manifest.jps @@ -56,7 +56,7 @@ onInstall: user: root - cmd[cp]: |- echo "MINIO_SERVER_URL=${env.protocol}://${env.domain}" >> /etc/default/minio - echo "MINIO_BROWSER_REDIRECT_URL=${env.protocol}://${env.domain}" >> /etc/default/minio + echo "MINIO_BROWSER_REDIRECT_URL=${env.protocol}://${env.domain}:4949" >> /etc/default/minio - build-cluster - restartContainers [cp] From e06a7050dde5764ba2b702968562c1950c882ed8 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Tue, 5 Sep 2023 14:29:50 +0300 Subject: [PATCH 06/14] JE-63662 --- scripts/deployHook.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/deployHook.js diff --git a/scripts/deployHook.js b/scripts/deployHook.js new file mode 100644 index 0000000..7df5833 --- /dev/null +++ b/scripts/deployHook.js @@ -0,0 +1,10 @@ +envName = getParam('envName'); +envDomain = getParam('envDomain'); +scriptName = getParam('action') == 'uninstall' ? 'undeployLE.sh' : 'deployLE.sh'; + +//getting first custom domain +customDomains = (getParam('customDomains') || "").replace(/^\s+|\s+$/gm , "").split(/\s*[;,\s]\s*/).shift(); +domain = customDomains || envDomain; + +//executing custom deployment hook script on master node +return api.env.control.ExecCmdById(envName, session, getParam('nodeId'), toJSON([{ command:'/bin/bash /root/' + scriptName}]), true); From 1438960307fa6bde4f79179a1f7c6803bcb2f170 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Tue, 5 Sep 2023 14:43:54 +0300 Subject: [PATCH 07/14] JE-63662 --- text/success.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/success.md b/text/success.md index 9355af4..d7cfb74 100644 --- a/text/success.md +++ b/text/success.md @@ -1,4 +1,4 @@ -Admin Panel: [${env.url}](${env.url}) +Admin Panel: [${globals.PROTOCOL:http}://${globals.DOMAIN}/](${globals.PROTOCOL:http}://${globals.DOMAIN}/) Access Key: ${globals.accessKey} Secret Key: ${globals.secretKey} From efa8be2856a04ab3b613ca190dd6f6ecf7a68085 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Tue, 5 Sep 2023 15:13:17 +0300 Subject: [PATCH 08/14] JE-63662 --- text/success.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/success.md b/text/success.md index d7cfb74..fb10d7f 100644 --- a/text/success.md +++ b/text/success.md @@ -1,4 +1,4 @@ -Admin Panel: [${globals.PROTOCOL:http}://${globals.DOMAIN}/](${globals.PROTOCOL:http}://${globals.DOMAIN}/) +Admin Panel: [${globals.PROTOCOL:http}://${env.domain}/](${globals.PROTOCOL:http}://${env.domain}/) Access Key: ${globals.accessKey} Secret Key: ${globals.secretKey} From 7636fd8484699ec42c10e1fb1eadeb55a1bbb560 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Tue, 5 Sep 2023 17:44:42 +0300 Subject: [PATCH 09/14] JE-63662 --- manifest.jps | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/manifest.jps b/manifest.jps index 866ce9d..a864803 100644 --- a/manifest.jps +++ b/manifest.jps @@ -3,7 +3,7 @@ version: 1.5 id: minio name: Minio Cluster homepage: https://github.com/jelastic-jps/minio -baseUrl: https://raw.githubusercontent.com/jelastic-jps/minio/master +baseUrl: https://raw.githubusercontent.com/jelastic-jps/minio/JE-63662 logo: images/minio-logo-70x70.png categories: [ apps/file-manager ] @@ -22,6 +22,19 @@ globals: port: 80 consolePort: 4949 exportPath: /export + DEPLOY_HOOK: /root/deployLE.sh + UNDEPLOY_HOOK: /root/undeployLE.sh + DEPLOY_HOOK_JS: ${baseUrl}/scripts/deployHook.js + +onBeforeInit: | + var settings = jps.settings; + var fields = settings.fields; + var quotas = jelastic.billing.account.GetQuotas('environment.externalip.enabled' + ";" + 'environment.maxcloudletsperrec').array; + for (var i = 0; i < quotas.length; i++){ + var q = quotas[i], n = toNative(q.quota.name); + if (n == 'environment.externalip.enabled' && !q.value) { fields.splice(0,1); }; + } + return { result: 0, settings: settings }; settings: fields: @@ -36,7 +49,11 @@ settings: 16: 16 nodes default: 4 required: true - + - type: checkbox + name: le-addon + caption: Install Let's Encrypt Certificates and Custom Domains Addon. Public IP is required. + value: false + nodes: count: ${settings.nodes} cloudlets: 16 @@ -48,6 +65,14 @@ nodes: maxCount: ${settings.nodes} minCount: ${settings.nodes} +onAfterChangeTopology: + - if (${event.response.response.env.sslstate}): + setSSL: + value: 1 + - else: + setSSL: + value: 0 + onInstall: - cmd[cp]: |- jem passwd set -p ${globals.secretKey} -u ${globals.accessKey} @@ -58,6 +83,15 @@ onInstall: echo "MINIO_SERVER_URL=${env.protocol}://${env.domain}" >> /etc/default/minio echo "MINIO_BROWSER_REDIRECT_URL=${env.protocol}://${env.domain}:4949" >> /etc/default/minio - build-cluster + - if (!${settings.le-addon:false}): + - installAddon: + id: letsencrypt-ssl-addon + nodeGroup: cp + - if (${settings.le-addon:false}): + - install-LE: + skipEnvs: true + - setGlobals: + PROTOCOL: https - restartContainers [cp] actions: @@ -68,6 +102,59 @@ actions: volumePath: ${globals.exportPath} port: ${globals.port} consolePort: ${globals.consolePort} + + install-LE: + - cmd[cp]: |- + printf '#!/bin/bash + mkdir -p /export/.minio/certs/ + cp /var/lib/jelastic/keys/privkey.pem /export/.minio/certs/private.key + cp /var/lib/jelastic/keys/fullchain.pem /export/.minio/certs/public.crt + sed -i "s|MINIO_SERVER_URL=http://|MINIO_SERVER_URL=https://|g" /etc/default/minio + sed -i "s|MINIO_BROWSER_REDIRECT_URL=http://|MINIO_BROWSER_REDIRECT_URL=https://|g" /etc/default/minio + sed -i "s|MINIO_OPTS=.*|MINIO_OPTS=\\" --address :443 --console-address :4949 --certs-dir /export/.minio/certs\\"|g" /etc/default/minio + service minio restart' > ${globals.DEPLOY_HOOK} + + printf '#!/bin/bash + sed -i "s|MINIO_SERVER_URL=https://|MINIO_SERVER_URL=http://|g" /etc/default/minio + sed -i "s|MINIO_BROWSER_REDIRECT_URL=https://|MINIO_BROWSER_REDIRECT_URL=http://|g" /etc/default/minio + sed -i "s|MINIO_OPTS=.*|MINIO_OPTS=\\" --address :80 --console-address :4949\\"|g" /etc/default/minio + service minio restart' > ${globals.UNDEPLOY_HOOK} + - install: + jps: https://raw.githubusercontent.com/jelastic-jps/lets-encrypt/master/manifest.jps?_r=${fn.random} + nodeGroup: cp + settings: + deployHook: ${globals.DEPLOY_HOOK_JS} + deployHookType: js + undeployHook: ${globals.DEPLOY_HOOK_JS} + undeployHookType: js + customDomains: ${env.domain} + + setSSL: + cmd[cp]: |- + CONFIG="/etc/default/minio"; + [[ "${this.value}" -eq 1 ]] && { + sed -i "s|MINIO_SERVER_URL=http://|MINIO_SERVER_URL=https://|g" $CONFIG + sed -i "s|MINIO_BROWSER_REDIRECT_URL=http://|MINIO_BROWSER_REDIRECT_URL=https://|g" $CONFIG + sed -i "s|--address :80|--address :443|g" $CONFIG + } || { + sed -i "s|MINIO_SERVER_URL=https://|MINIO_SERVER_URL=http://|g" $CONFIG + sed -i "s|MINIO_BROWSER_REDIRECT_URL=https://|MINIO_BROWSER_REDIRECT_URL=http://|g" $CONFIG + sed -i "s|--address :443|--address :80|g" $CONFIG + } + service minio restart + +add-ons: + - id: letsencrypt-ssl-addon + name: Let's Encrypt + Custom Domains + description: Press "Install" button to initiate installation procedure + globals: + HTTPS_PORT: 443 + buttons: + - caption: Install + action: install-LE + loadingText: Installing... + confirmText: Do you want to install Let's Encrypt addon? + successText: Let's Encrypt addon has been successfully installed! success: text: /text/success.md From 523d9afcd1211db712fab0a1b1ced5569ae79b0a Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Wed, 6 Sep 2023 10:57:36 +0300 Subject: [PATCH 10/14] JE-63662 --- manifest.jps | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/manifest.jps b/manifest.jps index a864803..657d038 100644 --- a/manifest.jps +++ b/manifest.jps @@ -3,7 +3,7 @@ version: 1.5 id: minio name: Minio Cluster homepage: https://github.com/jelastic-jps/minio -baseUrl: https://raw.githubusercontent.com/jelastic-jps/minio/JE-63662 +baseUrl: https://raw.githubusercontent.com/jelastic-jps/minio/master logo: images/minio-logo-70x70.png categories: [ apps/file-manager ] @@ -65,14 +65,6 @@ nodes: maxCount: ${settings.nodes} minCount: ${settings.nodes} -onAfterChangeTopology: - - if (${event.response.response.env.sslstate}): - setSSL: - value: 1 - - else: - setSSL: - value: 0 - onInstall: - cmd[cp]: |- jem passwd set -p ${globals.secretKey} -u ${globals.accessKey} @@ -143,7 +135,7 @@ actions: } service minio restart -add-ons: +addons: - id: letsencrypt-ssl-addon name: Let's Encrypt + Custom Domains description: Press "Install" button to initiate installation procedure From 8f8e763005928c27cec0e22e81a6c51ac308e9f3 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Wed, 6 Sep 2023 10:58:38 +0300 Subject: [PATCH 11/14] JE-63662 --- manifest.jps | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/manifest.jps b/manifest.jps index 657d038..692400d 100644 --- a/manifest.jps +++ b/manifest.jps @@ -120,20 +120,6 @@ actions: undeployHook: ${globals.DEPLOY_HOOK_JS} undeployHookType: js customDomains: ${env.domain} - - setSSL: - cmd[cp]: |- - CONFIG="/etc/default/minio"; - [[ "${this.value}" -eq 1 ]] && { - sed -i "s|MINIO_SERVER_URL=http://|MINIO_SERVER_URL=https://|g" $CONFIG - sed -i "s|MINIO_BROWSER_REDIRECT_URL=http://|MINIO_BROWSER_REDIRECT_URL=https://|g" $CONFIG - sed -i "s|--address :80|--address :443|g" $CONFIG - } || { - sed -i "s|MINIO_SERVER_URL=https://|MINIO_SERVER_URL=http://|g" $CONFIG - sed -i "s|MINIO_BROWSER_REDIRECT_URL=https://|MINIO_BROWSER_REDIRECT_URL=http://|g" $CONFIG - sed -i "s|--address :443|--address :80|g" $CONFIG - } - service minio restart addons: - id: letsencrypt-ssl-addon From eca45f11682692d7aa70e40daa63e2a9126216b6 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Wed, 6 Sep 2023 12:01:44 +0300 Subject: [PATCH 12/14] JE-63662 --- manifest.jps | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifest.jps b/manifest.jps index 692400d..7a40550 100644 --- a/manifest.jps +++ b/manifest.jps @@ -65,6 +65,12 @@ nodes: maxCount: ${settings.nodes} minCount: ${settings.nodes} +onAfterChangeTopology: + - if (${event.response.response.env.sslstate}): + cmd[cp]: iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4949 + - else: + cmd[cp]: iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4949 + onInstall: - cmd[cp]: |- jem passwd set -p ${globals.secretKey} -u ${globals.accessKey} From 0278241753895a58282a440d7e2169f180b6f535 Mon Sep 17 00:00:00 2001 From: Volodymyr K <4066982+vovkuIaka@users.noreply.github.com> Date: Mon, 27 May 2024 14:58:04 +0300 Subject: [PATCH 13/14] JE-63662 --- manifest.jps | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifest.jps b/manifest.jps index 7a40550..a5945cd 100644 --- a/manifest.jps +++ b/manifest.jps @@ -32,7 +32,9 @@ onBeforeInit: | var quotas = jelastic.billing.account.GetQuotas('environment.externalip.enabled' + ";" + 'environment.maxcloudletsperrec').array; for (var i = 0; i < quotas.length; i++){ var q = quotas[i], n = toNative(q.quota.name); - if (n == 'environment.externalip.enabled' && !q.value) { fields.splice(0,1); }; + if (n == 'environment.externalip.enabled' && !q.value) { + settings.fields = fields.filter(function(item) { return item.name != "le-addon" }); + } } return { result: 0, settings: settings }; From a1c85a5a68eeae61eed8ec2fd6ceaf9b9747e6f2 Mon Sep 17 00:00:00 2001 From: Volodymyr K <4066982+vovkuIaka@users.noreply.github.com> Date: Tue, 28 May 2024 16:08:24 +0300 Subject: [PATCH 14/14] JE-63662 --- manifest.jps | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/manifest.jps b/manifest.jps index a5945cd..dea903a 100644 --- a/manifest.jps +++ b/manifest.jps @@ -29,12 +29,8 @@ globals: onBeforeInit: | var settings = jps.settings; var fields = settings.fields; - var quotas = jelastic.billing.account.GetQuotas('environment.externalip.enabled' + ";" + 'environment.maxcloudletsperrec').array; - for (var i = 0; i < quotas.length; i++){ - var q = quotas[i], n = toNative(q.quota.name); - if (n == 'environment.externalip.enabled' && !q.value) { - settings.fields = fields.filter(function(item) { return item.name != "le-addon" }); - } + if ("${quota.environment.externalip.enabled}" == 0) { + settings.fields = fields.filter(function(item) { return item.name != "le-addon" }); } return { result: 0, settings: settings };