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.
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:
-
nodes
- a environment topology which will be created -
onAfterScaleIn
,onAfterScaleOut
- scaling events -
cmd
- action to execute shell commands -
updateNodes
- custom action baseUrl
- external links relative path
type: install
name: Advanced Payara Micro Cluster
baseUrl: https://github.com/jelastic-jps/payara/raw/master/addons
nodes:
count: 1
cloudlets: 16
nodeGroup: cp
image: jelastic/payara-micro-cluster
env:
HAZELCAST_GROUP: ${fn.uuid}
HAZELCAST_PASSWORD: ${fn.password}
volumes:
- /opt/payara/deployments
- /opt/payara/config
- /var/log
onInstall:
- forEach(nodes.cp):
updateNodes:
option: add
ip: ${@i.intIP}
- install: ${baseUrl}/application-storage/manifest.jps
onAfterScaleOut[cp]:
forEach(event.response.nodes):
updateNodes:
option: add
ip: ${@i.intIP}
onAfterScaleIn[cp]:
forEach(event.response.nodes):
updateNodes:
option: remove
ip: ${@i.intIP}
actions:
updateNodes:
cmd[cp]: $PAYARA_PATH/bin/clusterManager.sh --${this.option}host ${this.ip}
description: |
Example: The package automatically provisions Payara Micro cluster,
mounts storage container and deploys test war applications.
success: https://github.com/jelastic-jps/payara/blob/master/payara-micro-cluster-advanced/scripts/successText.md
logo: https://raw.githubusercontent.com/jelastic-jps/payara/master/images/70.png
homepage: http://docs.cloudscripting.com/
{
"type": "install",
"name": "Advanced Payara Micro Cluster",
"nodes": [{
"count": 1,
"cloudlets": 16,
"nodeGroup": "cp",
"image": "jelastic/payara-micro-cluster",
"env": {
"HAZELCAST_GROUP": "${fn.uuid}",
"HAZELCAST_PASSWORD": "${fn.password}"
},
"volumes": [
"/opt/payara/deployments",
"/opt/payara/config",
"/var/log"
]
}],
"onInstall": [
{
"forEach(nodes.cp)": {
"updateNodes": {
"option": "add",
"ip": "${@i.intIP}"
}
}
},
{
"install": "${baseUrl}/application-storage/manifest.jps"
}
],
"onAfterScaleOut[cp]": {
"forEach(event.response.nodes)": {
"updateNodes": {
"option": "add",
"ip": "${@i.intIP}"
}
}
},
"onAfterScaleIn[cp]": {
"forEach(event.response.nodes)": {
"updateNodes": {
"option": "remove",
"ip": "${@i.intIP}"
}
}
},
"actions": {
"updateNodes": {
"cmd[cp]": "$PAYARA_PATH/bin/clusterManager.sh --${this.option}host ${this.ip}"
}
},
"success": "https://github.com/jelastic-jps/payara/blob/master/payara-micro-cluster-advanced/scripts/successText.md",
"baseUrl": "https://github.com/jelastic-jps/payara/raw/master/addons",
"logo": "https://raw.githubusercontent.com/jelastic-jps/payara/master/images/70.png",
"description": "Example: The package automatically provisions Payara Micro cluster, mounts storage container and deploys test war applications.",
"homepage": "http://docs.cloudscripting.com/"
}
What’s next?
-
Build a simple automation with Quick Start Guide
-
Learn how to Create Manifest
-
Explore the list of available Actions
-
See the Events list the actions can be bound to
-
Find out the list of Placeholders for automatic parameters fetching
-
Read how to integrate your Custom Scripts
-
Examine a bunch of Samples with operation and package examples