Creating the script packages
In WebSphere CloudBurst, script packages are the mechanism through which you can provide custom configuration to the WebSphere middleware application environment. A script package consists of a binary archive that contains an executable and supporting artifacts, as well as the configuration settings that tell WebSphere CloudBurst (among other things) how to invoke the script package.
For this example, we will create two different script packages:
- One will install the Account Management application into the WebSphere Application Server environment.
- The other will configure a DB2 data source for use by the application.
To create the script package to install and configure the Account Management application, first click the Catalog -> Script Packages link on the top toolbar in the WebSphere CloudBurst Web console. This brings you to the script package portion of the WebSphere CloudBurst catalog. Click the green cross in the upper left-hand corner to create the new script package.
Figure 2. Creating the new script package
Now upload the binary archive for this script package. The archive for this script package contains a wsadmin script that retrieves the Account Management from a specified location and installs it into the WebSphere Application Server environment
To upload the archive, use the file upload dialog in the Script package files field on your Account Management Application script package details page. After uploading the archive, you'll provide other information about the script package.
Figure 3. Account Management Application script package
Notice that you define a variable in the Environment section named APPLICATION_URL: This enables you to specify the value of this variable at deploy time for patterns containing your script package. The specified value will be accessible to your installation script, enabling the script to retrieve the application binaries from the specified location.
In addition to the variable, you also provide information that directs WebSphere CloudBurst as to how to invoke your script package. Specifically you tell WebSphere CloudBurst to use the wsadmin tool included in the WebSphere Application Server installation to invoke the installApp.jy script that is included in your script package archive. Per the Executes field, WebSphere CloudBurst will automatically invoke this script near the end of pattern deployment, meaning the result of the deployment process will be a WebSphere Application Server environment that includes the Account Management application.
You also need to create a script package that configures a DB2 data source in the WebSphere Application Server environment. The Account Management application will use this data source in order to interact with a DB2 instance. Name this script package "Create DB2 data source." Its archive contains a shell script that coordinates the execution of multiple wsadmin scripts to configure the appropriate resources in the WebSphere Application Server environment.
Figure 4. Script package to create a DB2 data source
Most notably, there are multiple environment variables that allow you to provide data source configuration information at deploy time for patterns containing this script package. This includes information like the data source name, database name, database location, and more. By taking this approach, you can use the same script package to configure a DB2 data source in different environments (development, test, production), and for a number of different DB2 database instances.
After defining the two necessary script packages, you can build patterns using these resources.