Creating A New AutoScale Extension
To create a new AutoScale extension, it’s recommended that you use one of the existing extensions as a base. Extensions are expected to be split into an implementation module and an admin console plugin, and utilise the various interfaces, abstract classes, and utility methods found within the three core modules (autoscale-groups-api, autoscale-groups-core, and autoscale-groups-console).
It’s recommended that you place your two implementation modules under a parent aggregator module, similar as to how was done here with the autoscale-groups-nodes-plugin.
The Implementation Module
The implementation module is where the admin commands, services, and config bean interfaces should exist. The following is expected as a minimum:
-
A ConfigBean extension for
ScalingGroup
- This ConfigBean is the "type" of AutoScale Group, and as such should contain any extension specific attributes and elements. It is expected to follow the naming format of${type}ScalingGroup
(e.g. NodesScalingGroup). -
A service extension for
Scaler
- This service should implement thescaleUp
andscaleDown
methods, and should be qualified with theScalerFor
annotation pointing at yourScalingGroup
ConfigBean. -
Create command - An admin command used to create a scaling group of your extension’s type. This command is expected to be in the format of
create-${ScalingGroupExtensionName}
, and to have a REST endpoint under its own config bean (e.g. thecreate-nodes-scaling-group
command has a REST endpoint under theNodesScalingGroup
config bean). -
Get command - An admin command used to get the configuration of a scaling group of your extension’s type. This command is expected to be in the format of
get-${ScalingGroupExtensionName}-configuration
, and to have a REST endpoint under its own config bean (e.g. theget-nodes-scaling-group-configuration
command has a REST endpoint under theNodesScalingGroup
config bean). -
Set command - An admin command used to set the configuration of a scaling group of your extension’s type. This command is expected to be in the format of
set-${ScalingGroupExtensionName}-configuration
, and to have a REST endpoint under its own config bean (e.g. theset-nodes-scaling-group-configuration
command has a REST endpoint under theNodesScalingGroup
config bean).
The Admin Console Plugin
The admin console plugin is where you add your tabs and pages for listing, creating, deleting, and editing AutoScale
groups of your extension’s type. The "base" admin console plugin provides a tab group integration point that you can add
your extension tabs to named fish.payara.admingui.extensions:autoScaleGroupsTab
(done via your extension’s
console-config.xml
file).
Developer Documentation
AutoScale is split into a number of separate modules, but can be summarised into:
-
An API module
-
Two Core modules (base implementation module and a base Admin Console Plugin)
-
Extension modules
The API Module
This module contains the interfaces and abstract classes intended for use or extension within Payara Server and any extensions. More specifically, it contains:
-
The "group"
ScalingGroups
ConfigBean interface (representing the domain.xml elements and attributes) - this contains the list of all configured scaling groups -
The "base"
ScalingGroup
ConfigBean interface - This is the ConfigBean interface any extension ConfigBean interfaces should extend from to create their own scaling group type. -
The
Scaler
abstract class contract - This is the abstract class extensions should create an implementation service for. This service is used to perform thescaleUp
andscaleDown
operations. -
The
ScaleFor
qualifier - This qualifier is used to link aScaler
service to a specificScalingGroup
, there is only ever meant to be oneScaler
service for eachScalingGroup
extension. -
Abstract classes for creating the get, set, and create Admin Commands from.
This module is expected to be included in the server, regardless of what extension you choose to use.
The Core Modules
There are currently two core modules: a base implementation module, and a base Admin Console plugin.
Both of these modules are expected to be included in the server, regardless of what extension you choose to use.
The Base Implementation Module
This module contains generic admin commands and util classes:
-
The
scale-up
andscale-down
admin commands - this command looks up theScaler
service for theScalingGroup
type attached to the Deployment Group to be scaled, and from it scales the Deployment Group up or down the requested amount. -
The
delete-scaling-group
command is a generic command for deleting scaling groups - extensions do not need to provide their own delete commands unless you wish additional actions to be taken. -
The
list-scaling-groups
command lists all configured scaling groups. -
The
get-deployment-group-scaling-group
command returns theScalingGroup
attached to the provided Deployment Group
The Base Admin Console Plugin
This module contains common handler methods, the tab group that admin console plugin extensions should attach to, and a generic "Active AutoScale Group" page from which a user can see which AutoScale group is attached to a specific Deployment Group and scale it up or down.
Extension Modules
Extension modules are the implementations that provide the ability for Payara Server to scale across different environments. They consist of an implementation module and an admin console plugin. The implementation module provides the config beans, services, and admin commands for creating, configuring, and using an AutoScale group, while the admin console plugin contains the pages and tabs for doing the same from the admin console.
Greater detail of what each module contains can be found above in the Creating A New AutoScale Extension section.