Skip to content

Commit

Permalink
WebLogic 12.2.1.3 image and sample 12213 domain (#576)
Browse files Browse the repository at this point in the history
* Create sample for the creation of a 12.2.1.3 domain
* PS3 install image
  • Loading branch information
mriccell authored and Djelibeybi committed Sep 20, 2017
1 parent 38f0052 commit 5f8d982
Show file tree
Hide file tree
Showing 24 changed files with 1,093 additions and 0 deletions.
6 changes: 6 additions & 0 deletions OracleWebLogic/dockerfiles/12.2.1.3/Checksum.developer
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Download WebLogic Server Quick Installer 12.2.1.3
#
# - http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
a5d4811b431b2166e3e16c20c36ede09 fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip

6 changes: 6 additions & 0 deletions OracleWebLogic/dockerfiles/12.2.1.3/Checksum.generic
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Download WebLogic Server Generic Installer 12.2.1.3
#
# - http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
ea1b961b8896ac2f4006921965e41ddf fmw_12.2.1.3.0_wls_Disk1_1of1.zip

88 changes: 88 additions & 0 deletions OracleWebLogic/dockerfiles/12.2.1.3/Dockerfile.developer
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for WebLogic 12.2.1.3 Quick Install Distro
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip
# Download the Developer Quick installer from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
# (2) server-jre-8uXX-linux-x64.tar.gz
# Download from http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-downloads-2133154.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ docker build -t oracle/weblogic:12.2.1.3-developer .
#
# IMPORTANT
# ---------
# The resulting image of this Dockerfile contains a WLS Empty Domain.
#
# Pull base image
# From the Oracle Registry
# -------------------------
FROM oracle/serverjre:8

# Maintainer
# ----------
MAINTAINER Monica Riccelli <monica.riccelli@oracle.com>

# Common environment variables required for this build (do NOT change)
# --------------------------------------------------------------------
ENV ORACLE_HOME=/u01/oracle \
USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" \
SCRIPT_FILE=/u01/oracle/createAndStartEmptyDomain.sh \
PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin

# Setup filesystem and oracle user
# Adjust file permissions, go to /u01 as user 'oracle' to proceed with WLS installation
# ------------------------------------------------------------
RUN mkdir -p /u01 && \
chmod a+xr /u01 && \
useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle

# Copy scripts
#-------------
COPY container-scripts/createAndStartEmptyDomain.sh container-scripts/create-wls-domain.py /u01/oracle/

# Domain and Server environment variables
# ------------------------------------------------------------
ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}" \
DOMAIN_HOME=/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_domain} \
ADMIN_PORT="${ADMIN_PORT:-7001}" \
ADMIN_USERNAME="${ADMIN_USERNAME:-weblogic}" \
ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \
ADMIN_PASSWORD="${ADMIN_PASSWORD:-""}" \
DEBUG_FLAG=true \
PRODUCTION_MODE=dev



# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_PKG=fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip \
FMW_JAR=fmw_12.2.1.3.0_wls_quick.jar

# Copy packages
# -------------
COPY $FMW_PKG install.file oraInst.loc /u01/
RUN chown oracle:oracle -R /u01 && \
chmod +xr $SCRIPT_FILE

# Install
# ------------------------------------------------------------
USER oracle
RUN cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
$JAVA_HOME/bin/java -jar /u01/$FMW_JAR -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=$ORACLE_HOME && \
rm /u01/$FMW_JAR /u01/$FMW_PKG /u01/oraInst.loc /u01/install.file

WORKDIR ${ORACLE_HOME}

# Define default command to start script.
CMD ["/u01/oracle/createAndStartEmptyDomain.sh"]
87 changes: 87 additions & 0 deletions OracleWebLogic/dockerfiles/12.2.1.3/Dockerfile.generic
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle WebLogic Server 12.2.1.3 Generic Distro
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.2.1.3.0_wls_Disk1_1of1.zip
# Download the Generic installer from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
# (2) server-jre-8uXX-linux-x64.tar.gz
# Download from http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-downloads-2133154.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ docker build -f Dockerfile.generic -t oracle/weblogic:12.2.1.3-generic .
#
# IMPORTANT
# ---------
# The resulting image of this Dockerfile contains a WLS Empty Domain.
#
# Pull base image
# From the Oracle Registry
# -------------------------
FROM oracle/serverjre:8

# Maintainer
# ----------
MAINTAINER Monica Riccelli <monica.riccelli@oracle.com>

# Common environment variables required for this build (do NOT change)
# --------------------------------------------------------------------
ENV ORACLE_HOME=/u01/oracle \
USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" \
SCRIPT_FILE=/u01/oracle/createAndStartEmptyDomain.sh \
PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin

# Setup filesystem and oracle user
# Adjust file permissions, go to /u01 as user 'oracle' to proceed with WLS installation
# ------------------------------------------------------------
RUN mkdir -p /u01 && \
chmod a+xr /u01 && \
useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle

# Copy scripts
#-------------
COPY container-scripts/createAndStartEmptyDomain.sh container-scripts/create-wls-domain.py /u01/oracle/

# Domain and Server environment variables
# ------------------------------------------------------------
ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}" \
DOMAIN_HOME=/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_domain} \
ADMIN_PORT="${ADMIN_PORT:-7001}" \
ADMIN_USERNAME="${ADMIN_USERNAME:-weblogic}" \
ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \
ADMIN_PASSWORD="${ADMIN_PASSWORD:-""}"


# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_PKG=fmw_12.2.1.3.0_wls_Disk1_1of1.zip \
FMW_JAR=fmw_12.2.1.3.0_wls.jar

# Copy packages
# -------------
COPY $FMW_PKG install.file oraInst.loc /u01/
RUN chown oracle:oracle -R /u01 && \
chmod +xr $SCRIPT_FILE

# Install
# ------------------------------------------------------------
USER oracle

RUN cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
ls /u01 && \
$JAVA_HOME/bin/java -jar /u01/$FMW_JAR -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=$ORACLE_HOME INSTALL_TYPE="WebLogic Server" && \
rm /u01/$FMW_JAR /u01/$FMW_PKG /u01/oraInst.loc /u01/install.file

WORKDIR ${ORACLE_HOME}

# Define default command to start script.
CMD ["/u01/oracle/createAndStartEmptyDomain.sh"]
117 changes: 117 additions & 0 deletions OracleWebLogic/dockerfiles/12.2.1.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
Oracle WebLogic Server on Docker
=================================
These Docker configurations have been used to create the Oracle WebLogic Server image. Providing this WLS image facilitates the configuration, and environment setup for DevOps users. This project includes the installation and the creation of an empty WebLogic Server domain (only an Admin Server). These Oracle WebLogic Server 12.2.1.3 images are based on Oracle Linux and Oracle JRE 8 (Server).

The certification of Oracle WebLogic Server on Docker does not require the use of any file presented in this repository. Customers and users are welcome to use them as starters, and customize/tweak, or create from scratch new scripts and Dockerfiles.

For more information on the certification, please check the [Oracle WebLogic Server on Docker Certification Whitepaper](http://www.oracle.com/technetwork/middleware/weblogic/overview/weblogic-server-docker-containers-2491959.pdf) and [WebLogic Server Blog](https://blogs.oracle.com/WebLogicServer/) for updates.

## How to build and run
This project offers sample Dockerfiles for Oracle WebLogic Server 12cR2 (12.2.1.3), and it provides at least one Dockerfile for the 'developer' distribution, a second Dockerfile for the 'generic' distribution, and a third Dockerfile for the 'infrastructure' distribution. To assist in building the images, you can use the [buildDockerImage.sh](dockerfiles/buildDockerImage.sh) script. See below for instructions and usage.

The `buildDockerImage.sh` script is just a utility shell script that performs MD5 checks and is an easy way for beginners to get started. Expert users are welcome to directly call `docker build` with their prefered set of parameters.


### Building Oracle WebLogic Server Docker Install Images
**IMPORTANT:** you have to download the binary of Oracle WebLogic Server and put it in place (see `.download` files inside dockerfiles/<version>). The WebLogic image extends the Oracle JRE Server 8 image, you must either build the image by using the Dockerfile in [../../../OracleJava/java8](https://github.com/oracle/docker-images/tree/master/OracleJava/java-8) or pull the latest image from the [Oracle Cointainer Registry](https://container-registry.oracle.com) or the [Docker Store](https://store.docker.com).

Before you build, choose which version and distribution you want to build an image,then download the required packages (see .download files) and drop them in the folder of your distribution version of choice. Then go into the **dockerfiles** folder and run the **buildDockerImage.sh** script as root.

$ sh buildDockerImage.sh
Usage: buildDockerImage.sh -v [version] [-d | -g | -i] [-s]
Builds a Docker Image for Oracle WebLogic Server.
Parameters:
-v: version to build. Required.
Choose : 12.2.1.3
-d: creates image based on 'developer' distribution
-g: creates image based on 'generic' distribution
-i: creates image based on 'infrastructure' distribution
-c: enables Docker image layer cache during build
-s: skips the MD5 check of packages
* select one distribution only: -d, -g, or -i
LICENSE CDDL 1.0 + GPL 2.0
Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.

**IMPORTANT:** the resulting images will have an empty domain (only Admin Server) by default. You must extend the image with your own Dockerfile, and create your domain using WLST. You might take a look at the use case samples.

## Samples for Oracle WebLogic Server Domain Creation
To give users an idea on how to create a domain from a custom Dockerfile to extend the WebLogic Server image, we provide a few samples for 12c versions for the Developer distribution. For an example we provide samples to create a **12.2.1.3 medrec** domain.

### Sample Installation and Base Domain for Oracle WebLogic Server 12.2.1.3
The image **oracle/weblogic:12.2.1.3-developer** will configure a **base_domain** with the following settings:

* Admin Username: `weblogic`
* Admin Password: `Auto generated`
* Oracle Linux Username: `oracle`
* Oracle Linux Password: `welcome1`
* WebLogic Server Domain Name: `base_domain`
* Admin Server on port: `7001`
* Production Mode: `developer`

**IMPORTANT:** If you intend to run these images in production you must change the Production Mode to production.


###Admin Password

On the first startup of the container a random password will be generated for the Administration of the domain. You can find this password in the output line:

`Oracle WebLogic Server auto generated Admin password:`

If you need to find the password at a later time, grep for "password" in the Docker logs generated during the startup of the container. To look at the Docker Container logs run:

$ docker logs --details <Container-id>

### Write your own Oracle WebLogic Server domain with WLST
The best way to create your own, or extend domains is by using [WebLogic Scripting Tool](https://docs.oracle.com/middleware/1221/cross/wlsttasks.htm). You can find an example of a WLST script to create domains at [create-wls-domain.py](dockerfiles/12.2.1.3/container-scripts/create-wls-domain.py). You may want to tune this script with your own setup to create DataSources and Connection pools, Security Realms, deploy artifacts, and so on. You can also extend images and override an existing domain, or create a new one with WLST.

## Building the Oracle WebLogic Server Docker Image
To try a sample of a WebLogic Server image with a base domain configured, follow the steps below:

1. Build the **12.2.1.3** image, go into **dockerfiles** and call

$ sh buildDockerImage.sh -v 12.2.1.3-d

2. Verify you now have this image in place with

$ docker images

3. Start a container from the image created in step 1:
You can override the default values of the following parameters during runtime with the -e option:
* ADMIN_NAME (default: AdminServer)
* ADMIN_PORT (default: 7001)
* ADMIN_USERNAME (default: weblogic)
* ADMIN_PASSWORD (default: Auto Generated)
* DOMAIN_NAME (default: base_domain)
* DOMAIN_HOME (default: /u01/oracle/user_projects/domains/base_domain)

**NOTE** To set the DOMAIN_NAME, you must set both DOMAIN_NAME and DOMAIN_HOME.

$ docker run -d -e ADMIN_USERNAME=weblogic -e ADMIN_PASSWORD=welcome1 -e DOMAIN_HOME=/u01/oracle/user_projects/domains/abc_domain -e DOMAIN_NAME=abc_domain oracle/weblogic:12.2.1.3-developer

4. Run the administration console

$ docker inspect --format '{{.NewworkSettings.IPAddress}}' <container-name>
This returns the IPAddress (example xxx.xx.x.x) of the container. Got to your browser and enter http://xxx.xx.x.x:8001/console

## Choose your Oracle WebLogic Server Distribution
This project hosts two to three configurations (depending on Oracle WebLogic Server version) for building Docker images with WebLogic Server 12c.

* Quick Install Developer Distribution

- For more information on the Oracle WebLogic Server 12cR2 Quick Install Developer Distribution, visit [WLS Quick Install Distribution for Oracle WebLogic Server 12.2.1.3.0](http://download.oracle.com/otn/nt/middleware/12c/wls/12213/README.txt).

* Generic Distribution

- For more information on the Oracle WebLogic Server 12cR2 Generic Full Distribution, visit [WebLogic Server 12.2.1.3 Documentation](http://docs.oracle.com/middleware/12213/wls/index.html).

* Fusion Middleware Infrastructure Distribution

- For more information on the Oracle WebLogic Server 12cR2 Infrastructure Full Distribution, visit [WebLogic Server 12.2.1.3 Infrastructure Documentation](https://docs.oracle.com/middleware/12213/core/INFIN/).

## Copyright
Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
# WebLogic on Docker Default Domain
#
# Domain, as defined in DOMAIN_NAME, will be created in this script. Name defaults to 'base_domain'.
#
# Since : October, 2014
# Author: bruno.borges@oracle.com
# ==============================================
domain_name = os.environ.get("DOMAIN_NAME", "base_domain")
admin_name = os.environ.get("ADMIN_NAME", "AdminServer")
admin_username = os.environ.get("ADMIN_USERNAME", "weblogic")
admin_pass = "ADMIN_PASSWORD"
admin_port = int(os.environ.get("ADMIN_PORT", "7001"))
domain_path = '/u01/oracle/user_projects/domains/%s' % domain_name
production_mode = os.environ.get("PRODUCTION_MODE", "prod")

print('domain_name : [%s]' % domain_name);
print('admin_port : [%s]' % admin_port);
print('domain_path : [%s]' % domain_path);
print('production_mode : [%s]' % production_mode);
print('admin password : [%s]' % admin_pass);
print('admin name : [%s]' % admin_name);
print('admin username : [%s]' % admin_username);

# Open default domain template
# ======================
readTemplate("/u01/oracle/wlserver/common/templates/wls/wls.jar")

set('Name', domain_name)
setOption('DomainName', domain_name)

# Disable Admin Console
# --------------------
# cmo.setConsoleEnabled(false)

# Configure the Administration Server and SSL port.
# =========================================================
cd('/Servers/AdminServer')
set('Name', admin_name)
set('ListenAddress', '')
set('ListenPort', admin_port)

# Define the user password for weblogic
# =====================================
cd('/Security/%s/User/weblogic' % domain_name)
cmo.setPassword(admin_pass)

# Write the domain and close the domain template
# ==============================================
setOption('OverwriteDomain', 'true')
setOption('ServerStartMode',production_mode)

cd('/NMProperties')
set('ListenAddress','')
set('ListenPort',5556)
set('CrashRecoveryEnabled', 'true')
set('NativeVersionEnabled', 'true')
set('StartScriptEnabled', 'false')
set('SecureListener', 'false')
set('LogLevel', 'FINEST')

# Set the Node Manager user name and password (domain name will change after writeDomain)
cd('/SecurityConfiguration/base_domain')
set('NodeManagerUsername', admin_username)
set('NodeManagerPasswordEncrypted', admin_pass)

# Write Domain
# ============
writeDomain(domain_path)
closeTemplate()

# Exit WLST
# =========
exit()
Loading

0 comments on commit 5f8d982

Please sign in to comment.