Before you begin: Complete the steps in Prerequisites.
The image build process uses the WebLogic Image Tool to create a Domain on PV domain creation image
. This image contains:
/auxiliary/weblogic-deploy
directory, by default./auxiliary/models
, by default.Use the steps in the following sections to build the domain creation image.
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:
wlsdeploy
as 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
.
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 WDT application archive ZIP file.
Run the following commands to create your application archive ZIP file and put it in the expected directory:
# Delete existing archive.zip in case we have an old leftover version
$ rm -f /tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip
# Move to the directory which contains the source files for our archive
$ cd /tmp/sample/wdt-artifacts/archives/archive-v1
Using the WDT archive helper tool, create the archive in the location that we will use later when we run the WebLogic Image Tool.
$ /tmp/sample/wdt-artifacts/weblogic-deploy/bin/archiveHelper.sh add application -archive_file=/tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1/archive.zip -source=wlsdeploy/applications/myapp-v1
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 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 model YAML file with your WebLogic configuration model.10.yaml
.
CLUSTER_SIZE=5
Here is the WLS model.10.yaml
:
domainInfo:
AdminUserName: '@@SECRET:__weblogic-credentials__:username@@'
AdminPassword: '@@SECRET:__weblogic-credentials__:password@@'
ServerStartMode: 'prod'
topology:
Name: '@@ENV:CUSTOM_DOMAIN_NAME@@'
AdminServerName: 'admin-server'
Cluster:
'cluster-1':
DynamicServers:
ServerTemplate: 'cluster-1-template'
ServerNamePrefix: 'managed-server'
DynamicClusterSize: '@@PROP:CLUSTER_SIZE@@'
MaxDynamicClusterSize: '@@PROP:CLUSTER_SIZE@@'
MinDynamicClusterSize: '0'
CalculatedListenPorts: false
Server:
'admin-server':
ListenPort: 7001
ServerTemplate:
'cluster-1-template':
Cluster: 'cluster-1'
ListenPort: 8001
appDeployments:
Application:
myapp:
SourcePath: 'wlsdeploy/applications/myapp-v1'
ModuleType: ear
Target: 'cluster-1'
resources:
SelfTuning:
MinThreadsConstraint:
SampleMinThreads:
Target: 'cluster-1'
Count: 1
MaxThreadsConstraint:
SampleMaxThreads:
Target: 'cluster-1'
Count: 10
WorkManager:
SampleWM:
Target: 'cluster-1'
MinThreadsConstraint: 'SampleMinThreads'
MaxThreadsConstraint: 'SampleMaxThreads'
The model files:
Define a WebLogic domain with:
cluster-1
admin-server
cluster-1
targeted ear
application that’s located in the WDT archive ZIP file at wlsdeploy/applications/myapp-v1
SampleWM
configured with minimum threads constraint SampleMinThreads
and maximum threads constraint SampleMaxThreads
Use macros to inject external values:
CLUSTER_SIZE
property is referenced in the model YAML file DynamicClusterSize
and MaxDynamicClusterSize
fields using a PROP macro.CUSTOM_DOMAIN_NAME
using an ENV macro.
env
field in its Domain.weblogic-credentials
secret macro reference to the WebLogic credential secret.
webLogicCredentialsSecret
field in the Domain.weblogic-credentials
is a reserved name that always dereferences to the owning Domain actual WebLogic credentials secret name.An image can contain multiple properties files, archive ZIP files, and model 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.
NOTE: If you are using JRF in this sample, substitute JRF
for each occurrence of WLS
in the following imagetool
command line.
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:
$ cd /tmp/sample/wdt-artifacts/wdt-model-files/WLS-v1
$ /tmp/sample/wdt-artifacts/imagetool/bin/imagetool.sh createAuxImage \
--tag wdt-domain-image:WLS-v1 \
--wdtModel ./model.10.yaml \
--wdtVariables ./model.10.properties \
--wdtArchive ./archive.zip
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 domain creation image and does the following:
busybox
base image.latest
when you set up the cache during the sample prerequisites steps.-wdtVersion
flag./auxiliary/models
.When the command succeeds, it should end with output like the following:
[INFO ] Build successful. Build time=36s. Image tag=wdt-domain-image:WLS-v1
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:
$ docker run -it --rm wdt-domain-image:WLS-v1 ls -l /auxiliary
total 8
drwxr-xr-x 1 oracle root 4096 Jun 1 21:53 models
drwxr-xr-x 1 oracle root 4096 May 26 22:29 weblogic-deploy
$ docker run -it --rm wdt-domain-image:WLS-v1 ls -l /auxiliary/models
total 16
-rw-rw-r-- 1 oracle root 5112 Jun 1 21:52 archive.zip
-rw-rw-r-- 1 oracle root 173 Jun 1 21:59 model.10.properties
-rw-rw-r-- 1 oracle root 1515 Jun 1 21:59 model.10.yaml
$ docker run -it --rm wdt-domain-image:WLS-v1 ls -l /auxiliary/weblogic-deploy
total 28
-rw-r----- 1 oracle root 4673 Oct 22 2019 LICENSE.txt
-rw-r----- 1 oracle root 30 May 25 11:40 VERSION.txt
drwxr-x--- 1 oracle root 4096 May 26 22:29 bin
drwxr-x--- 1 oracle root 4096 May 25 11:40 etc
drwxr-x--- 1 oracle root 4096 May 25 11:40 lib
drwxr-x--- 1 oracle root 4096 Jan 22 2019 samples
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.