Cloud Scripting Overview

Jelastic Cloud Scripting (CS) is a tool, designed to program the cloud platform behaviour related to your application lifecycle for automating frequent tasks, complex CI/CD flows and clustering configurations.

newoverview

There are three main pillars of cloud scripting:

  • Actions - scripted logic for executing a set of commands to automate the tasks. The system provides a default list of actions and possibility to script custom actions using API calls, Linux bash shell command, JS and Java scripts

  • Events - specific triggers for executing actions on a required application lifecycle stage

  • Injection - supplying default actions, placeholders, platform API methods, environment variables, request parameters and input settings in custom scripts by default

The developed Cloud Scripting solutions are wrapped into packages and distributed with Jelastic Packaging Standard (JPS). This is accomplished through preparing a manifest file in JSON format. Such packaged solutions can be effortlessly deployed to the platform via import functionality.

The example below represents the Cloud Scripting basic use case. This manifest declares the creation of a new environment with the Jelastic-certified Payara Micro cluster image and provides possibility to configure new cluster members while scaling nodes. Within the manifest, the following key parameters are declared:

{
  "type": "install",
  "name": "Simple Payara Micro Cluster",
  "nodes": [
    {
      "cloudlets": 16,
      "nodeGroup": "cp",
      "image": "jelastic/payara-micro-cluster",
      "env": {
        "HAZELCAST_GROUP": "CHANGE_ME",
        "HAZELCAST_PASSWORD": "CHANGE_ME",
        "VERT_SCALING": "true"
      },
      "volumes": [
        "/opt/payara/deployments",
        "/opt/payara/config",
        "/var/log"
      ]
    }
  ],
  "onBeforeServiceScaleOut[nodeGroup:cp]": "addClusterMembers",
  "onAfterScaleIn[nodeGroup:cp]": {
    "forEach(event.response.nodes)": {
      "cmd [cp]": "$PAYARA_PATH/bin/clusterManager.sh --removehost ${@i.intIP}"
    }
  },
  "onInstall": "addClusterMembers",
  "actions": {
    "addClusterMembers": {
      "forEach(nodes.cp)": {
        "cmd [cp]": "$PAYARA_PATH/bin/clusterManager.sh --addhost ${@i.intIP}"
      }
    }
  }
}


What’s next?