Distribution
Manages scaling of applications. Distribution is responsible for creating and removing application instances. It is identified by id.
Elements
id
Distribution id.
applicationId
Id of application that will be managed by the distribution.
numberOfInstances
Number of application-instances that need to be running.
checkIfNodeCanAcceptNewApplicationInstanceScriptId
Id of script that checks if node can accept new application-instances. If the value is null, node's script or default script will be used.
selectNodeForNewApplicationInstanceScriptId
Id of script that selects node for new application-instance. If the value is null, the default script will be used.
selectApplicationInstanceToRemoveScriptId
Id of script that selects node that will have the application-instance removed. If the value is null, the default script will be used.
Usage
Distribution is highly recommended for production environment. It can automatically handle amount of instances that can be changed at any moment.
There is a few options to create distribution
Create distribution using CLI
onteoncli distribution create --application-id=<application-id> --number-of-instances=<number-of-application-instances>
Create distribution using CLI - with distribution file.
First, you need to create yaml file that describes distribution. Example file:
application: <application-id>
numberOfInstances: <number-of-application-instances>
type: <type>
scripts:
checkIfNodeCanAcceptNewApplicationInstance: <name-of-script OPTIONAL>
selectNodeForNewApplicationInstance: <name-of-script OPTIONAL>
selectApplicationInstanceToRemove: <name-of-script OPTIONAL>
Then, execute command:
onteoncli distribution create-from-file <distribution-file>
Create distribution using http API
If you want to create distribution via http api, you can send POST request to /onteon-api-access/api/distributions
.
For more information, click here.
Modifying distribution
You can always modify you distribution. E.q. you can easily change the number of instances by
executing onteoncli distribution set-number-of-instances <id> <newNumberOfInstances>
. Environment will be updated
during the next rescheduling. You can set when the rescheduling job should
start here, by specifying cron expression.
Distributing instances
Scripts are used to decide where specific application instance should be located or which one should be removed. If you do not specify scripts, the distribution will use the default scripts.