Auxiliary image creation
Contents
Before you begin: Complete the steps in Prerequisites .
Overview
Auxiliary image creation step uses the WebLogic Image Tool to create a Model in Image auxiliary image. This image contains:
- The directory where the WebLogic Deploy Tooling software is installed (also known as WDT Home), expected in an image’s
/auxiliary/weblogic-deploydirectory, by default. - WDT model YAML file (model), WDT variable (property), and WDT archive ZIP (archive) files, expected in directory
/auxiliary/models, by default.
Auxiliary image creation
Use the steps in the following sections for creating the auxiliary image.
Understand your first archive
The sample includes a predefined archive directory in /tmp/sample/wdt-artifacts/archives/archive-v1 that you will use to create an archive ZIP file for the image.
The archive top directory, named wlsdeploy, contains a directory named applications, which includes an ’exploded’ sample JSP web application in the directory, myapp-v1. Three useful aspects to remember about WDT archives are:
- A model image can contain multiple WDT archives.
- WDT archives can contain multiple applications, libraries, and other components.
- WDT archives have a
well defined directory structure
, which always has
wlsdeployas the top directory.
The application displays important details about the WebLogic Server instance that it’s running on: namely its domain name, cluster name, and server name, as well as the names of any data sources that are targeted to the server. Also, you can see that application output reports that it’s at version v1; you will update this to v2 in a later use case that demonstrates upgrading the application.
Stage a ZIP file of the archive
When you create the image, you will use the files in the staging directory, /tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1. In preparation, you need it to contain a ZIP file of the WDT application archive.
Run the following commands to create your application archive ZIP file and put it in the expected directory:
Using the WDT archive helper tool , create the archive in the location that we will use later when we run the WebLogic Image Tool.
Stage model files
In this step, you explore the staged WDT model YAML file and properties in the /tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1 directory. The model in this directory references the web application in your archive, configures a WebLogic Server Administration Server, and configures a WebLogic cluster. It consists of two files only, model.10.properties, a file with a single property, and, model.10.yaml, a YAML file with your WebLogic configuration model.10.yaml.
Here is the WLS model.10.yaml:
The model files:
-
Define a WebLogic domain with:
- Cluster
cluster-1 - Administration Server
admin-server - A
cluster-1targetedearapplication that’s located in the WDT archive ZIP file atwlsdeploy/applications/myapp-v1 - A Work Manager
SampleWMconfigured with minimum threads constraintSampleMinThreadsand maximum threads constraintSampleMaxThreads
- Cluster
-
Use macros to inject external values:
- The property file
CLUSTER_SIZEproperty is referenced in the model YAML fileDynamicClusterSizeandMaxDynamicClusterSizefields using a PROP macro. - The model file domain name is injected using a custom environment variable named
CUSTOM_DOMAIN_NAMEusing an ENV macro.- You set this environment variable later in this sample using an
envfield in its Domain. - This conveniently provides a simple way to deploy multiple differently named domains using the same model image.
- You set this environment variable later in this sample using an
- The model file administrator user name and password are set using a
weblogic-credentialssecret macro reference to the WebLogic credential secret.- This secret is in turn referenced using the
webLogicCredentialsSecretfield in the Domain. - The
weblogic-credentialsis a reserved name that always dereferences to the owning Domain actual WebLogic credentials secret name.
- This secret is in turn referenced using the
- The property file
An image can contain multiple properties files, archive ZIP files, and YAML files but in this sample you use just one of each. For a complete description of WDT model file naming conventions, file loading order, and macro syntax, see Model files in the user documentation.
Create the image with WIT
At this point, you have all of the files needed for image wdt-domain-image:WLS-v1 staged; they include:
/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/model.10.yaml/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/model.10.properties/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip
Now, you use the Image Tool to create an image named wdt-domain-image:WLS-v1. You’ve already set up this tool during the prerequisite steps.
Run the following commands to create the image and verify that it worked:
If you don’t see the imagetool directory, then you missed a step in the
prerequisites
.
This command runs the WebLogic Image Tool to create the image and does the following:
- Builds the final container image as a layer on a small
busyboxbase image. - Copies the WDT ZIP file that’s referenced in the WIT cache into the image.
- Note that you cached WDT in WIT using the keyword
latestwhen you set up the cache during the sample prerequisites steps. - This lets WIT implicitly assume it’s the desired WDT version and removes the need to pass a
-wdtVersionflag.
- Note that you cached WDT in WIT using the keyword
- Copies the specified WDT model, properties, and application archives to image location
/u01/wdt/models.
When the command succeeds, it should end with output like the following:
Also, if you run the docker images command, then you will see an image named wdt-domain-image:WLS-v1.
After the image is created, it should have the WDT executables in
/auxiliary/weblogic-deploy, and WDT model, property, and archive
files in /auxiliary/models. You can run ls in the Docker
image to verify this:
NOTE: If you have Kubernetes cluster worker nodes that are remote to your local machine, then you need to put the image in a location that these nodes can access. See Ensuring your Kubernetes cluster can access images .