The Oracle WebLogic Deploy Tooling (WDT) makes the automation of WebLogic Server domain provisioning and applications deployment easy. Instead of writing WLST scripts that need to be maintained, WDT creates a declarative, metadata model that describes the domain, applications, and the resources used by the applications. This metadata model makes it easy to provision, deploy, and perform domain lifecycle operations in a repeatable fashion, which makes it perfect for the Continuous Delivery of applications.
The WebLogic Deploy Tooling provides maximum flexibility by supporting a wide range of WebLogic Server versions from 10.3.6 to 188.8.131.52. WDT supports both Windows and UNIX operating systems, and provides the following benefits:
Provides easy validation of the model content and verification that its related artifacts are well-formed.
Currently, the project provides five single-purpose tools, all exposed as shell scripts:
The WebLogic on Docker and Kubernetes projects take advantage of WDT to provision WebLogic domains and deploy applications inside of a Docker image or in a Kubernetes persistent volume (PV). The Discover and Create Domain Tools enable us to take a domain running in a non-Docker/Kubernetes environment and lift and shift them into these environments. Docker/Kubernetes environments require a specific WebLogic configuration (for example, network). The Validate Model Tool provides mechanisms to validate the WebLogic configuration and ensure that it can run in these environments.
We have created a sample in the GitHub WebLogic Docker project, https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-wdt, to demonstrate how to provision a WebLogic 184.108.40.206 domain inside of a Docker image. The WebLogic domain is configured with a WebLogic dynamic cluster, a simple application deployed, and a data source that connects to an Oracle database running inside of a container. This sample includes a basic WDT model, simple-topology.yaml, that describes the intended configuration of the domain within the Docker image. WDT models can be created and modified using a text editor, following the format and rules described in the README file for the WDT project in GitHub. Alternatively, the model can be created using the WDT Discover Domain Tool to introspect an already existing WebLogic domain.
Domain creation may require the deployment of applications and libraries. This is accomplished by creating a ZIP archive with a specific structure, then referencing those items in the model. This sample creates and deploys a simple ZIP archive, containing a small application WAR. The archive is built in the sample directory prior to creating the Docker image.
How to Build and Run
The image is based on a WebLogic Server 220.127.116.11 image in the docker-images repository. Follow the README in https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/18.104.22.168 to build the WebLogic Server install image to your local repository. The WebLogic Deploy Tool installer is used to build this sample WebLogic domain image.
This sample deploys a simple, one-page web application contained in a ZIP archive, archive.zip. This archive needs to be built before building the domain Docker image.
Before the domain image is built, we also need the WDT model simple-topology.yaml. If you want to customize this WebLogic domains sample, you can either use an editor to change the model simple-topology.yaml or use the WDT Discover Domain Tool to introspect an already existing WebLogic domain.
The image below shows you a snippet of the sample WDT model simple-topology.yaml where the database password will be encrypted and replaced by the value in the properties file we will supply before running the WebLogic domain containers.
To build this sample, run:
$ docker build \ --build-arg WDT_MODEL=simple-topology.yaml \ --build-arg WDT_ARCHIVE=archive.zip \ --force-rm=true \ -t 12213-domain-wdt .
You should have a WebLogic domain image in your local repository.
How to Run
In this sample, each of the Managed Servers in the WebLogic domain have a data source deployed to them. We want to connect the data source to an Oracle database running in a container. Pull the Oracle database image from the Docker Store or the Oracle Container Registry into your local repository.
$ docker pull container-registry.oracle.com/database/enterprise:22.214.171.124
Create the Docker network for the WLS and database containers to run:
$ docker network create -d bridge SampleNET
Run the Database Container
To create a database container, use the environment file below to set the database name, domain, and feature bundle. The example environment file, properties/env.txt, is:
DB_SID=InfraDB DB_PDB=InfraPDB1 DB_DOMAIN=us.oracle.com DB_BUNDLE=basic
Run the database container by running the following Docker command:
$ docker run -d --name InfraDB --network=SampleNET \ -p 1521:1521 -p 5500:5500 \ --env-file /Users/mriccell/Docker/docker-images/OracleWebLogic/samples/12213-domain-wdt/properties/env.txt \ -it --shm-size="8g" \ container-registry.oracle.com/database/enterprise:126.96.36.199
Verify that the database is running and healthy. The STATUS field shows (healthy) in the output of docker ps.
The database is created with the default password 'Oradoc_db1'. To change the database password, you must use sqlplus. To run sqlplus pull the Oracle Instant Client from the Oracle Container Registry or the Docker Store, and run a sqlplus container with the following command:
$ docker run -ti --network=SampleNET --rm \ store/oracle/database-instantclient:188.8.131.52 \ sqlplus sys/Oradoc_db1@InfraDB:1521/InfraDB.us.oracle.com \ AS SYSDBA SQL> alter user system identified by dbpasswd container=all;
Make sure you add the new database password 'dbpasswd ' in the properties file, properties/domain.properties DB_PASSWORD. Verify that you can connect to the database:
$ docker exec -ti InfraDB \ /u01/app/oracle/product/12.2.0/dbhome_1/bin/sqlplus \ system/dbpasswd@InfraDB:1521/InfraPDB1.us.oracle.com SQL> select * from Dual;
Run the WebLogic Domain
You will need to modify the domain.properties file in properties/domain.properties with all the parameters required to run the WebLogic domain, including the database password.
To start the containerized Administration Server, run:
$ docker run -d --name wlsadmin --hostname wlsadmin \ --network=SampleNET -p 7001:7001 \ -v /Users/mriccell/Docker/docker-images/OracleWebLogic/samples/12213-domain-wdt/properties:/u01/oracle/properties \ 12213-domain-wdt
To start a containerized Managed Server (ms-1) to self-register with the Administration Server above, run:
$ docker run -d --name ms-1 --link wlsadmin:wlsadmin \ --network=SampleNET -p 9001:9001 \ -v /Users/mriccell/Docker/docker-images/OracleWebLogic/samples/12213-domain-wdt/properties:/u01/oracle/properties \ -e MS_NAME=ms-1 12213-domain-wdt startManagedServer.sh
To start an additional Managed Server (in this example, ms-2), run:
$ docker run -d --name ms-2 --link wlsadmin:wlsadmin \ --network=SampleNET -p 9002:9001 \ -v /Users/mriccell/Docker/docker-images/OracleWebLogic/samples/12213-domain-wdt/properties:/u01/oracle/properties \ -e MS_NAME=ms-2 12213-domain-wdt startManagedServer.sh
The above scenario will give you a WebLogic domain with a dynamic cluster set up on a single host environment. Let’s verify that the servers are running and that the data source connects to the Oracle database running in the container. Invoke the WLS Administration Console by entering this URL in your browser, ‘http://localhost:7001/console’. Log in using the credentials you provided in the domain.properties file.
The WebLogic Deploy Tooling simplifies the provisioning of WebLogic domains, deployment of applications, and the resources these applications need. The WebLogic on Docker/Kubernetes projects take advantage of these tools to simplify the provisioning of domains inside of an image or persisted to a Kubernetes persistent volume. We have released the General Availability version of the WebLogic Kubernetes Operator which simplifies the management of WebLogic domains in Kubernetes. Soon we will release the WebLogic Kubernetes Operator version 2.0 which provides enhancements to the management of WebLogic domains. We continue to provide tooling to make it simple to provision, deploy, and manage WebLogic domains with the goal of providing the greatest degree of flexibility for where these domains can run. We hope this sample is helpful to anyone wanting to use the WebLogic Deploy Tooling for provisioning and deploying WebLogic Server domains, and we look forward to your feedback.