Skip to content

Commit

Permalink
Create sample 12212-oradb-medrec for a WLS-DB running on containers d…
Browse files Browse the repository at this point in the history
…eploying medrec. Correct 12212-medrec Dockerfile. In 1221-appdeploy allow for Admin Server name to be set as an env var.
  • Loading branch information
mriccell committed Apr 13, 2017
1 parent 1a3c660 commit 566e5cf
Show file tree
Hide file tree
Showing 12 changed files with 687 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# Deployment Information
domainhome = os.environ.get('DOMAIN_HOME', '/u01/oracle/user_projects/domains/base_domain')
admin_name = os.environ.get('ADMIN_NAME', 'AdminServer')
appname = os.environ.get('APP_NAME', 'sample')
apppkg = os.environ.get('APP_PKG_FILE', 'sample.war')
appdir = os.environ.get('APP_PKG_LOCATION', '/u01/oracle')
Expand All @@ -28,7 +29,7 @@

# Assign application to AdminServer
# =================================
assign('AppDeployment', appname, 'Target', 'AdminServer')
assign('AppDeployment', appname, 'Target', admin_name)
assign('AppDeployment', appname, 'Target', cluster_name)

# Update Domain, Close It, Exit
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dsname=DockerDS
dsdbname=default;create=true
dsjndiname=jdbc/DockerDS
dsdriver=org.apache.derby.jdbc.ClientDataSource
dsurl=jdbc:derby://localhost:1527/default;ServerName=localhost;databaseName=default;create=true
dsusername=
dspassword=
dstestquery=SQL SELECT 1 FROM SYS.SYSTABLES
dsmaxcapacity=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dsname=DockerDS2
dsdbname=default;create=true
dsjndiname=jdbc/DockerDS2
dsdriver=oracle.jdbc.OracleDriver
dsurl=jdbc:oracle:thin:@//xxx.xxx.x.xxx:1521/ORCLCDB
dsusername=system
dspassword=LetsDocker
dstestquery=SQL ISVALID
dsmaxcapacity=1
114 changes: 60 additions & 54 deletions OracleWebLogic/samples/12212-medrec/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
# LICENSE CDDL 1.0 + GPL 2.0
#
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by installing the Supplemental package of WebLogic which
# includes extra samples of Java EE, Coherence applications, and Multitenant domains.
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip
# Download the Developer Quick installer from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ sudo docker build -t 12212-medrec .
#

# Pull base image
# ---------------
FROM oracle/weblogic:12.2.1.2-developer

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

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_PKG="fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip" \
FMW_JAR="fmw_12.2.1.2.0_wls_supplemental_quick.jar" \
MW_HOME="$ORACLE_HOME" \
PATH="$ORACLE_HOME/wlserver/server/bin:$ORACLE_HOME/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:$JAVA_HOME/jre/bin:$JAVA_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$ORACLE_HOME/oracle_common/common/bin:$ORACLE_HOME/wlserver/common/bin:$ORACLE_HOME/user_projects/domains/medrec/bin:$ORACLE_HOME/wlserver/samples/server/medrec/:$ORACLE_HOME/wlserver/samples/server/:$ORACLE_HOME/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin"

# Copy supplemental package and scripts
# --------------------------------
COPY $FMW_PKG startSample.sh /u01/

# Installation of Supplemental Quick Installer
# --------------------------------------------
RUN cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
chown oracle:oracle -R /u01 && \
echo oracle:oracle | chpasswd && \
su -c "$JAVA_HOME/bin/java -jar /u01/$FMW_JAR ORACLE_HOME=$ORACLE_HOME" - oracle && \
mv /u01/startSample.sh /u01/oracle/wlserver/samples/server/ && \
rm /u01/$FMW_PKG /u01/$FMW_JAR

WORKDIR $ORACLE_HOME/wlserver/samples/server

EXPOSE 7011

CMD ["startSample.sh"]
# LICENSE CDDL 1.0 + GPL 2.0
#
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by installing the Supplemental package of WebLogic which
# includes extra samples of Java EE, Coherence applications, and Multitenant domains.
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip
# Download the Developer Quick installer from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ sudo docker build -t 12212-medrec .
#

# Pull base image
# ---------------
FROM oracle/weblogic:12.2.1.2-developer

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

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_PKG="fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip" \
FMW_JAR="fmw_12.2.1.2.0_wls_supplemental_quick.jar" \
MW_HOME="$ORACLE_HOME" \
PATH="$ORACLE_HOME/wlserver/server/bin:$ORACLE_HOME/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:$JAVA_HOME/jre/bin:$JAVA_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$ORACLE_HOME/oracle_common/common/bin:$ORACLE_HOME/wlserver/common/bin:$ORACLE_HOME/user_projects/domains/medrec/bin:$ORACLE_HOME/wlserver/samples/server/medrec/:$ORACLE_HOME/wlserver/samples/server/:$ORACLE_HOME/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin"

# Copy supplemental package and scripts
# --------------------------------
COPY $FMW_PKG /u01/
USER root
COPY startSample.sh /u01/oracle/
RUN chmod +xr /u01/oracle/startSample.sh

# Installation of Supplemental Quick Installer
# --------------------------------------------
USER oracle
RUN cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
$JAVA_HOME/bin/java -jar /u01/$FMW_JAR ORACLE_HOME=$ORACLE_HOME && \
echo $USER && \
mv /u01/oracle/startSample.sh /u01/oracle/wlserver/samples/server/ && \
rm /u01/$FMW_PKG /u01/$FMW_JAR

USER root
RUN chmod +xr /u01/oracle/wlserver/samples/server/*.sh

WORKDIR $ORACLE_HOME/wlserver/samples/server

EXPOSE 7011

CMD ["startSample.sh"]
60 changes: 60 additions & 0 deletions OracleWebLogic/samples/12212-oradb-medrec/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# LICENSE CDDL 1.0 + GPL 2.0
#
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by installing the Supplemental package of WebLogic which
# includes extra samples of Java EE, Coherence applications, and Multitenant domains.
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip
# Download the Developer Quick installer from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ sudo docker build -t 12212-medrec .
#

# Pull base image
# ---------------
FROM oracle/weblogic:12.2.1.2-developer

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

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_PKG="fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip" \
FMW_JAR="fmw_12.2.1.2.0_wls_supplemental_quick.jar" \
MW_HOME="$ORACLE_HOME" \
PATH="$ORACLE_HOME/wlserver/server/bin:$ORACLE_HOME/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:$JAVA_HOME/jre/bin:$JAVA_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$ORACLE_HOME/oracle_common/common/bin:$ORACLE_HOME/wlserver/common/bin:$ORACLE_HOME/user_projects/domains/medrec/bin:$ORACLE_HOME/wlserver/samples/server/medrec/:$ORACLE_HOME/wlserver/samples/server/:$ORACLE_HOME/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin"

# Copy supplemental package and scripts
# --------------------------------
COPY $FMW_PKG /u01/
USER root
COPY container-scripts/* /u01/oracle/
RUN chmod +xr /u01/oracle/startSample.sh

# Installation of Supplemental Quick Installer
# --------------------------------------------
USER oracle
RUN cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
$JAVA_HOME/bin/java -jar /u01/$FMW_JAR ORACLE_HOME=$ORACLE_HOME && \
echo $USER && \
mv /u01/oracle/startSample.sh /u01/oracle/wlserver/samples/server/ && \
rm /u01/$FMW_PKG /u01/$FMW_JAR

USER root
RUN chmod +xr /u01/oracle/wlserver/samples/server/*.sh

WORKDIR $ORACLE_HOME/wlserver/samples/server

EXPOSE 7011

CMD ["startSample.sh"]
25 changes: 25 additions & 0 deletions OracleWebLogic/samples/12212-oradb-medrec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Example of Image with WLS Domain
================================
This Dockerfile extends the Oracle WebLogic image by installing the Supplemental package of WebLogic which includes the MedRec WLS sample.

# How to build and run
First make sure you have built **oracle/weblogic:12.2.1.2-developer**.

Then download file [fmw_12.2.1.2.0_wls_supplemental_quick_Disk1_1of1.zip](http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html) and place it next to this README.

To build, run:

$ docker build -t 12212-oradb-medrec .

To start the Admin Server, run:

$ docker run -d -p 7011:7011 12212-oradb-medrec

This sample uses an Oracle DB running in a Docker container. Before running the WebLogic oradb-medrec container run the DB container. The DB instance needs to have the tables created and populated by using the demo_oracle.ddl.

When you run the container a MedRec domain is created and the server started. To access the MedRec application, go to:

http://localhost:7011/medrec

# Copyright
Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
2 changes: 2 additions & 0 deletions OracleWebLogic/samples/12212-oradb-medrec/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t 1221-oradb-medrec .
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
#
# WLST Offline for deploying an application under APP_NAME packaged in APP_PKG_FILE located in APP_PKG_LOCATION
# It will read the domain under DOMAIN_HOME by default
#
# author: Bruno Borges <bruno.borges@oracle.com>
# since: December, 2015
#
import os

# Deployment Information
#domainname = os.environ.get('DOMAIN_NAME', 'base_domain')
#domainhome = os.environ.get('DOMAIN_HOME', '/u01/oracle/user_projects/domains/' + domainname)
#cluster_name = os.environ.get("CLUSTER_NAME", "DockerCluster")
#admin_name = os.environ.get("ADMIN_NAME", "AdminServer")

# Read Domain in Offline Mode
# ===========================
readDomain(domainhome)

# Create Datasource
# ==================
#create(dsname, 'JDBCSystemResource')
cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
cmo.setName(dsname)

#cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
#create('myJdbcDataSourceParams','JDBCDataSourceParams')
#cd('JDBCDataSourceParams/NO_NAME_0')
#set('JNDIName', java.lang.String(dsjndiname))
#set('GlobalTransactionsProtocol', java.lang.String('None'))

cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName', dsdriver)
set('URL', dsurl)
set('PasswordEncrypted', dspassword)
set('UseXADataSourceInterface', 'false')

print 'create JDBCDriverParams User Properties'
#create('myProperties','Properties')
cd('Properties/NO_NAME_0')
#create('user','Property')
cd('Property/user')
set('Value', dsusername)

print 'create Test Table Name JDBCConnectionPoolParams'
cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
#create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SQL SELECT 1 FROM DUAL')

# Assign
# ======
assign('JDBCSystemResource', dsname, 'Target', admin_name)

# Update Domain, Close It, Exit
# ==========================
updateDomain()
closeDomain()
exit()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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:@//xxx.xxx.x.xxx:1521/ORCLCDB
dsusername=system
dspassword=LetsDocker
dstestquery=SELECT * FROM DUAL
dsmaxcapacity=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
#
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
#

# Define default command to create medrec domain
USERNAME=${USERNAME:-weblogic}
PASSWORD=${PASSWORD:-welcome1}
${ORACLE_HOME}/wlserver/samples/server/run_samples.sh "${USERNAME}" "${PASSWORD}"
wlst.sh -loadProperties /u01/oracle/oradatasource.properties /u01/oracle/medrec-ds-deploy.py

${ORACLE_HOME}/wlserver/samples/domains/medrec/startWebLogic.sh

#touch ${ORACLE_HOME}/wlserver/samples/domains/medrec/servers/MedRecServer/logs/MedRecServer.log
#tail -f ${ORACLE_HOME}/wlserver/samples/domains/medrec/servers/MedRecServer/logs/MedRecServer.log &

#childPID=$!
#wait $childPID

#cd ${ORACLE_HOME}/wlserver/samples/server/medrec
#ant -Ddb=oracle db.migrate

#${ORACLE_HOME}/wlserver/samples/domains/medrec/bin/stopWebLogic.sh
#wait 60
#${ORACLE_HOME}/wlserver/samples/domains/medrec/startWebLogic.sh
Loading

0 comments on commit 566e5cf

Please sign in to comment.