diff --git a/docs/creating-manifest/addons.md b/docs/creating-manifest/addons.md index 3ad63be6..d2d61206 100644 --- a/docs/creating-manifest/addons.md +++ b/docs/creating-manifest/addons.md @@ -1,10 +1,86 @@ # Add-Ons -Cloud Scripting allows you to install a custom add-on either to a new environment, or to the existing one. You can develop your custom add-on in confines of another - *parent* manifest. Therefore, you need to state the add-on's installation type to *update* and declare essential properties within the *addons* section. +Cloud Scripting allows you to install a custom add-on either to existing environment, or a new one. Thus you can develop your custom add-on as a separate manifest or in confines of another - *parent* manifest. Respectively, you need to state the add-on's installation type to *update* or declare its essential properties within the *addons* section of *parent* manifest. -You can install the developed add-on either by specifying a target *nodeGroup*, or by calling the *installAddon* action. +You can install the developed add-on either by specifying a *[target](../visual-settings/#target-nodes)* and/or by calling the [*installAddon*](../actions/#installaddon) action. + +The following examples illustrate the add-on's installation to a specific *nodeGroup* (layer) ***cp***. + +Separate manifest with type *update* can be implemented in different ways: + +Example #1. + +@@@ +```yaml +type: update +name: Custom Addon +id: custom-addon-id +targetNodes: + nodeGroup: cp + +onInstall: + api [cp]: environment.control.RestartNodes +``` +```json +{ + "type": "update", + "name": "Custom Addon", + "id": "custom-addon-id", + "targetNodes": { + "nodeGroup": "cp" + }, + "onInstall": { + "api [cp]": "environment.control.RestartNodes" + } +} +``` +@@! + +Example #2. The *installAddon* action call: + +@@@ +```yaml +type: update +name: Addon installation +targetNodes: + nodeGroup: cp + +onInstall: + installAddon: + id: custom-addon-id + +addons: + - id: custom-addon-id + name: Custom Addon + onInstall: + api [cp]: environment.control.RestartNodes +``` +```json +{ + "type": "update", + "name": "Addon installation", + "targetNodes": { + "nodeGroup": "cp" + }, + "onInstall": { + "installAddon": { + "id": "custom-addon-id" + } + }, + "addons": [ + { + "id": "custom-addon-id", + "name": "Custom Addon", + "onInstall": { + "api [cp]": "environment.control.RestartNodes" + } + } + ] +} +``` + +Custom add-on installation on newly created environment via built-in implementation in parent manifest: -The following example illustrates the add-on's installation to a specific *nodeGroup* (layer). @@@ ```yaml type: install @@ -45,46 +121,96 @@ addons: ``` @@! -In the example above, the Jelastic API *RestartNodes* method is executed after the environment creation is completed. The compute node is restarted at the end of the manifest installation procedure. Herewith, the add-on is installed, if the *parent* manifest's installation type is *install*. When the add-on is installed, the **Add-ons** tab for the corresponding compute node becomes available at the dashboard. +In the examples above, the Jelastic API *[RestartNodes](https://docs.jelastic.com/api/#!/api/environment.Control-method-RestartNodes)* method is executed after the environment creation is completed. The compute node is restarted at the end of the manifest installation procedure. Herewith, the add-on is installed, if the *parent* manifest's installation type is *install*. + +When the add-on is installed, the ***Add*-ons** tab for the corresponding compute node becomes available at the dashboard. ![new-addon](/img/new-addon.png) -The following example illustrates the add-on's installation by calling the *installAddon* action. You can call this action for both *update* and *install* installation types of a *parent* manifest. +### Add-On Uninstallation + +By default add-on is created with an ***Uninstall*** menu item within **Add-ons** tab. + +![uninstall-button](/img/uninstall-button.png) + +If required this menu item can be hidden with an optional boolean parameter ***permanent***. +Where: + + - `permanent`: *true* - hides the *Uninstall* button for the specified custom add-on + - `permanent`: *false* - this option is equal default behaviour when the *permanent* parameter is not specified and makes the *Uninstall* button visible + +For example: + @@@ ```yaml -type: install -name: Addon installation - +type: update +name: Custom Addon +id: custom-addon-id +permanent: true +targetNodes: + nodeGroup: cp + onInstall: - installAddon: - id: custom-addon-id - -addons: - - id: custom-addon-id - name: Custom Addon - onInstall: - createFile [cp]: /var/log/test.log + api [cp]: environment.control.RestartNodes ``` ```json { - "type": "install", - "name": "Addon installation", - "onInstall": { - "installAddon": { - "id": "custom-addon-id" - } + "type": "update", + "name": "Custom Addon", + "id": "custom-addon-id", + "permanent": true, + "targetNodes": { + "nodeGroup": "cp" }, - "addons": { - "id": "custom-addon-id", - "name": "Custom Addon", - "onInstall": { - "createFile [cp]": "/var/log/test.log" - } + "onInstall": { + "api [cp]": "environment.control.RestartNodes" } } ``` @@! -Through this example, a new *test.log* file is created during the *onInstall* action execution. You can declare the add-on's expected behaviour within the *addons* section, while the *installAddon* action is needed to specify the appropriate add-on's identifier. + +![no-uninstall-button](/img/no-uninstall-button.png) + +In case the addon was created with disabled the *Uninstall* button(*permanent: true*) and this add-on is not required anymore, you can forcibly delete it via an API action: *[marketplace.jps.Uninstall](https://docs.jelastic.com/api/#!/api/marketplace.Jps-method-Uninstall)* with a parameter ***force=true***. + +For example: + +@@@ +```yaml +id: addon-uninstall +type: update +name: Custom Add-On Forcible Uninstall + +onInstall: unInstallAddon + +actions: + unInstallAddon: + - api: marketplace.jps.Uninstall + appid : "3bf111ec625c0e8b1a9ed2d473a7aec2" + force : true + appUniqueName":"114d6123-8a22-4d36-9bb2-26e1effa6fdf" +``` +```json +{ + "id": "addon-uninstall", + "type": "update", + "name": "Custom Add-On Forcible Uninstall", + "onInstall": "unInstallAddon", + "actions": { + "unInstallAddon": [ + { + "api": "marketplace.jps.Uninstall", + "appid": "3bf111ec625c0e8b1a9ed2d473a7aec2", + "force": true, + "appUniqueName": "114d6123-8a22-4d36-9bb2-26e1effa6fdf" + } + ] + } +} +``` +@@! + +

What’s next?

diff --git a/theme/readthedocs/img/new-addon.png b/theme/readthedocs/img/new-addon.png index 9ed79624..ebb7f3df 100644 Binary files a/theme/readthedocs/img/new-addon.png and b/theme/readthedocs/img/new-addon.png differ diff --git a/theme/readthedocs/img/no-uninstall-button.png b/theme/readthedocs/img/no-uninstall-button.png new file mode 100644 index 00000000..06c4d4ca Binary files /dev/null and b/theme/readthedocs/img/no-uninstall-button.png differ diff --git a/theme/readthedocs/img/uninstall-button.png b/theme/readthedocs/img/uninstall-button.png new file mode 100644 index 00000000..ebeec44e Binary files /dev/null and b/theme/readthedocs/img/uninstall-button.png differ