Pattern type packaging reference
Several virtual application pattern types are included with Cloud Pak System Software for Power®.
The pattern types are a collection of plug-ins. The plug-ins contain the components, policies, and links of the virtual application pattern. They are packaged in a pattern type.
Pattern type files
- patterntypes/{ptype}.tgz
- The built pattern type file, where {ptype} is the pattern type name.
- plugins/{plugin}.tgz
- One or more built plug-in files, where {plugin} is the plug-in name.
- files/{name}
- One or more files that are used by your plug-in, such as software to install on deployed virtual machines.
{
"name":"NAME",
"shortname":"webapp",
"version":"2.0.0.0",
"description":"DESCRIPTION",
"prereqs":{
"foundation":"*"
},
"license":{
"pid":"5725D57",
"type":"PVU"
}
}
{
"name":"db2",
"version":"2.0.0.0",
"files":[
"db2/db2_wse_en-9.7.0.3a-linuxx64-20110330.tgz",
"optim/dsadm223_iwd_20110420_1600_win.zip",
"optim/dsdev221_iwd_20110421_1200_win.zip",
"optim/com.ibm.optim.database.administrator.pek_2.2.jar",
"optim/com.ibm.optim.development.studio.pek_2.2.jar"
],
"patterntypes":{
"primary":{
"dbaas":"1.0"
},
"secondary":[
{
"webapp":"2.0"
}
]
},
"packages":{
"DB2":[
{
"persistent":true,
"requires":{
"arch":"x86_64"
},
"parts":[
{
"part":"parts/db2-9.7.0.3.tgz",
"parms":{
"installDir":"/opt/ibm/db2/V9.7"
}
},
{
"part":"parts/db2.scripts.tgz"
}
]
}
]
}
}
Packaging a pattern type
To understand the options for packaging a pattern type, you must understand how files are stored. Files, such as software images, are stored in the Storehouse. After they are in the storehouse, they can be referenced by scripts for installation. This central storage location enables reuse of files. For example, if you create a My Pattern 1.0 pattern type and include the file samples/sample_file.tgz in one of the plug-ins, the file is saved in the Storehouse. If you update functions in the plug-in but do not need to update the samples/sample_file.tgz, you can package an updated My Pattern 1.1 pattern type with the new plug-in and exclude samples/sample_file.tgz from the file directory structure during packaging.
When you package files in a plug-in,
you must reference the files in config.json.
A top-level files
element is a JSON
array of relative file names. At build time, these files are retrieved
from a file server. If you use the requires
element with an arch
element
to specify a specific architecture that is supported for a part
in the pattern type, then only the parts
that are needed for the supported architecture,
or parts
with no specified architecture
requirements, are loaded when the plug-in is deployed. For more information,
see "Plug-in development steps".
storage.url
property
is used to provide the file server URL. For example, -Dstorage.url=http://fileserver.example.com/managed/plugins/
storage.dir
instead. For example:-Dstorage.dir=/packages/plugins
https://172.16.65.88/storehouse/admin/files/db2/db2_wse_en-9.7.0.3a-linuxx64-20110330.tgz
You
can then view the files with Storehouse Browser, from the user interface. part/install.py
script can
download files from the Storehouse by using the following lines:installerUrl = urlparse.urljoin(maestro.filesurl, "db2/db2_wse_en-9.7.0.3a-linuxx64-20110330.tgz")
maestro.downloadx(installerUrl, installDir)
- maestro.filesurl
- Provides the root Storehouse URL. For the previous Storehouse
URL example, the root URL is
https://172.16.65.88/storehouse/admin/files/
- maestro.downloadx
- The function downloads a .zip, .tgz or .tar.gz file that is given by installerUrl and extracts it into the installDir directory.
You can package files as a part of the pattern
type packaging build or you can package files within individual plug-in
builds. The builds include a -Dstorage.url
parameter
to retrieve files from a file server. The -Dstorage.url
parameter
uses the Ant get
task to download
the files.
If a -Dstorage
option
is not specified, the files are put in your plugin
archive
or patterntype
archive in the correct
relative path under the files
directory,
but with a .placeholder
suffix added to the file
name. Each file contains only the relative path name.
- Go to the plugin.depends directory
in your plug-in PDK workspace and run Ant.
This command builds all the plug-ins in the workspace, and puts the resulting .tgz files in the plugin.depends/image/plugins directory.ant_path/ant -f build.xml
- Go to the root of the pattern type project, and type the following
command:
ant_path/ant -f build.patterntype.xml -Dstorage.url=file_server_url
Or for a local directoryant_path/ant -f build.patterntype.xml -Dstorage.dir=local_path
For example,ant_path/ant -f build.patterntype.xml -Dstorage.url=http://fileserver.example.com/managed/plugins/
The patterntype.tgz file is saved in the export subdirectory of the project and includes retrieved files in the files subdirectory of the archive.
To package files in an individual plug-in, build the plug-in from the plug-in directory with the Virtual Application Extension Archive format.
ant_path/ant -f build.plugin.xml -Dstorage.url=file_server_url publishVAEA
ant_path/ant -f build.plugin.xml -Dstorage.dir=local_path
ant_path/ant -f build.plugin.xml -Dstorage.url=http://fileserver.example.com/managed/plugins/ publishVAEA
The plugin-vaea.tgz file is saved in the export directory, and includes retrieved files in the files subdirectory of the archive.