version: 1.3 type: update build: 202402271353 id: letsencrypt-ssl-addon name: Let's Encrypt Free SSL categories: - apps/dev-and-admin-tools targetEditions: [ "devops", "wordpress", "lite_do", "lite_vultr", "lite_gc", "ultimate", "light", "business" ] targetNodes: nodeType: [ tomcat6, tomcat7, tomcat8, tomcat85, tomcat9, tomcat, tomee, tomee-dockerized, glassfish3, glassfish4, glassfish, jetty, jetty6, apache, apache2, nginxphp, nginxphp-dockerized, litespeedphp, litespeedadc, lemp, llsmp, apache2-ruby, apache-ruby, nginx-ruby, nginxruby, nginx, nginx-dockerized, haproxy, apache-lb, varnish, varnish-dockerized, payara, wildfly, nodejs, apache-python, jenkins, jenkins2 ] homepage: https://github.com/jelastic-jps/lets-encrypt baseUrl: https://raw.githubusercontent.com/jelastic-jps/lets-encrypt/master logo: images/letsencrypt.png description: text: /text/description.md short: Free tool to configure support of secured SSL connection for an environment, by either internal or custom domain name. globals: scriptSufix: letsencrypt-ssl app_id: letsencrypt-ssl-addon mixins: - configs/vers.yaml - https://raw.githubusercontent.com/jelastic-jps/common/main/clustered-addon-utils.yml settings: fields: - type: string name: customDomains vtype: domainlist caption: External Domain(s) placeholder: leave blank to get a test certificate for this environment domain required: false tooltip: | Each of the specified external domains should be preliminarily bound via DNS record to the external IP of the node where add-on is installed (either directly via A Record or through CDN / external balancer proxy).

Note: Leave this field blank for issuing a test SSL certificate bound to the internal environment domain. onBeforeRedeployContainer [${targetNodes.nodeGroup}]: callScript: action: backup-scripts onAfterRedeployContainer [${targetNodes.nodeGroup}]: callScript: action: restore-scripts onAfterStart: callScript: action: check-for-update buttons: - confirmText: Do you want to update attached SSL certificate(s)? loadingText: Updating... action: update caption: Update Now successText: /text/success.md - caption: Configure settings: main action: configure onInstall: - cmd[${targetNodes.nodeGroup}]: |- [[ -e /usr/bin/python ]] || ln -s /usr/bin/python3 /usr/bin/python user: root - setGlobals: nodeId: ${settings.nodeId:} nodeGroup: ${targetNodes.nodeGroup:} withExtIp: ${settings.withExtIp:} withIntSSL: ${settings.withIntSSL:true} webroot: ${settings.webroot:} webrootPath: ${settings.webrootPath:} fallbackToX1: ${settings.fallbackToX1:} deployHook: ${settings.deployHook:} deployHookType: ${settings.deployHookType:} undeployHook: ${settings.undeployHook:} undeployHookType: ${settings.undeployHookType:} test: ${settings.test:} envAppid: ${env.appid} - checkClustering: nodeGroup: ${globals.nodeGroup} app_id: ${globals.app_id} - if (globals.cluster): - createFile: envName: ${globals.secondaryEnvName} nodeGroup: ${globals.nodeGroup} app_id: ${globals.app_id} - if (!globals.isOppositeExecuted): - markExecutedEnvFile: nodeGroup: ${targetNodes.nodeGroup} app_id: ${globals.app_id} - if (globals.isSecondaryEnv): installLE: envName: ${globals.primaryEnvName} - else: installLE: envName: ${globals.secondaryEnvName} - removeExecutedEnvFile: nodeGroup: ${targetNodes.nodeGroup} app_id: ${globals.app_id} - if (globals.isSecondaryEnv): return: type: success - else: installScript - else: installScript onUninstall: - checkClustering: nodeGroup: ${globals.nodeGroup} app_id: letsencrypt-ssl-addon - if (globals.cluster): - markExecutedEnvFile: nodeGroup: ${targetNodes.nodeGroup} app_id: ${globals.app_id} - if (!globals.isOppositeExecuted): - if (globals.isSecondaryEnv): - executeAction: envName: ${globals.primaryEnvName} nodeGroup: ${globals.nodeGroup} action: uninstall app_id: ${globals.app_id} - else: - executeAction: envName: ${globals.secondaryEnvName} nodeGroup: ${globals.nodeGroup} action: uninstall app_id: ${globals.app_id} - removeExecutedEnvFile: nodeGroup: ${targetNodes.nodeGroup} app_id: ${globals.app_id} - callScript: action: uninstall - delete onBeforeDelete: delete onAfterClone: installLE: envName: ${event.response.env.envName} onAfterConfirmTransfer: installScript actions: installScript: script: /scripts/create-installation-script.js?_r=${fn.random} params: scriptName: ${env.envName}-${targetNodes.nodeGroup}-${globals.scriptSufix} baseUrl: ${baseUrl} cronTime: 0 ${fn.random(1,6)},${fn.random(10,14)},${fn.random(15,20)} * * * customDomains: ${settings.customDomains} nodeId: ${globals.nodeId} nodeGroup: ${globals.nodeGroup} deployHook: ${globals.deployHook} deployHookType: ${globals.deployHookType} undeployHook: ${globals.undeployHook} undeployHookType: ${globals.undeployHookType} withExtIp: ${globals.withExtIp} withIntSSL: ${globals.withIntSSL} webroot: ${globals.webroot} webrootPath: ${globals.webrootPath} appId: ${globals.app_id} fallbackToX1: ${globals.fallbackToX1} test: ${globals.test} clientVersion: ${globals.version_acme-sh:} envAppid: ${globals.envAppid} callScript: script: | var targetAppid = api.dev.apps.CreatePersistence ? "${globals.envAppid}" : appid; var resp = api.dev.scripting.Eval(targetAppid, session, '${env.envName}-${targetNodes.nodeGroup}-${globals.scriptSufix}', {action:'${this.action}'}); if (resp.result == 0 && typeof resp.response === 'object' && resp.response.result != 0) resp = resp.response; return resp; update: - checkClustering: nodeGroup: ${globals.nodeGroup} app_id: ${globals.app_id} - if (globals.cluster): - if (globals.isSecondaryEnv): executeAction: envName: ${globals.primaryEnvName} nodeGroup: ${globals.nodeGroup} action: update app_id: ${globals.app_id} - else: callScript: action: auto-update - else: callScript: action: auto-update configure: - checkClustering: nodeGroup: ${globals.nodeGroup} app_id: letsencrypt-ssl-addon - if (globals.cluster): - if (!globals.isOppositeExecuted): - markExecutedEnvFile: nodeGroup: ${targetNodes.nodeGroup} app_id: ${globals.app_id} - if (globals.isSecondaryEnv): executeAction: envName: ${globals.primaryEnvName} nodeGroup: ${globals.nodeGroup} action: configure app_id: ${globals.app_id} - else: executeAction: envName: ${globals.secondaryEnvName} nodeGroup: ${globals.nodeGroup} action: configure app_id: ${globals.app_id} - removeExecutedEnvFile: nodeGroup: ${targetNodes.nodeGroup} app_id: ${globals.app_id} - if (globals.isSecondaryEnv): return: type: success - installScript delete: script: | var targetAppid = api.dev.apps.CreatePersistence ? "${globals.envAppid}" : appid; api.dev.scripting.DeleteScript(targetAppid, session, '${env.envName}-${targetNodes.nodeGroup}-${globals.scriptSufix}'); return {result:0} installLE: install: ${baseUrl}/manifest.jps envName: ${this.envName} nodeGroup: ${globals.nodeGroup} settings: customDomains: ${settings.customDomains} nodeGroup: ${globals.nodeGroup} deployHookType: ${globals.deployHookType} undeployHookType: ${globals.undeployHookType} withExtIp: ${globals.withExtIp} withIntSSL: ${globals.withIntSSL} webroot: ${globals.webroot} webrootPath: ${globals.webrootPath} fallbackToX1: ${globals.fallbackToX1} test: ${globals.test} createScript: script: | var targetAppid = api.dev.apps.CreatePersistence ? "${globals.envAppid}" : appid; return api.dev.scripting.CreateScript(targetAppid, session, "${this.scriptName}", "js", "${this.code:}") success: /text/success.md