0 0 Share PDF

Oracle Weblogic and Oracle Database Application on Docker Enterprise Edition 17.06

Article ID: KB000683

Overview

This guide illustrates how Docker Enterprise Edition (EE) is used to deploy Oracle Weblogic Server running the MedRec sample application with the Oracle Database.

Oracle Weblogic Overview

Oracle Weblogic (Oracle WLS) is a scalable, enterprise-ready J2EE-based application server for developing and deploying multi-tier distributed enterprise applications. Weblogic server provides enterprise-level security and administration tools for ease of managing the applications.

Oracle Database is a database management system widely used in enterprises for running OLTP, DW, and mixed database workloads. It’s a relational database management system that provides an open, comprehensive, and integrated approach to information management.

Tighter integrations between Weblogic and Oracle database provides a strong infrastructure to develop and test applications with improved availability, better resource sharing, ease of configuration, and automated management facilities. As Weblogic and Oracle database are now running in containers, developers and enterprises can take advantage of Docker’s benefits of container isolation, portability, ability to automate development, and testing of these applications.

MedRec (Avitek Medical Records Application) is an end-to-end sample Java EE application shipped with WebLogic Server; it simulates an independent, centralized medical record management system. The MedRec application provides a framework for patients, doctors, and administrators to manage patient data using a variety of different clients. MedRec demonstrates WebLogic Server and Java EE features, and it highlights Oracle-recommended best practices. MedRec is installed in the WebLogic Server distribution. It has been used as a reliable and realistic application performance benchmark for over 10 years.

Oracle WLS and Oracle Database are certified to run on Docker containers, and images are available in the Docker Store.

Architecture

The following diagram represents the Oracle Weblogic, Oracle Database, and MedRec application architecture on Docker Enterprise Edition:

Oracle Architecture

Test Environment and Components

You need the following components to follow the architecture described in this guide:

Installation and Configuration (Docker for Mac)

  1. Install the Git utility if not already installed. In a terminal window, navigate to the folder you would like to place the repository (or create a new one), then run the command:

    $ git clone https://github.com/docker/docker-for-oracle-weblogic
    
  2. Download the Oracle WebLogic Server 12.2.1.2 Supplemental Quick Installer (fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip), and place the zip file (without extracting it) into current folder.

  3. Download the Oracle SQL Developer command-line (SQLcl) tool (sqlcl-17.4.0.354.2224-no-jre.zip), and place the zip file (without extracting it!) into current folder.

  4. The Dockerfile uses the Weblogic and Database images from Docker Store. No modifications are necessary.

  5. (Optional) If there are changes to DB username/password, edit the docker-for-oracle-weblogic/container-scripts/oradatasource.properties file, and set the Oracle Thin XA driver, the Database URL, username, password, and DB container name to connect to the Oracle Database container.

    domainname=medrec
    domainhome=/u01/oracle/wlserver/samples/domains/medrec
    admin_name=MedRecServer
    dsname=MedRecGlobalDataSourceXA
    dsdbname=ORCLCDB
    dsjndiname=jdbc/MedRecGlobalDataSourceXA
    dsdriver=oracle.jdbc.xa.client.OracleXADataSource
    dsurl=jdbc:oracle:thin:@orcldb:1521:ORCLCDB
    dsusername=sys as sysdba
    dspassword=Ora_docdb1
    dstestquery=SELECT * FROM DUAL
    dsmaxcapacity=1
    

Create and Run the MedRec Docker Container

  1. Open a browser, and log into the Docker Store.

  2. Subscribe to both Oracle WebLogic Server and Oracle Database Enterprise Edition by clicking on Proceed to Checkout. These images are free for developers.

  3. Back on the command line, make sure you have logged into Docker Store/Hub:

    $ docker login
    
  4. Build and run the MedRec and Database containers:

    $ ./build.sh
    $ docker-compose up -d
    
  5. Startup progress can be monitored by viewing the logs. It may take 5 or 6 minutes for the application to be ready to test:

    $ docker ps
    ...
    $ docker logs -f <container-id>
    
  6. Verify access to the WebLogic Console:

    http://localhost:7011/console
    

    Oracle WebLogic Console Login

  7. Log in with the credentials weblogic/welcome1:

    Oracle WebLogic Console

Test the MedRec Application

Access the MedRec application at:

http://localhost:7011/medrec

MedRec Font Page

Stopping the Application (Docker for Mac)

To stop the application containers, execute:

$ docker-compose down
Stopping wls-medrec ... done
Stopping orcldb     ... done
Removing wls-medrec ... done
Removing orcldb     ... done

Configuration and Deployment (Docker Enterprise Edition)

This section shows how to deploy a 4-node (non-HA) Oracle WebLogic stack using Docker Enterprise Edition (Docker swarm) on Oracle Cloud Infrastructure (OCI). Instructions for AWS are also included.

Note: A High Availability configuration should be used in a production environment.

Docker EE Swarm Configuration

Note: A label has been added to the node in this digram to identify the Oracle Database node. Proper functioning of the database requires 2-4 CPUs, 8-16GB memory, and 12-16GB local storage.

An example docker-compose.yaml is provided below which brings up the WebLogic console and launches the MedRec application. Details can be found at MedRec applications on Weblogic with Oracle Database.

Before proceeding with thedocker-composedeployment, move the1221-oradb-medrecimage to a repository on Docker Hub or an internally accessible Docker Trusted Registry usingdocker taganddocker pushcommands. The address of the registry will be entered into thedocker-compose.yamlat{dtr-registry-address}`.

Copy the docker-compose.yml below into a text or code editor.

version: '3.2'

services:
  wls:
    image: <dtr-registry-address>/1221-oradb-medrec:1.0
    ports:
      - 7011:7011
    depends_on:
       - orcldb

  orcldb:
    image: store/oracle/database-enterprise:12.2.0.1
    ports:
      - 1521:1521
      - 5500:5500
    deploy:
      placement:
        constraints:
         - node.labels.db == oracle

Define the Persistent Volumes

To deploy Weblogic and Oracle database on local volumes, proceed to Verifying the Install. The local volumes will not persist if the service is removed or fails.

To setup persistent volumes, subscribe to an appropriate volume plugin from the Docker Certified Plugin list at store.docker.com. This example uses EMC’s Rex-Ray for AWS EBS.

To use AWS EBS, obtain an access ID and secret key from AWS IAM service by following the directions on docs.aws.amazon.com.

Install the plugin with the following commands using the EBS_ACCESSKEY obtained in the previous step:

docker plugin install rexray/ebs EBS_ACCESSKEY=<mykey> EBS_SECRETKEY=<mysecretkey>

This table shows the services needed to define the persistent volume:

Volume Name Service Container Mount point
db-oracle1 orcldb /ORCL

Within UCP, click on the Volumes selection that appears in the left-hand side bar. Click on Create Volumes, and enter the information in the previous table:

Name: db-oracle1
Driver: rexray/ebs

In the text or code editor, add the following lines to the docker-compose.yml:

    volumes:
      - db-oracle1:/ORCL

volumes:
  db-oracle1:
    driver: rexray/ebs

Change the {dtr-registry-address} fields for the installation of DTR or Docker Hub.

Copy the entire contents into the clipboard. Be sure to preserve indentation layout.

Verifying the Deployment (Docker EE) via UCP UI Swarm

  1. In a browser, log into the UCP management node as admin.

  2. Within UCP, click on the Stacks selection that appears in the left sidebar.

  3. Click on Create Stack. Provide a name for the Stack (Ex. demo) and Mode (Choose Swarm Services).

  4. Paste in the edited docker-compose-EE.yml commands from the clipboard.

  5. Finally, click on the Create button to deploy the stack.

    UCP Deploy

  6. To verify that the containers launched successfully, click on Services in the left sidebar on the UCP home screen. The 2 services demo_wls and demo_orcldb should show with green status and no errors.

    UCP-Swarm-Services

  7. To bring up the application, click on Services in the Swarm section in the left sidebar.

  8. Choose demo-wls in the list of load balancers.

  9. Choose the address Published Endpoints to bring up the Oracle Weblogic and Medrec screen.

  10. Add /console/ to the URL in the browser to bring up the WebLogic screen, and add /medrec/ to the URL in the browser to bring up the Medrec application.

    UCP-SwarmVerify

Verifying the Deployment (Docker EE) via Client Bundle

To launch and verify the installation, download client bundle from the UCP UI (admin -> My Profile -> New Client Bundle). Navigate to the directory, and unzip ucp-bundle-admin.zip. Copy docker-compose-EE.yml to this directory, and execute the following commands:

Note: If pulling image from Docker Store, add the --with-registry-auth option to docker stack deploy.

source env.sh
docker stack deploy -c docker-compose-EE.yml <stack name>

Example Output:

$ source env.sh
$ docker stack deploy --compose-file docker-compose-EE.yml demo
...
Creating network demo_default
Creating service demo_orcldb
Creating service demo_wls

Troubleshooting

Most Docker-related monitoring and troubleshooting can be accomplished by viewing the logs for service or by going to the specific node and searching for the container ID:

For a service, first, find the service ID:

docker service ls

Then, view the logs for that service ID:

docker service logs <service ID>

For a container, find the container ID:

docker ps

Then view the logs for that container:

docker logs <container ID>

Further Reading

Use the following links to learn more about Oracle Weblogic and other Oracle images for Docker:

Additional Application Guides and Solution Briefs

Docker provides additional application guides on success.docker.com as well as Solution Briefs about related information.