IBM PureApplication can provide you out of the box a number of pattern-types; you can also upload new pattern-types at IBM PureSystems Center but what about if you want to create your own pattern-type that describe your own application environment!
You can do it on PureApplication and SmartCloud Application Services. Here some steps to start to write your first pattern-type. First I strongly encourage you to read this article “IBM PureSystems acronyms for beginners” from Fabio Albertoni.
What is a pattern-type or ptype: You can see a pattern-type as a tool box to design a virtual application pattern. A pattern-type will provide a set of components and links between them. Each component can have policies, operations, and tweaks.
A pattern-type (or ptype) is build from a Pattern-Type plugin and multiple plugins which contributes to components, links and policies that appear the virtual application builder. In this picture, you can see a number of components, on the left hand side, provided by the Web Application Pattern type.
First you have to install the PDK (Plug-in Development Kit) in an Eclipse environment, this plugin will provide wizard and functionality which will help you to develop your own plugin.
Much information can found in the IBM Workload Deployer InfoCenter.
For example, you have a wizard to create a new System-Type plugin and a default project skeleton will be automatically created.
Once you have installed the PDK, you can create a pattern-type project, the pattern-type project has a file called pattern-type in which you will define the pattern-type name, the version, the license type and so on (more information). This is defined in a file called patterntype.json
Then you can create your first plugin project and thus create your first component. In this project you will have to modify/adapt a number of files to provide the desired functionality:
config.json: This file is mainly used to describe the relationship between the plugin and the pattern-type; the plugin can have primary, secondary and linked pattern type. It contains also the plugin versions.
metadata.json: This file holds the application model and describes the components, policies and links and their parameters available while designing a pattern in the virtual application pattern builder UI.
operation.json: All operations available from the ‘management’ console are described in this file, each operation will launch actions on a component of a running pattern.
tweak.json: The tweak.json file allows you to customize a component of a running pattern. Attributes described in this file are persisted and re-usable during scalability and resiliency process.
monitoring_ui.json: This one is used to described the monitoring graph available from the management console. It contains the data source collector description, the data attribute to display on the graph and the type of graph.
*.vm: These files are the templates that will be used to generate the topology to deploy. Each file describes how the VM have to be created regarding the components, links and policies defined in the metadata.json, it can also include other resources requests such as storage.
*.java: These files have the same functionality as the *.vm but instead of using a json format and maestro scripting to define the template, it uses java.
OSGI files: These files which are in an xml format register the OSGI service that will be used to convert the *.vm or *.java into a topology.
MANIFEST.MF: The MANIFEST.MF is used to describe all components needed to generate the topology, the developer will reference there the different OSGI files.
Parts and NodeParts directory: are used to store the different scripts that have to be launched during the deployment. Some files have special functionality such as install.py, configure.py, start.py …
Once you’ve designed your pattern type, you can build it. The build will create a file that you can upload either on IBM PureSystems, IWD or IBM SmartCloud Application Services.
For example, here I created a master-slave pattern type with scaling policies based on number of files on a directory and monitoring.
Here the pattern based on the pattern-type I created:
Here the monitoring graph: