diff --git a/smp-docker/images/build-docker-images.sh b/smp-docker/images/build-docker-images.sh new file mode 100755 index 0000000000000000000000000000000000000000..6b9e175db1b1bf879a110bd97018e3291af2cce8 --- /dev/null +++ b/smp-docker/images/build-docker-images.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +# Script builds docker images for SMP oracle/weblogic environment. Docker images for database and weblogic are from +# https://github.com/oracle/docker-images + +# Prerequisites: +# 1. From oracle download: +# - OracleDB: oracle-xe-11.2.0-1.0.x86_64.rpm.zip +# - Server JDK 1.8: server-jre-8u211-linux-x64.tar.gz (https://github.com/oracle/docker-images/tree/master/OracleJava) +# - weblogic 12.2.1.3: fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip +# and put them to folder ${ORACLE_ARTEFACTS} +# +# 2. build SMP mvn clean install +# 3. run the scripts with arguments +# build-docker-images.sh -f build-docker-images.sh -f ${oracle_artefact_folder} + +DIRNAME=`dirname "$0"` +cd "$DIRNAME" +DIRNAME="$(pwd -P)" + +ORACLE_DB_FILE="oracle-xe-11.2.0-1.0.x86_64.rpm.zip" +SERVER_JDK_FILE="server-jre-8u211-linux-x64.tar.gz" +WEBLOGIC_122_QUICK_FILE="fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip" +SMP_VERSION= +ORACLE_ARTEFACTS="/CEF/oracle-install" + +SMP_ARTEFACTS="../../smp-webapp/target/" +SMP_ARTEFACTS_CLEAR="false" + + +# READ argumnets +while getopts v:o:s:c: option +do + case "${option}" + in + v) SMP_VERSION=${OPTARG};; + o) ORACLE_ARTEFACTS=${OPTARG};; + s) SMP_ARTEFACTS=${OPTARG};; + c) SMP_ARTEFACTS_CLEAR=${OPTARG};; + esac +done + +if [ -z "${SML_VERSION}" ] +then + # get version from setup file + cd "${SMP_ARTEFACTS}" + SMP_VERSION="$(ls smp-*-setup.zip | sed -e 's/.*smp-//g' | sed -e 's/-setup\.zip$//g')" + # go back to dirname + cd "$DIRNAME" +fi + + +echo "*****************************************************************" +echo "* SMP artefact folders: $SMP_ARTEFACTS, (Clear folder after build: $SMP_ARTEFACTS_CLEAR )" +echo "* Build SMP image for version $SMP_VERSION" +echo "* Oracle artefact folders: $ORACLE_ARTEFACTS" +echo "*****************************************************************" +echo "" + + +# ----------------------------------------------------------------------------- +# validate all necessary artefacts and prepare files to build images +# ----------------------------------------------------------------------------- + validateAndPrepareArtefacts() { + + # check oracle database + if [ ! -f "${ORACLE_ARTEFACTS}/${ORACLE_DB_FILE}" ] + then + echo "Oracle database artefacts '${ORACLE_ARTEFACTS}/${ORACLE_DB_FILE}' not found." + exit 1; + else + # copy artefact to docker build folder + cp "${ORACLE_ARTEFACTS}/${ORACLE_DB_FILE}" ./oracle/oracle-db-11.2.0.2/ + fi + + # check server JDK + if [ ! -f "${ORACLE_ARTEFACTS}/${SERVER_JDK_FILE}" ] + then + echo "Server JDK artefacts '${ORACLE_ARTEFACTS}/${SERVER_JDK_FILE}' not found." + exit 1; + else + # copy artefact to docker build folder + cp "${ORACLE_ARTEFACTS}/${SERVER_JDK_FILE}" ./oracle/OracleJava/java-8/ + fi + + # check weblogic + if [ ! -f "${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}" ] + then + echo "Weblogic artefacts '${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}' not found." + exit 1; + else + # copy artefact to docker build folder + cp "${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}" ./oracle/weblogic-12.2.1.3/ + fi + + + if [ ! -d "./tomcat-mysql/artefacts/" ] + then + mkdir -p "./tomcat-mysql/artefacts/" + fi + + + # SMP artefats + if [ ! -f "${SMP_ARTEFACTS}/smp.war" ] + then + echo "SMP artefact '${SMP_ARTEFACTS}/smp.war' not found. Was project built!" + exit 1; + else + # copy artefact to docker build folder + # for weblogic + cp "${SMP_ARTEFACTS}/smp.war" ./weblogic-12.2.1.3-smp/smp.war + # for mysql tomcat + cp "${SMP_ARTEFACTS}/smp.war" ./tomcat-mysql/artefacts/smp.war + fi + + # SMP setup zip + if [ ! -f "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ] + then + echo "SMP setup boundle '${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip' not found. Was project built!" + exit 1; + else + # copy artefact to docker build folder + cp "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ./weblogic-12.2.1.3-smp/smp-setup.zip + cp "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ./tomcat-mysql/artefacts/smp-setup.zip + fi + + + +} + + +# ----------------------------------------------------------------------------- +# build docker images +# ----------------------------------------------------------------------------- + buildImages() { + + # ----------------------------------------------------------------------------- + # build docker image for oracle database + # ----------------------------------------------------------------------------- + # oracle 1.2.0.2-xe (https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles/11.2.0.2) + docker build -f ./oracle/oracle-db-11.2.0.2/Dockerfile.xe -t oracle/database:11.2.0.2-xe ./oracle/oracle-db-11.2.0.2/ + + # ----------------------------------------------------------------------------- + # build docker image for oracle database + # ----------------------------------------------------------------------------- + + # create docker OS image with java (https://github.com/oracle/docker-images/tree/master/OracleJava/java-8) + docker build -t oracle/serverjre:8 ./oracle/OracleJava/java-8/ + + # create weblogic basic (https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/12.2.1.3) + docker build -f ./oracle/weblogic-12.2.1.3/Dockerfile.developer -t oracle/weblogic:12.2.1.3-developer ./oracle/weblogic-12.2.1.3/ + + # create weblogic domain-home-in-image (https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image./) + ./oracle/weblogic-12213-domain-home-in-image/container-scripts/setEnv.sh ./oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain.properties + docker build $BUILD_ARG --force-rm=true -t oracle/12213-domain-home-in-image ./oracle/weblogic-12213-domain-home-in-image/ + + + # build SMP deployment. + docker build -t weblogic_smp ./weblogic-12.2.1.3-smp/ --build-arg SMP_VERSION="$SMP_VERSION" + + # build tomcat mysql image deployment. + docker build -t tomcat_mysql_smp ./tomcat-mysql/ + +} + +# ----------------------------------------------------------------------------- +# clean +# ----------------------------------------------------------------------------- + cleanArtefacts() { + rm "./oracle/oracle-db-11.2.0.2/${ORACLE_DB_FILE}" # clean + rm "./oracle/OracleJava/java-8/${SERVER_JDK_FILE}" # clean + rm "./oracle/weblogic-12.2.1.3/${WEBLOGIC_122_QUICK_FILE}" # clean + rm "./weblogic-12.2.1.3-smp/smp.war" + rm "./weblogic-12.2.1.3-smp/smp-setup.zip" + + # clear also the tomcat/mysql image + rm -rf "./tomcat-mysql/artefacts/*.*" + + if [ "V$SMP_ARTEFACTS_CLEAR" == "Vtrue" ] + then + rm -rf "${SMP_ARTEFACTS}/smp-setup.zip" + rm -rf "${SMP_ARTEFACTS}/smp.war" + fi + +} + + +validateAndPrepareArtefacts +buildImages +cleanArtefacts + diff --git a/smp-docker/images/oracle/OracleJava/README.md b/smp-docker/images/oracle/OracleJava/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ab30251ff6177902971ae89b82150622ab5f6aec --- /dev/null +++ b/smp-docker/images/oracle/OracleJava/README.md @@ -0,0 +1,23 @@ +Oracle Java on Docker +===== +This repository contains a sample Docker configuration to facilitate installation and environment setup for DevOps users. This project includes a Dockerfile for Server JRE 8 based on Oracle Linux. + +Oracle Java Server JRE provides the features from Oracle Java JDK commonly required for server-side applications (i.e. Running a Java EE application server). For more information about Server JRE, visit the [Understanding the Server JRE blog entry](https://blogs.oracle.com/java-platform-group/understanding-the-server-jre) from the Java Product Management team. + +## Building the Java 8 (Server JRE) base image +[Download Server JRE 8](http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-downloads-2133154.html) `.tar.gz` file and drop it inside the folder `../OracleJava/java-8`. + +Build it using: + +``` +$ cd ../OracleJava/java-8 +$ docker build -t oracle/serverjre:8 . +``` + +## License +To download and run the Oracle JDK, regardless of inside or outside a Docker container, you must download the binary from the Oracle website and accept the license indicated on that page. + +All scripts and files hosted in this project and GitHub [`docker/OracleJava`](./) repository, required to build the Docker images are, unless otherwise noted, released under the [UPL 1.0](https://oss.oracle.com/licenses/upl/) license. + +## Customer Support +We support JDK 8 (Server JRE) when running on certified operating systems in a Docker container. For additional details on the JDK 8 Certified System Configurations, please refer to the [Oracle Java SE Certified System Configuration Pages](https://www.oracle.com/technetwork/java/javaseproducts/documentation/index.html#sysconfig). diff --git a/smp-docker/images/oracle/OracleJava/java-8/Dockerfile b/smp-docker/images/oracle/OracleJava/java-8/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..86cf7676382265ade68770c9de4cd10ae59524fb --- /dev/null +++ b/smp-docker/images/oracle/OracleJava/java-8/Dockerfile @@ -0,0 +1,19 @@ +# LICENSE UPL 1.0 +# +# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +# +FROM oraclelinux:7-slim + +MAINTAINER Aurelio Garcia-Ribeyro <aurelio.garciaribeyro@oracle.com> + +ENV JAVA_PKG=server-jre-8u*-linux-x64.tar.gz \ + JAVA_HOME=/usr/java/default + +ADD $JAVA_PKG /usr/java/ + +RUN export JAVA_DIR=$(ls -1 -d /usr/java/*) && \ + ln -s $JAVA_DIR /usr/java/latest && \ + ln -s $JAVA_DIR /usr/java/default && \ + alternatives --install /usr/bin/java java $JAVA_DIR/bin/java 20000 && \ + alternatives --install /usr/bin/javac javac $JAVA_DIR/bin/javac 20000 && \ + alternatives --install /usr/bin/jar jar $JAVA_DIR/bin/jar 20000 diff --git a/smp-docker/images/oracle/OracleJava/java-8/build.sh b/smp-docker/images/oracle/OracleJava/java-8/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..5f9c79d9bbd846c2daf8fbe954a63b85ef18f340 --- /dev/null +++ b/smp-docker/images/oracle/OracleJava/java-8/build.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker build -t oracle/serverjre:8 . diff --git a/smp-docker/images/oracle/OracleJava/java-8/server-jre-8u211-linux-x64.tar.gz.download b/smp-docker/images/oracle/OracleJava/java-8/server-jre-8u211-linux-x64.tar.gz.download new file mode 100644 index 0000000000000000000000000000000000000000..b247a644fe533f0b8c54e30d86c02da4eddab575 --- /dev/null +++ b/smp-docker/images/oracle/OracleJava/java-8/server-jre-8u211-linux-x64.tar.gz.download @@ -0,0 +1,5 @@ +# Download the Server JRE (which includes necessary JDK bits for backend Java based solutions) +# +# - http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-downloads-2133154.html +# +97a5c3f10678d309a60ab0b17be0d637adb9fa4131050da0736bf2214d521d2d server-jre-8u211-linux-x64.tar.gz diff --git a/smp-docker/images/oracle/README.md b/smp-docker/images/oracle/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f40d7246456a7ed204a853ea6690a0867b839062 --- /dev/null +++ b/smp-docker/images/oracle/README.md @@ -0,0 +1,9 @@ +Folder contains oracle images needed to build database and weblogic from +[Oracle docker git](https://github.com/oracle/docker-images/). + +In order to build those images following files must be downloaded from Oracle page + - OracleDB: oracle-xe-11.2.0-1.0.x86_64.rpm.zip + - Server JDK 1.8: server-jre-8u211-linux-x64.tar.gz (https://github.com/oracle/docker-images/tree/master/OracleJava) + - weblogic 12.2.1.3: fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip + +For building docer images check readme files on [Oracle docker git](https://github.com/oracle/docker-images/). diff --git a/smp-docker/images/oracle/oracle-db-11.2.0.2/Checksum.xe b/smp-docker/images/oracle/oracle-db-11.2.0.2/Checksum.xe new file mode 100644 index 0000000000000000000000000000000000000000..23a52ea90392bc48ac978c4e7f195a99eac3823c --- /dev/null +++ b/smp-docker/images/oracle/oracle-db-11.2.0.2/Checksum.xe @@ -0,0 +1 @@ +dd7881a55569d890241f11cd0eeb7d48 oracle-xe-11.2.0-1.0.x86_64.rpm.zip diff --git a/smp-docker/images/oracle/oracle-db-11.2.0.2/Dockerfile.xe b/smp-docker/images/oracle/oracle-db-11.2.0.2/Dockerfile.xe new file mode 100644 index 0000000000000000000000000000000000000000..b7748a7fef5a1ed5f366b817eafd2033590e2d5e --- /dev/null +++ b/smp-docker/images/oracle/oracle-db-11.2.0.2/Dockerfile.xe @@ -0,0 +1,86 @@ +# LICENSE UPL 1.0 +# +# Copyright (c) 1982-2016 Oracle and/or its affiliates. All rights reserved. +# +# ORACLE DOCKERFILES PROJECT +# -------------------------- +# This is the Dockerfile for Oracle Database 11g Release 2 Express Edition +# +# REQUIRED FILES TO BUILD THIS IMAGE +# ---------------------------------- +# (1) oracle-xe-11.2.0-1.0.x86_64.rpm.zip +# Download Oracle Database 11g Release 2 Express Edition for Linux x64 +# from http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html +# +# HOW TO BUILD THIS IMAGE +# ----------------------- +# Put the downloaded file in the same directory as this Dockerfile +# Run: +# $ docker build -t oracle/database:11.2.0.2-xe . +# +# IMPORTANT +# --------- +# Oracle XE requires Docker 1.10.0 and above: +# Oracle XE uses shared memory for MEMORY_TARGET and needs at least 1 GB. +# Docker only supports --shm-size since Docker 1.10.0 +# +# Pull base image +# --------------- +FROM oraclelinux:7-slim + +# Maintainer +# ---------- +MAINTAINER Gerald Venzl <gerald.venzl@oracle.com> + +# Environment variables required for this build (do NOT change) +# ------------------------------------------------------------- +ENV ORACLE_BASE=/u01/app/oracle \ + ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe \ + ORACLE_SID=XE \ + INSTALL_FILE_1="oracle-xe-11.2.0-1.0.x86_64.rpm.zip" \ + INSTALL_DIR="$HOME/install" \ + CONFIG_RSP="xe.rsp" \ + RUN_FILE="runOracle.sh" \ + PWD_FILE="setPassword.sh" \ + CHECK_DB_FILE="checkDBStatus.sh" + +# Use second ENV so that variable get substituted +ENV PATH=$ORACLE_HOME/bin:$PATH + +# Copy binaries +# ------------- +COPY $INSTALL_FILE_1 $CONFIG_RSP $RUN_FILE $PWD_FILE $CHECK_DB_FILE $INSTALL_DIR/ + +# Install Oracle Express Edition +# ------------------------------ + +RUN yum -y install unzip libaio bc initscripts net-tools openssl compat-libstdc++-33 && \ + rm -rf /var/cache/yum && \ + cd $INSTALL_DIR && \ + unzip $INSTALL_FILE_1 && \ + rm $INSTALL_FILE_1 && \ + cat() { declare -A PROC=(["/proc/sys/kernel/shmmax"]=4294967295 ["/proc/sys/kernel/shmmni"]=4096 ["/proc/sys/kernel/shmall"]=2097152 ["/proc/sys/fs/file-max"]=6815744); [[ ${PROC[$1]} == "" ]] && /usr/bin/cat $* || echo ${PROC[$1]}; } && \ + free() { echo "Swap: 2048 0 2048"; } && \ + export -f cat free && \ + rpm -i Disk1/*.rpm && \ + unset -f cat free && \ + mkdir -p $ORACLE_BASE/scripts/setup && \ + mkdir $ORACLE_BASE/scripts/startup && \ + ln -s $ORACLE_BASE/scripts /docker-entrypoint-initdb.d && \ + mkdir $ORACLE_BASE/oradata && \ + chown -R oracle:dba $ORACLE_BASE && \ + mv $INSTALL_DIR/$CONFIG_RSP $ORACLE_BASE/ && \ + mv $INSTALL_DIR/$RUN_FILE $ORACLE_BASE/ && \ + mv $INSTALL_DIR/$PWD_FILE $ORACLE_BASE/ && \ + mv $INSTALL_DIR/$CHECK_DB_FILE $ORACLE_BASE/ && \ + ln -s $ORACLE_BASE/$PWD_FILE / && \ + cd $HOME && \ + rm -rf $INSTALL_DIR && \ + chmod ug+x $ORACLE_BASE/*.sh + +VOLUME ["$ORACLE_BASE/oradata"] +EXPOSE 1521 8080 +HEALTHCHECK --interval=1m --start-period=5m \ + CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1 + +CMD exec $ORACLE_BASE/$RUN_FILE diff --git a/smp-docker/images/oracle/oracle-db-11.2.0.2/checkDBStatus.sh b/smp-docker/images/oracle/oracle-db-11.2.0.2/checkDBStatus.sh new file mode 100755 index 0000000000000000000000000000000000000000..df473ab922d08f2f8cc590cf405feaa38c851c84 --- /dev/null +++ b/smp-docker/images/oracle/oracle-db-11.2.0.2/checkDBStatus.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# LICENSE UPL 1.0 +# +# Copyright (c) 1982-2017 Oracle and/or its affiliates. All rights reserved. +# +# Since: May, 2017 +# Author: gerald.venzl@oracle.com +# Description: Checks the status of Oracle Database. +# Return codes: 0 = Database is open and ready to use +# 1 = Database is not open +# 2 = Sql Plus execution failed +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# + +POSITIVE_RETURN="OPEN" +ORACLE_SID="`grep $ORACLE_HOME /etc/oratab | cut -d: -f1`" + +# Check Oracle DB status and store it in status +status=`su -p oracle -c "sqlplus -s / as sysdba" << EOF + set heading off; + set pagesize 0; + select status from v\\$instance; + exit; +EOF` + +# Store return code from SQL*Plus +ret=$? + +# SQL Plus execution was successful and database is open +if [ $ret -eq 0 ] && [ "$status" = "$POSITIVE_RETURN" ]; then + exit 0; +# Database is not open +elif [ "$status" != "$POSITIVE_RETURN" ]; then + exit 1; +# SQL Plus execution failed +else + exit 2; +fi; diff --git a/smp-docker/images/oracle/oracle-db-11.2.0.2/runOracle.sh b/smp-docker/images/oracle/oracle-db-11.2.0.2/runOracle.sh new file mode 100644 index 0000000000000000000000000000000000000000..19031c083f0283f5b37cace02d4fc0c7c264346e --- /dev/null +++ b/smp-docker/images/oracle/oracle-db-11.2.0.2/runOracle.sh @@ -0,0 +1,223 @@ +#!/bin/bash + +############# Execute custom scripts ############## +function runUserScripts { + + SCRIPTS_ROOT="$1"; + + # Check whether parameter has been passed on + if [ -z "$SCRIPTS_ROOT" ]; then + echo "$0: No SCRIPTS_ROOT passed on, no scripts will be run"; + exit 1; + fi; + + # Execute custom provided files (only if directory exists and has files in it) + if [ -d "$SCRIPTS_ROOT" ] && [ -n "$(ls -A $SCRIPTS_ROOT)" ]; then + + echo ""; + echo "Executing user defined scripts" + + for f in $SCRIPTS_ROOT/*; do + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; echo "exit" | su -p oracle -c "$ORACLE_HOME/bin/sqlplus / as sysdba @$f"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo ""; + done + + echo "DONE: Executing user defined scripts" + echo ""; + + fi; + +} + +########### Move DB files ############ +function moveFiles { + if [ ! -d $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID ]; then + su -p oracle -c "mkdir -p $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/" + fi; + + su -p oracle -c "mv $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/" + su -p oracle -c "mv $ORACLE_HOME/dbs/orapw$ORACLE_SID $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/" + su -p oracle -c "mv $ORACLE_HOME/network/admin/listener.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/" + su -p oracle -c "mv $ORACLE_HOME/network/admin/tnsnames.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/" + mv /etc/sysconfig/oracle-xe $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/ + + cp /etc/oratab $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/ + + symLinkFiles; +} + +########### Symbolic link DB files ############ +function symLinkFiles { + + if [ ! -L $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora ]; then + ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/spfile$ORACLE_SID.ora $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora + fi; + + if [ ! -L $ORACLE_HOME/dbs/orapw$ORACLE_SID ]; then + ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/orapw$ORACLE_SID $ORACLE_HOME/dbs/orapw$ORACLE_SID + fi; + + if [ ! -L $ORACLE_HOME/network/admin/listener.ora ]; then + ln -sf $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/listener.ora $ORACLE_HOME/network/admin/listener.ora + fi; + + if [ ! -L $ORACLE_HOME/network/admin/tnsnames.ora ]; then + ln -sf $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/tnsnames.ora $ORACLE_HOME/network/admin/tnsnames.ora + fi; + + if [ ! -L /etc/sysconfig/oracle-xe ]; then + ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/oracle-xe /etc/sysconfig/oracle-xe + fi; + + cp $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/oratab /etc/oratab +} + +########### SIGTERM handler ############ +function _term() { + echo "Stopping container." + echo "SIGTERM received, shutting down database!" + /etc/init.d/oracle-xe stop +} + +########### SIGKILL handler ############ +function _kill() { + echo "SIGKILL received, shutting down database!" + /etc/init.d/oracle-xe stop +} + +############# Create DB ################ +function createDB { + # Auto generate ORACLE PWD if not passed on + export ORACLE_PWD=${ORACLE_PWD:-"`openssl rand -hex 8`"} + echo "ORACLE PASSWORD FOR SYS AND SYSTEM: $ORACLE_PWD"; + + sed -i -e "s|###ORACLE_PWD###|$ORACLE_PWD|g" $ORACLE_BASE/$CONFIG_RSP && \ + /etc/init.d/oracle-xe configure responseFile=$ORACLE_BASE/$CONFIG_RSP + + # Listener + echo "# listener.ora Network Configuration File: + + SID_LIST_LISTENER = + (SID_LIST = + (SID_DESC = + (SID_NAME = PLSExtProc) + (ORACLE_HOME = $ORACLE_HOME) + (PROGRAM = extproc) + ) + ) + + LISTENER = + (DESCRIPTION_LIST = + (DESCRIPTION = + (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) + (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521)) + ) + ) + + DEFAULT_SERVICE_LISTENER = (XE)" > $ORACLE_HOME/network/admin/listener.ora + +# TNS Names.ora + echo "# tnsnames.ora Network Configuration File: + +XE = + (DESCRIPTION = + (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521)) + (CONNECT_DATA = + (SERVER = DEDICATED) + (SERVICE_NAME = XE) + ) + ) + +EXTPROC_CONNECTION_DATA = + (DESCRIPTION = + (ADDRESS_LIST = + (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) + ) + (CONNECT_DATA = + (SID = PLSExtProc) + (PRESENTATION = RO) + ) + ) +" > $ORACLE_HOME/network/admin/tnsnames.ora + + su -p oracle -c "sqlplus / as sysdba <<EOF + EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); + + ALTER DATABASE ADD LOGFILE GROUP 4 ('$ORACLE_BASE/oradata/$ORACLE_SID/redo04.log') SIZE 50m; + ALTER DATABASE ADD LOGFILE GROUP 5 ('$ORACLE_BASE/oradata/$ORACLE_SID/redo05.log') SIZE 50m; + ALTER DATABASE ADD LOGFILE GROUP 6 ('$ORACLE_BASE/oradata/$ORACLE_SID/redo06.log') SIZE 50m; + ALTER SYSTEM SWITCH LOGFILE; + ALTER SYSTEM SWITCH LOGFILE; + ALTER SYSTEM CHECKPOINT; + ALTER DATABASE DROP LOGFILE GROUP 1; + ALTER DATABASE DROP LOGFILE GROUP 2; + + ALTER SYSTEM SET db_recovery_file_dest=''; + exit; +EOF" + + # Move database operational files to oradata + moveFiles; +} + +############# MAIN ################ + +# Set SIGTERM handler +trap _term SIGTERM + +# Set SIGKILL handler +trap _kill SIGKILL + +# Check whether database already exists +if [ -d $ORACLE_BASE/oradata/$ORACLE_SID ]; then + symLinkFiles; + # Make sure audit file destination exists + if [ ! -d $ORACLE_BASE/admin/$ORACLE_SID/adump ]; then + su -p oracle -c "mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump" + fi; +fi; + +/etc/init.d/oracle-xe start | grep -qc "Oracle Database 11g Express Edition is not configured" +if [ "$?" == "0" ]; then + # Check whether container has enough memory + if [ `df -Pk /dev/shm | tail -n 1 | awk '{print $2}'` -lt 1048576 ]; then + echo "Error: The container doesn't have enough memory allocated." + echo "A database XE container needs at least 1 GB of shared memory (/dev/shm)." + echo "You currently only have $((`df -Pk /dev/shm | tail -n 1 | awk '{print $2}'`/1024)) MB allocated to the container." + exit 1; + fi; + + # Create database + createDB; + + # Execute custom provided setup scripts + runUserScripts $ORACLE_BASE/scripts/setup +fi; + +# Check whether database is up and running +$ORACLE_BASE/$CHECK_DB_FILE +if [ $? -eq 0 ]; then + echo "#########################" + echo "DATABASE IS READY TO USE!" |& tee /u01/status/database.log + echo "#########################" + + # Execute custom provided startup scripts + runUserScripts $ORACLE_BASE/scripts/startup + +else + echo "#####################################" + echo "########### E R R O R ###############" + echo "DATABASE SETUP WAS NOT SUCCESSFUL!" |& tee /u01/status/database.log + echo "Please check output for further info!" + echo "########### E R R O R ###############" + echo "#####################################" +fi; + +echo "The following output is now a tail of the alert.log:" +tail -f $ORACLE_BASE/diag/rdbms/*/*/trace/alert*.log & +childPID=$! +wait $childPID diff --git a/smp-docker/images/oracle/oracle-db-11.2.0.2/setPassword.sh b/smp-docker/images/oracle/oracle-db-11.2.0.2/setPassword.sh new file mode 100644 index 0000000000000000000000000000000000000000..7fd6dae7b1910daf52c76c8c327a2dcc286cb16f --- /dev/null +++ b/smp-docker/images/oracle/oracle-db-11.2.0.2/setPassword.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +ORACLE_PWD=$1 + +su -p oracle -c "sqlplus / as sysdba << EOF + ALTER USER SYS IDENTIFIED BY "$ORACLE_PWD"; + ALTER USER SYSTEM IDENTIFIED BY "$ORACLE_PWD"; + exit; +EOF" + diff --git a/smp-docker/images/oracle/oracle-db-11.2.0.2/xe.rsp b/smp-docker/images/oracle/oracle-db-11.2.0.2/xe.rsp new file mode 100644 index 0000000000000000000000000000000000000000..85777247eb00522f1b73d301cb7bab3e66c74691 --- /dev/null +++ b/smp-docker/images/oracle/oracle-db-11.2.0.2/xe.rsp @@ -0,0 +1,44 @@ +############################################################################### +# # +# HTTP port that will be used to access APEX admin page # +# Default : 8080 # +# # +############################################################################### +ORACLE_HTTP_PORT=8080 + +############################################################################### +# # +# TNS port that will be used to configure listener # +# Default : 1521 # +# # +############################################################################### +ORACLE_LISTENER_PORT=1521 + +############################################################################### +# # +# Passwords can be supplied for the following two schemas in the # +# starter database: # +# SYS # +# SYSTEM # +# # +############################################################################### +ORACLE_PASSWORD=###ORACLE_PWD### + +############################################################################### +# # +# Passwords can be supplied for the following two schemas in the # +# starter database: # +# SYS # +# SYSTEM # +# # +# ORACLE_CONFIRM_PASSWORD should be same as ORACLE_PASSWORD # +# # +############################################################################### +ORACLE_CONFIRM_PASSWORD=###ORACLE_PWD### + +############################################################################### +# # +# To start/stop listener and database instance up on system boot # +# # +############################################################################### +ORACLE_DBENABLE=y \ No newline at end of file diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/Checksum.developer b/smp-docker/images/oracle/weblogic-12.2.1.3/Checksum.developer new file mode 100644 index 0000000000000000000000000000000000000000..8b78a35955c5c8da78434d77120269035d7d338f --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/Checksum.developer @@ -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 + diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/Checksum.generic b/smp-docker/images/oracle/weblogic-12.2.1.3/Checksum.generic new file mode 100644 index 0000000000000000000000000000000000000000..7290c15d43af7c680cd4073d2afbe9d473a2ea3d --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/Checksum.generic @@ -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 + diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile b/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9b5a1fb6ea613840aa0e3e847ffdff3703bb5479 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile @@ -0,0 +1,87 @@ +#Copyright (c) 2014-2018 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:${JAVA_HOME}/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}" \ + ADMIN_LISTEN_PORT="${ADMIN_LISTEN_PORT:-7001}" \ + ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \ + DEBUG_FLAG=true \ + PRODUCTION_MODE=dev \ + ADMINISTRATION_PORT_ENABLED="${ADMINISTRATION_PORT_ENABLED:-true}" \ + ADMINISTRATION_PORT="${ADMINISTRATION_PORT:-9002}" + + + +# 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 -silent -responseFile /u01/install.file -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"] diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile.developer b/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile.developer new file mode 100644 index 0000000000000000000000000000000000000000..9b5a1fb6ea613840aa0e3e847ffdff3703bb5479 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile.developer @@ -0,0 +1,87 @@ +#Copyright (c) 2014-2018 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:${JAVA_HOME}/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}" \ + ADMIN_LISTEN_PORT="${ADMIN_LISTEN_PORT:-7001}" \ + ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \ + DEBUG_FLAG=true \ + PRODUCTION_MODE=dev \ + ADMINISTRATION_PORT_ENABLED="${ADMINISTRATION_PORT_ENABLED:-true}" \ + ADMINISTRATION_PORT="${ADMINISTRATION_PORT:-9002}" + + + +# 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 -silent -responseFile /u01/install.file -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"] diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile.generic b/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile.generic new file mode 100644 index 0000000000000000000000000000000000000000..cbe0d3ac3b3e966069c88153bc85299f833ef4a5 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/Dockerfile.generic @@ -0,0 +1,85 @@ +#Copyright (c) 2014-2018 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:${JAVA_HOME}/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}" \ + ADMIN_LISTEN_PORT="${ADMIN_LISTEN_PORT:-7001}" \ + ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \ + ADMINISTRATION_PORT_ENABLED="${ADMINISTRATION_PORT_ENABLED:-true}" \ + ADMINISTRATION_PORT="${ADMINISTRATION_PORT:-9002}" + +# 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"] diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/README.md b/smp-docker/images/oracle/weblogic-12.2.1.3/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2c7cd83977e57d2c6f645d9abcaf28ad374d78a3 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/README.md @@ -0,0 +1,98 @@ +Oracle WebLogic Server on Docker +================================= +These Docker configurations have been used to create the Oracle WebLogic Server (WLS) image. Providing this WLS image facilitates the configuration and environment setup for DevOps users. This project includes the installation and creation of an empty WebLogic Server domain (an Administration Server only). 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 see the [Oracle WebLogic Server on Docker certification whitepaper](http://www.oracle.com/technetwork/middleware/weblogic/overview/weblogic-server-docker-containers-2491959.pdf) and [The 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). It provides at least one Dockerfile for the 'developer' distribution, a second Dockerfile for the 'generic' 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 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 must 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 Container Registry](https://container-registry.oracle.com) or the [Docker Store](https://store.docker.com). + +Before you build, select the version and distribution for which you want to build an image, then download the required packages (see `.download` files) and locate them in the folder of your distribution version of choice. Then, from the `dockerfiles` folder, run the `buildDockerImage.sh` script as root. + + $ sh buildDockerImage.sh + Usage: buildDockerImage.sh -v [version] [-d | -g ] [-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 + -c: enables Docker image layer cache during build + -s: skips the MD5 check of packages + + * select one distribution only: -d, or -g + + LICENSE UPL 1.0 + + Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. + +**IMPORTANT:** The resulting images will have a single server domain (Administration Server only), by default. + + + 1. To build the `12.2.1.3`image, from `dockerfiles`, call: + + `$ sh buildDockerImage.sh -v 12.2.1.3 -d` + + 2. Verify that you now have this image in place with: + + `$ docker images` + +### Running a single server domain from the image +The WebLogic Server install image (built above) allows you to run a container with a single WebLogic Server domain. This makes it extremely simple to deploy applications and any resource the application might need. + +#### Providing the Administration Server user name and password +The user name and password must be supplied in a `domain.properties` file located in a HOST directory that you will map at Docker runtime with the `-v` option to the image directory `/u01/oracle/properties`. The properties file enables the scripts to configure the correct authentication for the WebLogic Administration Server. + +The format of the `domain.properties` file is key=value pair: + + username=myadminusername + password=myadminpassword + +**Note**: Oracle recommends that the `domain.properties` file be deleted or secured after the container and the WebLogic Server are started so that the user name and password are not inadvertently exposed. + +#### Start the container +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_LISTEN_PORT` (default: `7001`) + * `DOMAIN_NAME` (default: `base_domain`) + * `ADMINISTRATION_PORT_ENABLED` (default: `true`) + * `ADMINISTRATION_PORT` (default: `9002`) + +**NOTE**: For security, the Administration port 9002 is enabled by default, before running the container in WebLogic 12.2.1.3 the patch 27117282 must be applied. Please download the patch and apply it after you have built the 12.2.1.3 image. You can follow the sample https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-patch to see how to patch. An alternative is to not enable Administration port when you issue the docker run command, set `ADMINISTRTATION_PORT_ENABLED` to false. If you intend to run these images in production, then you must change the Production Mode to `production`. When you set the `DOMAIN_NAME`, the `DOMAIN_HOME=/u01/oracle/user_projects/domains/$DOMAIN_NAME`. + + $docker run -d -p 7001:7001 -p 9002:9002 -v `HOST PATH where the domain.properties file is`:/u01/oracle/properties -e ADMINISTRATION_PORT_ENABLED=true -e DOMAIN_NAME=abc_domain oracle/weblogic:12.2.1.3-developer + +Run the WLS Administration Console: + + $ docker inspect --format '{{.NetworkSettings.IPAddress}}' <container-name> + +In your browser, enter `https://xxx.xx.x.x:9002/console`. Your browser will request that you accept the Security Exception. To avoid the Security Exception, you must update the WebLogic Server SSL configuration with a custom identity certificate. + +## Choose your Oracle WebLogic Server distribution + +This project hosts two configurations (depending on the 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, see [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, see [WebLogic Server 12.2.1.3 Documentation](http://docs.oracle.com/middleware/12213/wls/index.html). + +## Samples for Oracle WebLogic Server domain creation +To give users an idea of how to create a WebLogic domain and cluster from a custom Dockerfile which extends the WebLogic Server install image, we provide a few samples for 12c versions of the developer distribution. For an example, look at the `12213-domain` sample. + +## Copyright +Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/container-scripts/create-wls-domain.py b/smp-docker/images/oracle/weblogic-12.2.1.3/container-scripts/create-wls-domain.py new file mode 100644 index 0000000000000000000000000000000000000000..a7c6cac5ff65c2870e96d6c9fca2ea5782e18223 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/container-scripts/create-wls-domain.py @@ -0,0 +1,91 @@ +#Copyright (c) 2014-2018 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: monica.riccelli@oracle.com +# ============================================== +domain_name = os.environ.get("DOMAIN_NAME", "base_domain") +admin_name = os.environ.get("ADMIN_NAME", "AdminServer") +admin_listen_port = int(os.environ.get("ADMIN_LISTEN_PORT", "7001")) +domain_path = '/u01/oracle/user_projects/domains/%s' % domain_name +production_mode = os.environ.get("PRODUCTION_MODE", "prod") +administration_port_enabled = os.environ.get("ADMINISTRATION_PORT_ENABLED", "true") +administration_port = int(os.environ.get("ADMINISTRATION_PORT", "9002")) + +print('domain_name : [%s]' % domain_name); +print('admin_listen_port : [%s]' % admin_listen_port); +print('domain_path : [%s]' % domain_path); +print('production_mode : [%s]' % production_mode); +print('admin name : [%s]' % admin_name); +print('administration_port_enabled : [%s]' % administration_port_enabled); +print('administration_port : [%s]' % administration_port); + +# Open default domain template +# ============================ +readTemplate("/u01/oracle/wlserver/common/templates/wls/wls.jar") + +set('Name', domain_name) +setOption('DomainName', domain_name) + +# Set Administration Port +# ======================= +if administration_port_enabled != "false": + set('AdministrationPort', administration_port) + set('AdministrationPortEnabled', 'true') + +# 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_listen_port) +if administration_port_enabled != "false": + create('AdminServer','SSL') + cd('SSL/AdminServer') + set('Enabled', 'True') + +# Define the user password for weblogic +# ===================================== +cd(('/Security/%s/User/weblogic') % domain_name) +cmo.setName(username) +cmo.setPassword(password) + +# Write the domain and close the domain template +# ============================================== +setOption('OverwriteDomain', 'true') +setOption('ServerStartMode',production_mode) + +# Create Node Manager +# =================== +#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 +# =========================================== +#cd('/SecurityConfiguration/%s' % domain_name) +#set('NodeManagerUsername', username) +#set('NodeManagerPasswordEncrypted', password) + +# Write Domain +# ============ +writeDomain(domain_path) +closeTemplate() + +# Exit WLST +# ========= +exit() diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/container-scripts/createAndStartEmptyDomain.sh b/smp-docker/images/oracle/weblogic-12.2.1.3/container-scripts/createAndStartEmptyDomain.sh new file mode 100755 index 0000000000000000000000000000000000000000..d17d140167615abb30e30b721ea467e86c1fe0ad --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/container-scripts/createAndStartEmptyDomain.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +#Copyright (c) 2014-2018 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. + +#Define DOMAIN_HOME +export DOMAIN_HOME=/u01/oracle/user_projects/domains/$DOMAIN_NAME +echo "Domain Home is: " $DOMAIN_HOME + +# If AdminServer.log does not exists, container is starting for 1st time +# So it should start NM and also associate with AdminServer +# Otherwise, only start NM (container restarted) +########### SIGTERM handler ############ +function _term() { + echo "Stopping container." + echo "SIGTERM received, shutting down the server!" + ${DOMAIN_HOME}/bin/stopWebLogic.sh +} + +########### SIGKILL handler ############ +function _kill() { + echo "SIGKILL received, shutting down the server!" + kill -9 $childPID +} + +# Set SIGTERM handler +trap _term SIGTERM + +# Set SIGKILL handler +trap _kill SIGKILL + +ADD_DOMAIN=1 +if [ ! -f ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log ]; then + ADD_DOMAIN=0 +fi + +mkdir -p $ORACLE_HOME/properties +# Create Domain only if 1st execution +if [ $ADD_DOMAIN -eq 0 ]; then + PROPERTIES_FILE=/u01/oracle/properties/domain.properties + if [ ! -e "$PROPERTIES_FILE" ]; then + echo "A properties file with the username and password needs to be supplied." + exit + fi + + # Get Username + USER=`awk '{print $1}' $PROPERTIES_FILE | grep username | cut -d "=" -f2` + if [ -z "$USER" ]; then + echo "The domain username is blank. The Admin username must be set in the properties file." + exit + fi + # Get Password + PASS=`awk '{print $1}' $PROPERTIES_FILE | grep password | cut -d "=" -f2` + if [ -z "$PASS" ]; then + echo "The domain password is blank. The Admin password must be set in the properties file." + exit + fi + + # Create an empty domain + wlst.sh -skipWLSModuleScanning -loadProperties $PROPERTIES_FILE /u01/oracle/create-wls-domain.py + mkdir -p ${DOMAIN_HOME}/servers/AdminServer/security/ + echo "username=${USER}" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties + echo "password=${PASS}" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties + ${DOMAIN_HOME}/bin/setDomainEnv.sh +fi + +# Start Admin Server and tail the logs +${DOMAIN_HOME}/startWebLogic.sh +touch ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log +tail -f ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log & + +childPID=$! +wait $childPID diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip.download b/smp-docker/images/oracle/weblogic-12.2.1.3/fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip.download new file mode 100644 index 0000000000000000000000000000000000000000..29195504d4ab929242aaa55a33ddcf286fe782e8 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip.download @@ -0,0 +1,5 @@ +# 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 diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/install.file b/smp-docker/images/oracle/weblogic-12.2.1.3/install.file new file mode 100644 index 0000000000000000000000000000000000000000..23fdba63a87bd0fcbeff5b68978fee4ec81922fc --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/install.file @@ -0,0 +1,12 @@ +# Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. +[ENGINE] + +#DO NOT CHANGE THIS. +Response File Version=1.0.0.0.0 + +[GENERIC] + +INSTALL_TYPE=WebLogic Server +SOFTWARE ONLY TYPE=true +DECLINE_SECURITY_UPDATES=true +SECURITY_UPDATES_VIA_MYORACLESUPPORT=false diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/oraInst.loc b/smp-docker/images/oracle/weblogic-12.2.1.3/oraInst.loc new file mode 100644 index 0000000000000000000000000000000000000000..01f1964a55a8985128790df86e11db1f7ac4da3b --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/oraInst.loc @@ -0,0 +1,2 @@ +inventory_loc=/u01/oracle/.inventory +inst_group=oracle diff --git a/smp-docker/images/oracle/weblogic-12.2.1.3/properties/domain.properties b/smp-docker/images/oracle/weblogic-12.2.1.3/properties/domain.properties new file mode 100644 index 0000000000000000000000000000000000000000..ee2eecf41220207253a1176c65f36cb0d369e595 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12.2.1.3/properties/domain.properties @@ -0,0 +1,2 @@ +username=weblogic +password=Weblogic1 diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/Dockerfile b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2acf724ef3cbe9b73285de502678d48194c1294d --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/Dockerfile @@ -0,0 +1,76 @@ +#Copyright (c) 2014-2018 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 Dockerfile extends the Oracle WebLogic image by creating a sample domain. +# +# Util scripts are copied into the image enabling users to plug NodeManager +# automatically into the AdminServer running on another container. +# +# HOW TO BUILD THIS IMAGE +# ----------------------- +# Put all downloaded files in the same directory as this Dockerfile +# Run: +# $ sudo docker build -t 12213-domain-home-image +# +# Pull base image +# --------------- +FROM oracle/weblogic:12.2.1.3-developer + +# Maintainer +# ---------- +MAINTAINER Monica Riccelli <monica.riccelli@oracle.com> + +ARG CUSTOM_DOMAIN_NAME="${CUSTOM_DOMAIN_NAME:-domain1}" +ARG CUSTOM_ADMIN_PORT="${CUSTOM_ADMIN_PORT:-7001}" +ARG CUSTOM_MANAGED_SERVER_PORT="${CUSTOM_MANAGED_SERVER_PORT:-8001}" +ARG CUSTOM_DEBUG_PORT="${CUSTOM_DEBUG_PORT:-8453}" +ARG CUSTOM_ADMIN_NAME="${CUSTOM_ADMIN_NAME:-admin-server}" +ARG CUSTOM_ADMIN_HOST="${CUSTOM_ADMIN_HOST:-wlsadmin}" +ARG CUSTOM_CLUSTER_NAME="${CUSTOM_CLUSTER_NAME:-DockerCluster}" + +# WLS Configuration +# --------------------------- +ENV ORACLE_HOME=/u01/oracle \ + PROPERTIES_FILE_DIR="/u01/oracle/properties" \ + DOMAIN_NAME="${CUSTOM_DOMAIN_NAME}" \ + DOMAIN_HOME="/u01/oracle/user_projects/domains/${CUSTOM_DOMAIN_NAME}" \ + ADMIN_PORT="${CUSTOM_ADMIN_PORT}" \ + ADMIN_NAME="${CUSTOM_ADMIN_NAME}" \ + ADMIN_HOST="${CUSTOM_ADMIN_HOST}" \ + CLUSTER_NAME="${CUSTOM_CLUSTER_NAME}" \ + MANAGED_SERVER_PORT="${CUSTOM_MANAGED_SERVER_PORT}" \ + MANAGED_SERV_NAME="${MANAGED_SERV_NAME}" \ + DEBUG_PORT="8453" \ + PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:${DOMAIN_HOME}:${DOMAIN_HOME}/bin:/u01/oracle + +# Add files required to build this image +COPY container-scripts/* /u01/oracle/ + +#Create directory where domain will be written to +USER root +RUN chmod +xw /u01/oracle/*.sh && \ + chmod +xw /u01/oracle/*.py && \ + mkdir -p ${PROPERTIES_FILE_DIR} && \ + chown -R oracle:oracle ${PROPERTIES_FILE_DIR} && \ + mkdir -p $DOMAIN_HOME && \ + chown -R oracle:oracle $DOMAIN_HOME && \ + chmod -R a+xwr $DOMAIN_HOME + +COPY properties/docker-build/domain*.properties ${PROPERTIES_FILE_DIR}/ + +# Configuration of WLS Domain +RUN /u01/oracle/createWLSDomain.sh && \ + echo ". $DOMAIN_HOME/bin/setDomainEnv.sh" >> /u01/oracle/.bashrc && \ + chmod -R a+x $DOMAIN_HOME/bin/*.sh && \ + rm ${PROPERTIES_FILE_DIR}/*.properties + +# Expose ports for admin, managed server, and debug +EXPOSE $ADMIN_PORT $MANAGED_SERVER_PORT $DEBUG_PORT + +WORKDIR $DOMAIN_HOME + +# Define default command to start bash. +CMD ["startAdminServer.sh"] diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/README.md b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e9a731ed52adaa3aac4ce93d07da7a93a1ec9567 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/README.md @@ -0,0 +1,92 @@ +Example Image with a WebLogic Server Domain +============================================= +This Dockerfile extends the Oracle WebLogic image by creating a sample WebLogic Server 12.2.1.3 domain and cluster into a Docker image. + +A domain is created inside the image and utility scripts are copied into the image, enabling users to start an Administration Server and a Managed Server, each running in separate containers. + +**Note:** In this sample, the WebLogic Servers are configured with a blank listen address; when running JTA transactions, you must use a DNS server to configure the listen addresses to use DNS names. + +## Providing the Administration Server user name and password + + +**During Docker Build:** The user name and password must be supplied in the `domain_security.properties` file. The property file is located in the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_build` in the HOST. This property file gets copied into the image directory `/u01/oracle/properties`. + +**During Docker Run:** The user name and password must be supplied in a `security.properties` file. The property file is located in a `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_run` directory in the HOST. On the Docker run command line, the `-v` option maps the property file into the image directory `/u01/oracle/properties`. + + +The security property files enable the scripts to configure the correct authentication for the WebLogic Administration Server and Managed Servers. The format of the `security.properties` and `domain_security.properties` files are key=value pairs, for example: + + username=myadminusername + password=myadminpassword + +**Note:** Oracle recommends that the `domain_security.properties` and `security.properties` files be deleted or secured after the container and the WebLogic Server are started so that the user name and password are not inadvertently exposed. + +## How to Build and Run +At build time, the `domain.properties` file is used to pass in the Docker arguments and configuration parameters for the WebLogic domain. + + +**During Docker Build:** The domain configuration parameters must be supplied in the `domain.properties` file. This file is located in the directory `properties/docker_build` in the HOST. This property file gets copied into the image directory `/u01/oracle/properties`. + + +The domain property file enables you to customize the parameters to configure the WebLogic domain. The format of the `domain.properties` are key=value pairs, for example: + + ADMIN_NAME=admin-server + ADMIN_HOST=wlsadmin + MANAGED_SERVER_NAME_BASE=managed-server + CONFIGURED_MANAGED_SERVER_COUNT=2 + CLUSTER_NAME=cluster-1 + DEBUG_FLAG=true + PRODUCTION_MODE_ENABLED=true + CLUSTER_TYPE=DYNAMIC + CLUSTER_NAME=cluster1 + +**NOTE:** Before invoking the build make sure you have built `oracle/weblogic:12.2.1.3-developer`. + + +Under the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/container_scripts` find the script `setEnv.sh`. This script extracts the following Docker arguments and passes them as a `--build-arg` to the Dockerfile. + + +* Domain Name: `DOMAIN_NAME` (default: `base_domain`) +* Admin Port: `ADMIN_PORT` (default: `7001`) +* Managed Server Port: `MANAGED_SERVER_PORT` (default: `8001`) +* Debug Port: `DEBUG_PORT` (default: `8453`) +* Database Port: `DB_PORT` (default: `1527`) +* Admin Server Name: `ADMIN_NAME` (default: `admin-server`) +* Admin Server Host: `ADMIN_HOST` (default: `wlsadmin`) +* Cluster Name: `CLUSTER_NAME` (default: `cluster1`) + +**NOTE:** The `DOMAIN_HOME` will be persisted in the image directory `/u01/oracle/user-projects/domains/$DOMAIN_NAME`. + +To build this sample, run: + + $ . container-scripts/setEnv.sh ./properties/docker-build/domain.properties + $ docker build $BUILD_ARG --force-rm=true -t 12213-domain-home-in-image . + + +**During Docker Run:** of the Administration and Managed Servers, the user name and password need to be passed in as well as some optional parameters. The property file is located in a `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_run` in the HOST. On the Docker run command line, add the `-v` option which maps the property file into the image directory `/u01/oracle/properties`. + + +To start the containerized Administration Server, run: + + $ docker run -d --name wlsadmin --hostname wlsadmin -p 7001:7001 \ + -v <HOST DIRECTORY TO PROPERTIES FILE>/properties/docker-run:/u01/oracle/properties \ + 12213-domain-home-in-image + +To start a containerized Managed Server (MS1) to self-register with the Administration Server above, run: + + $ docker run -d --name MS1 --link wlsadmin:wlsadmin -p 8001:8001 \ + -v <HOST DIRECTORY TO PROPERTIES FILE>/properties/docker-run:/u01/oracle/properties \ + -e MANAGED_SERV_NAME=managed-server1 12213-domain-home-in-image startManagedServer.sh + +To start a second Managed Server (MS2), run: + + $ docker run -d --name MS2 --link wlsadmin:wlsadmin -p 8002:8001 \ + -v <HOST DIRECTORY TO PROPERTIES FILE>/properties/docker-run:/u01/oracle/properties \ + -e MANAGED_SERV_NAME=managed-server2 12213-domain-home-in-image startManagedServer.sh + +The above scenario from this sample will give you a WebLogic domain with a cluster set up on a single host environment. + +You may create more containerized Managed Servers by calling the `docker` command above + +# Copyright +Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/build.sh b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..3678ff1a4ae702a5e7a2cbd3ec7ec2c67f4e78cd --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/build.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +#Copyright (c) 2014-2018 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. +# +# TAG_NAME - Tag the docker image with this name. This overrides the default of +# 12213-domain-home-in-imag:latest. +# +# There are three ways to tag the domain home image using this build script. +# +# . Do nothing and the image will be tagged with the default name. +# . Add an IMAGE_TAG variable to the properties file and allow the +# setEnv.sh to manage the tag. Overrides the default tag. +# . Set the TAG_NAME environment variable. Overrides the default tag. +# + + +# Determine the tag name for the resulting image using the value in the TAG_NAME. +# The setEnv.sh will set the TAG_NAME variable if the property is found in the +# properties file. This function should be called after the setEnv.sh is run +tag_name() { + tagName=${CUSTOM_IMAGE_TAG:-"12213-domain-home-in-image:latest"} + echo "CUSTOM_IMAGE_TAG ${tagName} " +} + +# The location where the script is running will be used as the Context for +# the docker build Dockerfile commands +set_context() { + scriptDir="$( cd "$( dirname "$0" )" && pwd )" + if [ ! -d "${scriptDir}" ]; then + echo "Unable to determine the working directory for the domain home in image sample" + echo "Using shell /bin/sh to determine and found ${scriptDir}" + clean_and_exit + fi + echo "Context for docker build is ${scriptDir}" +} + +set_context +. ${scriptDir}/container-scripts/setEnv.sh ${scriptDir}/properties/docker-build/domain.properties + +tag_name +docker build $BUILD_ARG -t ${tagName} ${scriptDir} diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/create-wls-domain.py b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/create-wls-domain.py new file mode 100644 index 0000000000000000000000000000000000000000..e0bcdab158067eca67b3c8fc0fd55e65ea9c70bd --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/create-wls-domain.py @@ -0,0 +1,227 @@ +#Copyright (c) 2014-2018 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 : November, 2018 +# Author: monica.riccelli@oracle.com +# ============================================== + +import os +import socket + +def getEnvVar(var): + val=os.environ.get(var) + if val==None: + print "ERROR: Env var ",var, " not set." + sys.exit(1) + return val + +# This python script is used to create a WebLogic domain + +#domain_uid = DOMAIN_UID +server_port = int(os.environ.get("MANAGED_SERVER_PORT")) +domain_path = os.environ.get("DOMAIN_HOME") +cluster_name = CLUSTER_NAME +print('cluster_name : [%s]' % cluster_name); +admin_server_name = ADMIN_NAME +#admin_server_name_svc = os.environ.get("ADMIN_SERVER_NAME_SVC") +admin_port = int(os.environ.get("ADMIN_PORT")) +domain_name = os.environ.get("DOMAIN_NAME") +t3_channel_port = int(T3_CHANNEL_PORT) +t3_public_address = T3_PUBLIC_ADDRESS +number_of_ms = int(CONFIGURED_MANAGED_SERVER_COUNT) +cluster_type = CLUSTER_TYPE +managed_server_name_base = MANAGED_SERVER_NAME_BASE +#managed_server_name_base_svc = MANAGED_SERVER_NAME_BASE_SVC +#domain_logs = DOMAIN_LOGS_DIR +#script_dir = CREATE_DOMAIN_SCRIPT_DIR +production_mode_enabled = PRODUCTION_MODE_ENABLED + +# Read the domain secrets from the common python file +#execfile('%s/read-domain-secret.py' % script_dir) + +print('domain_path : [%s]' % domain_path); +print('domain_name : [%s]' % domain_name); +print('admin_server_name : [%s]' % admin_server_name); +print('admin_port : [%s]' % admin_port); +print('cluster_name : [%s]' % cluster_name); +print('server_port : [%s]' % server_port); +print('number_of_ms : [%s]' % number_of_ms); +print('cluster_type : [%s]' % cluster_type); +print('managed_server_name_base : [%s]' % managed_server_name_base); +print('production_mode_enabled : [%s]' % production_mode_enabled); +#print('dsname : [%s]' % dsname); +print('t3_channel_port : [%s]' % t3_channel_port); +print('t3_public_address : [%s]' % t3_public_address); + +# Open default domain template +# ============================ +readTemplate("/u01/oracle/wlserver/common/templates/wls/wls.jar") + +set('Name', domain_name) +setOption('DomainName', domain_name) +create(domain_name,'Log') +cd('/Log/%s' % domain_name); +set('FileName', '%s.log' % (domain_name)) + +# Configure the Administration Server +# =================================== +cd('/Servers/AdminServer') +#set('ListenAddress', '%s-%s' % (domain_uid, admin_server_name_svc)) +set('ListenPort', admin_port) +set('Name', admin_server_name) + + +create('T3Channel', 'NetworkAccessPoint') +cd('/Servers/%s/NetworkAccessPoints/T3Channel' % admin_server_name) +set('PublicPort', t3_channel_port) +set('PublicAddress', t3_public_address) +#set('ListenAddress', '%s-%s' % (domain_uid, admin_server_name_svc)) +set('ListenPort', t3_channel_port) + +#cd('/Servers/%s' % admin_server_name) +#create(admin_server_name, 'Log') +#cd('/Servers/%s/Log/%s' % (admin_server_name, admin_server_name)) +#set('FileName', '%s.log' % (admin_server_name)) + +# Set the admin user's username and password +# ========================================== +cd('/Security/%s/User/weblogic' % domain_name) +cmo.setName(username) +cmo.setPassword(password) + +# Write the domain and close the domain template +# ============================================== +setOption('OverwriteDomain', 'true') + + +# Create a cluster +# ====================== +cd('/') +cl=create(cluster_name, 'Cluster') + +if cluster_type == "CONFIGURED": + + # Create managed servers + for index in range(0, number_of_ms): + cd('/') + msIndex = index+1 + + cd('/') + name = '%s%s' % (managed_server_name_base, msIndex) +# name_svc = '%s%s' % (managed_server_name_base_svc, msIndex) + + create(name, 'Server') + cd('/Servers/%s/' % name ) + print('managed server name is %s' % name); +# set('ListenAddress', '%s-%s' % (domain_uid, name_svc)) + set('ListenPort', server_port) + set('NumOfRetriesBeforeMSIMode', 0) + set('RetryIntervalBeforeMSIMode', 1) + set('Cluster', cluster_name) + +# create(name,'Log') +# cd('/Servers/%s/Log/%s' % (name, name)) +# set('FileName', '%s.log' % (name)) + +else: + print('Configuring Dynamic Cluster %s' % cluster_name) + + templateName = cluster_name + "-template" + print('Creating Server Template: %s' % templateName) + st1=create(templateName, 'ServerTemplate') + print('Done creating Server Template: %s' % templateName) + cd('/ServerTemplates/%s' % templateName) + cmo.setListenPort(server_port) +# cmo.setListenAddress('%s-%s${id}' % (domain_uid, managed_server_name_base_svc)) + cmo.setCluster(cl) +# create(templateName,'Log') +# cd('Log/%s' % templateName) +# set('FileName', '%s${id}.log' % (managed_server_name_base)) +# print('Done setting attributes for Server Template: %s' % templateName); + + + cd('/Clusters/%s' % cluster_name) + create(cluster_name, 'DynamicServers') + cd('DynamicServers/%s' % cluster_name) + set('ServerTemplate', st1) + set('ServerNamePrefix', managed_server_name_base) + set('DynamicClusterSize', number_of_ms) + set('MaxDynamicClusterSize', number_of_ms) + set('CalculatedListenPorts', false) + + print('Done setting attributes for Dynamic Cluster: %s' % cluster_name); + +# Create a Data Source +# ====================== +#cd('/') +#print('Configuring a Data Source: %s' % dsname); +#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) +#create('myJdbcDriverParams','JDBCDriverParams') +#cd('JDBCDriverParams/NO_NAME_0') +#set('DriverName', dsdriver) +#set('URL', dsurl) +#set('PasswordEncrypted', dspassword) +#set('UseXADataSourceInterface', 'false') + +#print 'create JDBCDriverParams Properties' +#create('myProperties','Properties') +#cd('Properties/NO_NAME_0') +#create('user','Property') +#cd('Property/user') +#set('Value', dsusername) + +#cd('../../') +#create('databaseName','Property') +#cd('Property/databaseName') +#set('Value', dsdbname) + +#print 'create JDBCConnectionPoolParams' +#cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname) +#create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams') +#cd('JDBCConnectionPoolParams/NO_NAME_0') +#set('TestTableName','SQL SELECT 1 FROM DUAL') +#set('InitialCapacity',int(dsinitalcapacity)) + +#print('Done setting attributes for Data Source: %s' % dsname); + +# Assign +# ====== +# Uncomment to target and enable the data source for the cluster +# assign('JDBCSystemResource', dsname, 'Target', cluster_name) + +# Write Domain +# ============ +writeDomain(domain_path) +closeTemplate() +print 'Domain Created' + +# Update Domain +readDomain(domain_path) +cd('/') +if production_mode_enabled == "true": + cmo.setProductionModeEnabled(true) +else: + cmo.setProductionModeEnabled(false) +updateDomain() +closeDomain() +print 'Domain Updated' +print 'Done' + +# Exit WLST +# ========= +exit() diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/createWLSDomain.sh b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/createWLSDomain.sh new file mode 100755 index 0000000000000000000000000000000000000000..ec83e4babbb546629234b33e56f2f99934ca8de8 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/createWLSDomain.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +#Copyright (c) 2014-2018 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. + +#Define DOMAIN_HOME +echo "Domain Home is: " $DOMAIN_HOME + +# If AdminServer.log does not exists, container is starting for 1st time +# So it should start NM and also associate with AdminServer +# Otherwise, only start NM (container restarted) +########### SIGTERM handler ############ +function _term() { + echo "Stopping container." + echo "SIGTERM received, shutting down the server!" + ${DOMAIN_HOME}/bin/stopWebLogic.sh +} + +########### SIGKILL handler ############ +function _kill() { + echo "SIGKILL received, shutting down the server!" + kill -9 $childPID +} + +# Set SIGTERM handler +trap _term SIGTERM + +# Set SIGKILL handler +trap _kill SIGKILL + +#Loop determining state of WLS +function check_wls { + action=$1 + host=$2 + port=$3 + sleeptime=$4 + while true + do + sleep $sleeptime + if [ "$action" == "started" ]; then + started_url="http://$host:$port/weblogic/ready" + echo -e "Waiting for WebLogic server to get $action, checking $started_url" + status=`/usr/bin/curl -s -i $started_url | grep "200 OK"` + echo "Status:" $status + if [ ! -z "$status" ]; then + break + fi + elif [ "$action" == "shutdown" ]; then + shutdown_url="http://$host:$port" + echo -e "Waiting for WebLogic server to get $action, checking $shutdown_url" + status=`/usr/bin/curl -s -i $shutdown_url | grep "500 Can't connect"` + if [ ! -z "$status" ]; then + break + fi + fi + done + echo -e "WebLogic Server has $action" +} + + +ADD_DOMAIN=1 +if [ -f ${DOMAIN_HOME}/servers/${ADMIN_NAME}/logs/${ADMIN_NAME}.log ]; then + exit +fi + +# Create Domain only if 1st execution +DOMAIN_PROPERTIES_FILE=${PROPERTIES_FILE_DIR}/domain.properties +SEC_PROPERTIES_FILE=${PROPERTIES_FILE_DIR}/domain_security.properties +if [ ! -e "${SEC_PROPERTIES_FILE}" ]; then + echo "A properties file with the username and password needs to be supplied." + exit +fi + +# Get Username +USER=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep username | cut -d "=" -f2` +if [ -z "${USER}" ]; then + echo "The domain username is blank. The Admin username must be set in the properties file." + exit +fi +# Get Password +PASS=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep password | cut -d "=" -f2` +if [ -z "${PASS}" ]; then + echo "The domain password is blank. The Admin password must be set in the properties file." + exit +fi + +# Create domain +wlst.sh -skipWLSModuleScanning -loadProperties ${DOMAIN_PROPERTIES_FILE} -loadProperties ${SEC_PROPERTIES_FILE} /u01/oracle/create-wls-domain.py diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/setEnv.sh b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/setEnv.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b601e27d32d3ecefc10b3a12f80b3237e149dc8 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/setEnv.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +#Copyright (c) 2014-2018 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. + +BUILD_ARG='' +if [ "$#" -eq "0" ] + then + echo "A properties file with variable definitions should be supplied." + exit 1 + else + PROPERTIES_FILE=$1 + echo Export environment variables from the ${PROPERTIES_FILE} properties file + fi + +extract_env() { + env_value=`awk '{print $1}' $2 | grep ^$1= | cut -d "=" -f2` + if [ -n "$env_value" ]; then + env_arg=`echo "CUSTOM_$1=$env_value"` + echo " env_arg: $env_arg" + export $env_arg + fi +} + +set_env_arg(){ + extract_env $1 $2 + if [ -n "$env_arg" ]; then + BUILD_ARG="$BUILD_ARG --build-arg $env_arg" + fi +} + +# Set DOMAIN_NAME +set_env_arg DOMAIN_NAME ${PROPERTIES_FILE} + +# Set ADMIN_NAME +set_env_arg ADMIN_NAME ${PROPERTIES_FILE} + +# Set ADMIN_HOST +set_env_arg ADMIN_HOST ${PROPERTIES_FILE} + +# Set ADMIN_PORT +set_env_arg ADMIN_LISTEN_PORT ${PROPERTIES_FILE} + +# Set MANAGED_SERVER_PORT +set_env_arg MANAGEDSERVER_PORT ${PROPERTIES_FILE} + +# Set DEBUG_PORT +set_env_arg DEBUG_PORT ${PROPERTIES_FILE} + +# Set IMAGE_TAG +extract_env IMAGE_TAG ${PROPERTIES_FILE} + +# Set CLUSTER_NAME +set_env_arg CLUSTER_NAME ${PROPERTIES_FILE} + +export BUILD_ARG=$BUILD_ARG +echo BUILD_ARG=$BUILD_ARG diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/shutdown-servers.py b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/shutdown-servers.py new file mode 100644 index 0000000000000000000000000000000000000000..3b64cfdcc38a756b545df2ebd9a6368e03b08dc1 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/shutdown-servers.py @@ -0,0 +1,15 @@ +host = sys.argv[1] +port = sys.argv[2] +user_name = sys.argv[3] +password = sys.argv[4] +name = sys.argv[5] + +print('host : [%s]' % host); +print('port : [%s]' % port); +print('user_name : [%s]' % user_name); +print('password : ********'); +print('name : [%s]' % name); + +connect(user_name, password, 't3://' + host + ':' + port) +shutdown(name, 'Server', ignoreSessions='true') +exit() diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/startAdminServer.sh b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/startAdminServer.sh new file mode 100755 index 0000000000000000000000000000000000000000..3960f760070b559973ac695ffc64ab1822f19e92 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/startAdminServer.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# +#Copyright (c) 2014-2018 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. + +#Define DOMAIN_HOME +echo "Domain Home is: " $DOMAIN_HOME + +# If AdminServer.log does not exists, container is starting for 1st time +# So it should start NM and also associate with AdminServer +# Otherwise, only start NM (container restarted) +########### SIGTERM handler ############ +function _term() { + echo "Stopping container." + echo "SIGTERM received, shutting down the server!" + ${DOMAIN_HOME}/bin/stopWebLogic.sh +} + +########### SIGKILL handler ############ +function _kill() { + echo "SIGKILL received, shutting down the server!" + kill -9 $childPID +} + +# Set SIGTERM handler +trap _term SIGTERM + +# Set SIGKILL handler +trap _kill SIGKILL + +#Loop determining state of WLS +function check_wls { + action=$1 + host=$2 + port=$3 + sleeptime=$4 + while true + do + sleep $sleeptime + if [ "$action" == "started" ]; then + started_url="http://$host:$port/weblogic/ready" + echo -e "Waiting for WebLogic server to get $action, checking $started_url" + status=`/usr/bin/curl -s -i $started_url | grep "200 OK"` + echo "Status:" $status + if [ ! -z "$status" ]; then + break + fi + elif [ "$action" == "shutdown" ]; then + shutdown_url="http://$host:$port" + echo -e "Waiting for WebLogic server to get $action, checking $shutdown_url" + status=`/usr/bin/curl -s -i $shutdown_url | grep "500 Can't connect"` + if [ ! -z "$status" ]; then + break + fi + fi + done + echo -e "WebLogic Server has $action" +} + +export AS_HOME="${DOMAIN_HOME}/servers/${ADMIN_NAME}" +export AS_SECURITY="${AS_HOME}/security" + +if [ -f ${AS_HOME}/logs/${ADMIN_NAME}.log ]; then + exit +fi + +echo "Admin Server Home: ${AS_HOME}" +echo "Admin Server Security: ${AS_SECURITY}" + +SEC_PROPERTIES_FILE=${PROPERTIES_FILE_DIR}/security.properties +if [ ! -e "${SEC_PROPERTIES_FILE}" ]; then + echo "A security.properties file with the username and password needs to be supplied." + exit +fi + +# Get Username +USER=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep username | cut -d "=" -f2` +if [ -z "${USER}" ]; then + echo "The domain username is blank. The Admin username must be set in the properties file." + exit +fi +# Get Password +PASS=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep password | cut -d "=" -f2` +if [ -z "${PASS}" ]; then + echo "The domain password is blank. The Admin password must be set in the properties file." + exit +fi + +#Define Java Options +JAVA_OPTIONS=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep ^JAVA_OPTIONS= | cut -d "=" -f2` +if [ -z "${JAVA_OPTIONS}" ]; then + JAVA_OPTIONS="-Dweblogic.StdoutDebugEnabled=false" +fi +export JAVA_OPTIONS=${JAVA_OPTIONS} + +# Create domain +mkdir -p ${AS_SECURITY} +echo "username=${USER}" >> ${AS_SECURITY}/boot.properties +echo "password=${PASS}" >> ${AS_SECURITY}/boot.properties +${DOMAIN_HOME}/bin/setDomainEnv.sh + +#echo 'Running Admin Server in background' +${DOMAIN_HOME}/bin/startWebLogic.sh & + +#echo 'Waiting for Admin Server to reach RUNNING state' +check_wls "started" localhost ${ADMIN_PORT} 2 + +# tail the Admin Server Logs +tail -f ${AS_HOME}/logs/${ADMIN_NAME}.log & + +childPID=$! +wait $childPID diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/startManagedServer.sh b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/startManagedServer.sh new file mode 100755 index 0000000000000000000000000000000000000000..c6335cffe59b8722940eb1e29cc96e2500687a6c --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/startManagedServer.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. +# +# If log.nm does not exists, container is starting for 1st time +# So it should start NM and also associate with AdminServer, as well Managed Server +# Otherwise, only start NM (container is being restarted)o + +export MS_HOME="${DOMAIN_HOME}/servers/${MANAGED_SERV_NAME}" +export MS_SECURITY="${MS_HOME}/security" + +if [ -f ${MS_HOME}/logs/${MANAGED_SERV_NAME}.log ]; then + exit +fi + +# Wait for AdminServer to become available for any subsequent operation +/u01/oracle/waitForAdminServer.sh + +echo "Managed Server Name: ${MANAGED_SERV_NAME}" +echo "Managed Server Home: ${MS_HOME}" +echo "Managed Server Security: ${MS_SECURITY}" + +SEC_PROPERTIES_FILE=${PROPERTIES_FILE_DIR}/security.properties +if [ ! -e "${SEC_PROPERTIES_FILE}" ]; then + echo "A properties file with the username and password needs to be supplied." + exit +fi +# Get Username +USER=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep username | cut -d "=" -f2` +if [ -z "${USER}" ]; then + echo "The domain username is blank. The Admin username must be set in the properties file." + exit +fi +# Get Password +PASS=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep password | cut -d "=" -f2` +if [ -z "${PASS}" ]; then + echo "The domain password is blank. The Admin password must be set in the properties file." + exit +fi + +#Set Java Options +JAVA_OPTIONS=`awk '{print $1}' ${SEC_PROPERTIES_FILE} | grep ^JAVA_OPTIONS= | cut -d "=" -f2` +if [ -z "${JAVA_OPTIONS}" ]; then + JAVA_OPTIONS="-Dweblogic.StdoutDebugEnabled=false" +fi +export JAVA_OPTIONS=${JAVA_OPTIONS} +echo "Java Options: ${JAVA_OPTIONS}" + +# Create Managed Server +mkdir -p ${MS_SECURITY} +echo "username=${USER}" >> ${MS_SECURITY}/boot.properties +echo "password=${PASS}" >> ${MS_SECURITY}/boot.properties +${DOMAIN_HOME}/bin/setDomainEnv.sh + +# Start 'ManagedServer' +echo "Start Managed Server" +${DOMAIN_HOME}/bin/startManagedWebLogic.sh ${MANAGED_SERV_NAME} http://${ADMIN_HOST}:${ADMIN_PORT} + +# tail Managed Server log +tail -f ${MS_HOME}/logs/${MANAGED_SERV_NAME}.log & + +childPID=$! +wait $childPID diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/waitForAdminServer.sh b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/waitForAdminServer.sh new file mode 100755 index 0000000000000000000000000000000000000000..e95a65c5042a6f8f9cc84de0e6687f4f53dc70e9 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/waitForAdminServer.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +#Copyright (c) 2014-2018 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. +# +# This script will wait until Admin Server is available. +# There is no timeout! +# +echo "Waiting for WebLogic Admin Server on $ADMIN_HOST:$ADMIN_PORT to become available..." +while : +do + (echo > /dev/tcp/$ADMIN_HOST/$ADMIN_PORT) >/dev/null 2>&1 + available=$? + if [[ $available -eq 0 ]]; then + echo "WebLogic Admin Server is now available. Proceeding..." + break + fi + sleep 1 +done diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/wlst b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/wlst new file mode 100755 index 0000000000000000000000000000000000000000..29c0f89aa3228285d9c1a63907408447bfde35e0 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/container-scripts/wlst @@ -0,0 +1,6 @@ +#!/bin/sh +# +# This script will be in PATH and it will skip module scanning by default, making WLST calls much faster +# If you know what you are doing, call actual wlst.sh +# +wlst.sh -skipWLSModuleScanning $@ diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain.properties b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain.properties new file mode 100644 index 0000000000000000000000000000000000000000..a0a7049c629bce362c87c4a3dc499f458764966d --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain.properties @@ -0,0 +1,17 @@ +DOMAIN_NAME=domain1 +ADMIN_PORT=7001 +ADMIN_NAME=admin-server +ADMIN_HOST=wlsadmin +MANAGED_SERVER_PORT=8001 +MANAGED_SERVER_NAME_BASE=managed-server +CONFIGURED_MANAGED_SERVER_COUNT=2 +CLUSTER_NAME=cluster-1 +DEBUG_PORT=8453 +DB_PORT=1527 +DEBUG_FLAG=true +PRODUCTION_MODE_ENABLED=true +CLUSTER_TYPE=DYNAMIC +JAVA_OPTIONS=-Dweblogic.StdoutDebugEnabled=false +T3_CHANNEL_PORT=30012 +T3_PUBLIC_ADDRESS=kubernetes +IMAGE_TAG=domain-home-in-image:12.2.1.3 diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain_security.properties b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain_security.properties new file mode 100644 index 0000000000000000000000000000000000000000..ee2eecf41220207253a1176c65f36cb0d369e595 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain_security.properties @@ -0,0 +1,2 @@ +username=weblogic +password=Weblogic1 diff --git a/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-run/security.properties b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-run/security.properties new file mode 100644 index 0000000000000000000000000000000000000000..80e8e77e701b87183866132d30b9415d2e994c67 --- /dev/null +++ b/smp-docker/images/oracle/weblogic-12213-domain-home-in-image/properties/docker-run/security.properties @@ -0,0 +1,4 @@ +username=weblogic +password=Weblogic1 +JAVA_OPTIONS=-Dweblogic.StdoutDebugEnabled=false + diff --git a/smp-docker/images/tomcat-mysql/Dockerfile b/smp-docker/images/tomcat-mysql/Dockerfile new file mode 100755 index 0000000000000000000000000000000000000000..4cb7d1ab002b662ad0b1258aca8b28182f2cfd16 --- /dev/null +++ b/smp-docker/images/tomcat-mysql/Dockerfile @@ -0,0 +1,61 @@ +FROM ubuntu:18.04 +MAINTAINER Joze Rihtarsic + + +# Set the SMP_VERSION env variable \ +ENV SMP_HOME=/opt/smp \ + MYSQL_DRV_VERSION=5.1.46 \ + MYSQL_DRV_SHA1=9a3e63b387e376364211e96827bc27db8d7a92e9 \ + TOMCAT_MAJOR=8 \ + TOMCAT_VERSION=8.5.31 \ + TOMCAT_SHA512=51d8877782bc975b8c566263df7e55f383e617aa3c81ea2c219fed18e1f5d9e8233a92100de95b9a8df69ce5c0ad89a195d5b7e5647fcf9df26231870073a9cb \ + DB_SCHEMA=smp \ + DB_USER=smp \ + DB_USER_PASSWORD=smp \ + MYSQL_ROOT_PASSWORD=root + +# install utils, java, mysql \ +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + mysql-server \ + openjdk-8-jdk \ + curl \ + unzip \ + && rm -rf /var/lib/apt/lists/* \ +# set user + && addgroup mysql mysql \ +# download SMP, SMP setup, tomcat mysql driver + && mkdir -p $SMP_HOME \ + && cd $SMP_HOME \ + && curl -O https://repo1.maven.org/maven2/mysql/mysql-connector-java/$MYSQL_DRV_VERSION/mysql-connector-java-$MYSQL_DRV_VERSION.jar \ + && sha1sum mysql-connector-java-$MYSQL_DRV_VERSION.jar | grep $MYSQL_DRV_SHA1 \ + && curl -o tomcat.zip "https://archive.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.zip" \ + && sha512sum tomcat.zip | grep $TOMCAT_SHA512 \ + && unzip tomcat.zip \ + && mv mysql-connector-java-$MYSQL_DRV_VERSION.jar $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/lib/ \ + && rm tomcat.zip \ + && mkdir -p $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/ \ + && echo "export CLASSPATH=$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/bin/setenv.sh \ + && sed -i -e "s/<\/Context>/<Resource name=\"jdbc\/eDeliverySmpDs\" auth=\"Container\" type=\"javax.sql.DataSource\" maxTotal=\"100\" maxIdle=\"30\" maxWaitMillis=\"10000\" username=\"$DB_USER\" password=\"$DB_USER\" driverClassName=\"com.mysql.jdbc.Driver\" url=\"jdbc:mysql:\/\/localhost:3306\/$DB_SCHEMA\"\/><\/Context>/g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/conf/context.xml" \ + && sed -i -e "s/<Connector /<Connector URIEncoding=\"UTF-8\" /g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/conf/server.xml" \ + && echo "datasource.jndi=java:comp/env/jdbc/eDeliverySmpDs" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties + + +# copy application to image +ADD ./artefacts /tmp/artefacts + + +# install SMP + run unzip /tmp/artefacts/smp-setup.zip -d /tmp/ \ + && mv /tmp/artefacts/smp.war $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/webapps/ + +VOLUME ["/data"] + +COPY ./entrypoint.sh /sbin/entrypoint.sh +RUN chmod u+x /sbin/entrypoint.sh \ + && sed -i -e "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mysql.conf.d/mysqld.cnf + +EXPOSE 3306 8080 + +ENTRYPOINT ["/sbin/entrypoint.sh"] + diff --git a/smp-docker/images/tomcat-mysql/README.md b/smp-docker/images/tomcat-mysql/README.md new file mode 100755 index 0000000000000000000000000000000000000000..8ee7237977bffb5ce0e75d59d7faca53f699d340 --- /dev/null +++ b/smp-docker/images/tomcat-mysql/README.md @@ -0,0 +1,28 @@ +# Experiamental SMP docker image +Purpose of image is to help SMP and AP sofware developers to create development environment for localy testing Dynamic Discovery using SML and SMP. +Image uses latest version of eDelivery SMP setup on tomcat, mysql ubuntu + +# Image build + +docker build -t smp . + +# Run container based on smp image +docker run --name smp -it --rm -p [http-port]:8080 -v [local volume]:/data smp +example: +docker run --name smp --rm -it -p 8080:8080 -v /opt/dockerdata/smp:/data smp smp + +## SMP (param: -p 8080:8080 ) +url: http://localhost:8080/smp + +## MYSQL (param: -p 3306:3306) +Database client connection (for testing and debugging ) +url: jdbc:mysql://localhost:3306/smp +Username: smp +Password: smp + +## Volume (-v /opt/dockerdata/sml:/data) +Mysql database files and tomcat configuration (and logs) can be externalized for experimenting with different SMP settings. + + + + diff --git a/smp-docker/images/tomcat-mysql/entrypoint.sh b/smp-docker/images/tomcat-mysql/entrypoint.sh new file mode 100755 index 0000000000000000000000000000000000000000..d2cdd09f6a60c89690337b64b7b95c9c190f4797 --- /dev/null +++ b/smp-docker/images/tomcat-mysql/entrypoint.sh @@ -0,0 +1,117 @@ +#!/bin/sh + +#set -e + +# parameters +MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-"root"} +DB_USER=${DB_USER:-"smp"} +DB_USER_PASSWORD=${DB_USER_PASSWORD:-"secret123"} +DB_SCHEMA=${DB_SCHEMA:-"smp"} + +DATA_DIR=/data +MYSQL_DATA_DIR=${DATA_DIR}/mysql +TOMCAT_DIR=${DATA_DIR}/tomcat +TOMCAT_HOME=${SMP_HOME}/apache-tomcat-$TOMCAT_VERSION/ + + +if [ ! -d ${DATA_DIR} ]; then + mkdir -p ${DATA_DIR} +fi + +init_tomcat() { + echo "[INFO] init tomcat folders: $tfile" + if [ ! -d ${TOMCAT_DIR} ]; then + mkdir -p ${TOMCAT_DIR} + fi + + # move tomcat log folder to data folder + if [ ! -d ${TOMCAT_DIR}/logs ]; then + if [ ! -d ${TOMCAT_HOME}/logs ]; then + mkdir -p ${TOMCAT_DIR}/logs + else + mv ${TOMCAT_HOME}/logs ${TOMCAT_DIR}/ + rm -rf ${TOMCAT_HOME}/logs + fi + fi + rm -rf ${TOMCAT_HOME}/logs + ln -sf ${TOMCAT_DIR}/logs ${TOMCAT_HOME}/logs + + # move tomcat conf folder to data folder + if [ ! -d ${TOMCAT_DIR}/conf ]; then + mv ${TOMCAT_HOME}/conf ${TOMCAT_DIR}/ + fi + rm -rf ${TOMCAT_HOME}/conf + ln -sf ${TOMCAT_DIR}/conf ${TOMCAT_HOME}/conf + + # move smp conf folder to data folder + if [ ! -d ${TOMCAT_DIR}/smp ]; then + mv ${TOMCAT_HOME}/smp ${TOMCAT_DIR}/ + fi + rm -rf ${TOMCAT_HOME}/smp + ln -sf ${TOMCAT_DIR}/smp ${TOMCAT_HOME}/ + + # sed -i -e "s#jdbc:mysql://localhost:3306/smp#jdbc:mysql://localhost:3306/$DB_SCHEMA#g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties" +# sed -i -e "s#jdbc.user\s*=\s*smp#jdbc.user=$DB_USER#g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties" + ## sed -i -e "s#jdbc.password\s*=\s*secret123#jdbc.password=$DB_USER_PASSWORD#g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties" + # sed -i -e "s#/keystores/sample_signatures_keystore.jks#$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/sample_signatures_keystore.jks#g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties" + + +} + + +init_mysql() { + echo "[INFO] init database: $tfile" + if [ ! -d "/run/mysqld" ]; then + mkdir -p /run/mysqld + chown -R mysql:mysql /run/mysqld + fi + + if [ ! -d ${MYSQL_DATA_DIR} ]; then + mv /var/lib/mysql ${DATA_DIR} + fi + + rm -rf /var/lib/mysql + ln -sf ${MYSQL_DATA_DIR} /var/lib/mysql + chmod -R 0777 ${MYSQL_DATA_DIR} + chown -R mysql:mysql ${MYSQL_DATA_DIR} + echo '[INFO] start MySQL' + service mysql start + + if [ -d ${MYSQL_DATA_DIR}/${DB_SCHEMA} ]; then + echo '[INFO] MySQL ${DB_SCHEMA} already present, skipping creation' + else + echo "[INFO] MySQL ${DB_SCHEMA} not found, creating initial DBs" + + echo 'create smp database' + mysql -h localhost -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$MYSQL_ROOT_PASSWORD';drop schema if exists $DB_SCHEMA;DROP USER IF EXISTS $DB_USER; create schema $DB_SCHEMA;alter database $DB_SCHEMA charset=utf8; create user $DB_USER identified by '$DB_USER_PASSWORD';grant all on $DB_SCHEMA.* to $DB_USER;" + echo 'create smp database objects' + mysql -h localhost -u root --password=$MYSQL_ROOT_PASSWORD $DB_SCHEMA < "/tmp/smp-4.1.1-SNAPSHOT/database-scripts/mysql5innodb.ddl" + + if [ -f "/tmp/artefacts/mysql5innodb-init-data.sql" ] + then + echo "Use custom init script!." + mysql -h localhost -u root --password=$MYSQL_ROOT_PASSWORD $DB_SCHEMA < "/tmp/artefacts/mysql5innodb-init-data.sql" + else + echo "Use default init script!" + mysql -h localhost -u root --password=$MYSQL_ROOT_PASSWORD $DB_SCHEMA < "/tmp/artefacts/smp-4.1.1-SNAPSHOT/database-scripts/mysql5innodb-init-data.sql" + fi + + fi + + # start mysql + +} + +init_mysql +init_tomcat + + +echo '[INFO] start running domibus' +chmod u+x $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/bin/*.sh +cd $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/ +# run from this folder in order to be smp log in logs folder +exec ./bin/catalina.sh run + + + + diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/Dockerfile b/smp-docker/images/weblogic-12.2.1.3-smp/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7e227cf68f38acfa2cb7b2d933f6494de8ed5b30 --- /dev/null +++ b/smp-docker/images/weblogic-12.2.1.3-smp/Dockerfile @@ -0,0 +1,35 @@ +# LICENSE UPL 1.0 +# +# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. +# +# ORACLE DOCKERFILES PROJECT +# -------------------------- +# This Dockerfile extends the Oracle WebLogic image built under 12213-doma-home-in-image. +# +# It will deploy any package defined in APP_PKG_FILE. +# into the DOMAIN_HOME with name defined in APP_NAME +# +# HOW TO BUILD THIS IMAGE +# ----------------------- +# Run: +# $ docker build -t weblogic-sml . +# +# Pull base image +# --------------- +FROM oracle/12213-domain-home-in-image + +# Define variable +ARG SMP_VERSION +ENV APP_VERSION=$SMP_VERSION + + + +# Copy files and deploy application in WLST Offline mode +COPY container-scripts/* /u01/oracle/ +COPY smp.war /u01/oracle/ + +RUN /u01/oracle/deploySMPToDomain.sh && \ + wlst -loadProperties /u01/oracle/datasource.properties.oracle /u01/oracle/ds-deploy.py + +# Define default command to start bash. +CMD ["startAdminServer.sh"] diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/README.md b/smp-docker/images/weblogic-12.2.1.3-smp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..63dee32885e0c533bd2557238adea83e7b5b71ea --- /dev/null +++ b/smp-docker/images/weblogic-12.2.1.3-smp/README.md @@ -0,0 +1,45 @@ +Example of Image with WLS Domain +================================ +This Dockerfile extends the Oracle WebLogic image built under 12213-domain-home-in-image and deploy the sample application to the cluster. + +This sample deploys a simple, one-page web application contained in a ZIP archive. This archive needs to be built (one time only) before building the Docker image. + + $ ./build-archive.sh + +# How to build and run +To deploy an application to a domain where the domain home is inside the image you extend the image `12213-domain-home-in-image` and using WLST offline you deploy the sample application. First make sure you have built sample WebLogic domain image inside **12213-domain-home-in-image**. Now to build this sample, run: + + $ docker build --build-arg APPLICATION_NAME=sample --build-arg APPLICATION_PKG=archive.zip -t 12213-domain-with-app . + +# How to run the domain +Follow the instructions in the sample `OracleWebLogic/samples/12213-domain-home-in-image` to define your domain properties in the domain.properties and domain-security.properties files. + +To start the containerized Administration Server, run: + + $ docker run -d --name wlsadmin --hostname wlsadmin -p 7001:7001 \ + -v <HOST DIRECTORY TO PROPERTIES FILE>/properties/docker-run:/u01/oracle/properties \ + 12213-domain-with-app + +To start a containerized Managed Server (MS1) to self-register with the Administration Server above, run: + + $ docker run -d --name MS1 --link wlsadmin:wlsadmin -p 8001:8001 \ + -v <HOST DIRECTORY TO PROPERTIES FILE>/properties/docker-run:/u01/oracle/properties \ + -e MANAGED_SERV_NAME=managed-server1 12213-domain-with-app startManagedServer.sh + +To start a second Managed Server (MS2), run: + + $ docker run -d --name MS2 --link wlsadmin:wlsadmin -p 8002:8001 \ + -v <HOST DIRECTORY TO PROPERTIES FILE>/properties/docker-run:/u01/oracle/properties \ + -e MANAGED_SERV_NAME=managed-server2 12213-domain-with-app startManagedServer.sh + + +Run the WLS Administration Console: + +In your browser, enter `https://localhost:7001/console`. + +Run the sample application: + +To access the sample application, in your browser enter `http://localhost:7001/sample`. + +# Copyright +Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle new file mode 100644 index 0000000000000000000000000000000000000000..01c54656ac1547b23da86aa816587869aca97842 --- /dev/null +++ b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle @@ -0,0 +1,9 @@ +dsname=cipaeDeliveryDs +dsdbname=default;create=true +dsjndiname=jdbc/cipaeDeliveryDs +dsdriver=oracle.jdbc.OracleDriver +dsurl=jdbc:oracle:thin:@//database:1521/xe +dsusername=smp +dspassword=test +dstestquery=SQL ISVALID +dsmaxcapacity=1 diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh new file mode 100755 index 0000000000000000000000000000000000000000..02c87b20bb9e379558e83574e2ba511da6569b53 --- /dev/null +++ b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# + + +#Define DOMAIN_HOME +echo "Domain Home is: " $DOMAIN_HOME + + +if [ ! -d "$DOMAIN_HOME/classes" ]; then + mkdir -p "$DOMAIN_HOME/classes"; +fi + +if [ ! -d "$DOMAIN_HOME/bdmsl" ]; then + mkdir -p "$DOMAIN_HOME/bdmsl"; +fi + + +# create smp property file +echo "hibernate.dialect=org.hibernate.dialect.Oracle10gDialect" >> "$DOMAIN_HOME/classes/smp.config.properties" +echo "datasource.jndi=jdbc/cipaeDeliveryDs" >> "$DOMAIN_HOME/classes/smp.config.properties" +echo "log.folder=./logs/" >> "$DOMAIN_HOME/classes/smp.config.properties" +# create weblogic classpath to classes folder +echo "export CLASSPATH=\${CLASSPATH}:\${DOMAIN_HOME}/classes" >> "$DOMAIN_HOME/bin/setDomainEnv.sh" + + + +# Deploy Application +wlst.sh -skipWLSModuleScanning /u01/oracle/smp-app-deploy.py diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/ds-deploy.py b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/ds-deploy.py new file mode 100644 index 0000000000000000000000000000000000000000..5c53fcefc3046bbfceff7987c3ae2c91947d4871 --- /dev/null +++ b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/ds-deploy.py @@ -0,0 +1,68 @@ +# Copyright (c) 2018 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 = "cluster-1" +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) +create('myJdbcDriverParams','JDBCDriverParams') +cd('JDBCDriverParams/NO_NAME_0') +set('DriverName', dsdriver) +set('URL', dsurl) +set('PasswordEncrypted', dspassword) +set('UseXADataSourceInterface', 'false') + +print 'create JDBCDriverParams Properties' +create('myProperties','Properties') +cd('Properties/NO_NAME_0') +create('user','Property') +cd('Property/user') +set('Value', dsusername) + +cd('../../') +create('databaseName','Property') +cd('Property/databaseName') +set('Value', dsdbname) + +print 'create 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) +assign('JDBCSystemResource', dsname, 'Target', cluster_name) + +# Update Domain, Close It, Exit +# ========================== +updateDomain() +closeDomain() +exit() diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/smp-app-deploy.py b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/smp-app-deploy.py new file mode 100644 index 0000000000000000000000000000000000000000..778ed668524964fbb2296297dfa0f10d36fdbcbd --- /dev/null +++ b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/smp-app-deploy.py @@ -0,0 +1,50 @@ + # Copyright (c) 2019 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. +# + +# 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: Monica Riccelli <monica.riccelli@oracle.com> +# +import os + +# Deployment Information +domainhome = os.environ.get('DOMAIN_HOME', '/u01/oracle/user_projects/domains/base_domain') +admin_name = os.environ.get('ADMIN_NAME', 'AdminServer') +appVersion = os.environ.get('APP_VERSION', '4.0.0') +appfilename = os.environ.get('APP_FILE_NAME', 'smp') +appname = os.environ.get('APP_NAME', appfilename+'#'+appVersion) +appfile = os.environ.get('APP_FILE', 'smp.war') +appdir = os.environ.get('DOMAIN_HOME') +cluster_name = "cluster-1" + +print('Domain Home : [%s]' % domainhome); +print('Admin Name : [%s]' % admin_name); +print('Cluster Name : [%s]' % cluster_name); +print('Application Name : [%s]' % appname); +print('appfile : [%s]' % appfile); +print('appdir : [%s]' % appdir); +# Read Domain in Offline Mode +# =========================== +readDomain(domainhome) + +# Create Application +# ================== +cd('/') +app = create(appname, 'AppDeployment') +app.setSourcePath(appdir + '/' + appfile) +app.setStagingMode('nostage') + + +# Assign application to AdminServer +# ================================= +assign('AppDeployment', appname, 'Target', admin_name) +assign('AppDeployment', appname, 'Target', cluster_name) + +# Update Domain, Close It, Exit +# ========================== +updateDomain() +closeDomain() +exit() diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGenerator.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGenerator.java index 085a2694b3c9a213f12420dc3be91e08dcc26ddf..1c2d23683b34a9ec64061964a2bfd139df39a461 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGenerator.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGenerator.java @@ -1,5 +1,6 @@ package eu.europa.ec.edelivery.smp.data.dao.utils; +import com.google.common.io.Files; import eu.europa.ec.edelivery.smp.logging.SMPLogger; import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory; import org.apache.commons.lang3.StringUtils; @@ -11,8 +12,7 @@ import org.hibernate.mapping.Column; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.hibernate.tool.schema.TargetType; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.lang.reflect.Field; import java.util.*; @@ -24,9 +24,12 @@ import java.util.*; * @since 4.1 */ public class SMPSchemaGenerator { - private static String filenameTemplate = "%s-%s.ddl"; - private static String smpEntityPackageName = "eu.europa.ec.edelivery.smp.data.model"; - private static final SMPLogger LOG = SMPLoggerFactory.getLogger(SMPSchemaGenerator.class); + protected static String filenameTemplate = "%s.ddl"; + protected static String filenameDropTemplate = "%s-drop.ddl"; + protected static String smpEntityPackageName = "eu.europa.ec.edelivery.smp.data.model"; + private static final String SQL_MESSAGE ="-- ------------------------------------------------------------------------\n-- This file was generated by hibernate for SMP version %s.\n-- ------------------------------------------------------------------------\n\n"; + + protected static final SMPLogger LOG = SMPLoggerFactory.getLogger(SMPSchemaGenerator.class); public static void main(String[] args) throws IOException, ClassNotFoundException { @@ -53,14 +56,15 @@ public class SMPSchemaGenerator { * @param packageNames * @param version */ - public void createDDLScript(String exportFolder, String hibernateDialect, List<String> packageNames, String version) throws ClassNotFoundException { + public void createDDLScript(String exportFolder, String hibernateDialect, List<String> packageNames, String version) throws ClassNotFoundException, IOException { // create export file String sqlVer = version; int idx = version.indexOf("-SNAPSHOT"); if (idx > 0) { sqlVer = version.substring(0, idx); } - String filename = createFileName(hibernateDialect, sqlVer); + String filename = createFileName(hibernateDialect, filenameTemplate); + String filenameDrop = createFileName(hibernateDialect, filenameDropTemplate); String dialect = getDialect(hibernateDialect); @@ -96,6 +100,10 @@ public class SMPSchemaGenerator { if (file.delete()) { // delete if exists LOG.info("File {} deleted!", file.getAbsolutePath()); } ; + File fileDrop = new File(exportFolder, filenameDrop); + if (fileDrop.delete()) { // delete if exists + LOG.info("File {} deleted!", file.getAbsolutePath()); + } ; export.setOutputFile(file.getAbsolutePath()); export.setFormat(true); export.setDelimiter(";"); @@ -103,6 +111,15 @@ public class SMPSchemaGenerator { //can change the output here EnumSet<TargetType> enumSet = EnumSet.of(TargetType.SCRIPT); export.execute(enumSet, SchemaExport.Action.CREATE, metadataImplementor); + + // prepend comment to file with version + prependComment(file, String.format(SQL_MESSAGE, version)); + + // create drop script + export.setOutputFile(fileDrop.getAbsolutePath()); + export.execute(enumSet, SchemaExport.Action.DROP, metadataImplementor); + prependComment(fileDrop, String.format(SQL_MESSAGE, version)); + } @@ -121,12 +138,12 @@ public class SMPSchemaGenerator { * Method creates filename based on dialect and version * * @param dialect - * @param version + * @param template * @return file name. */ - public String createFileName(String dialect, String version) { + public String createFileName(String dialect, String template) { String dbName = dialect.substring(dialect.lastIndexOf('.') + 1, dialect.lastIndexOf("Dialect")).toLowerCase(); - return String.format(filenameTemplate, dbName, version); + return String.format(template, dbName); } /** @@ -175,4 +192,25 @@ public class SMPSchemaGenerator { return classes; } + public static void prependComment(File input, String prefix) throws IOException { + + File mFile = File.createTempFile("prependPrefix", ".tmp"); + try( FileInputStream fis = new FileInputStream(input); FileOutputStream fos = new FileOutputStream(mFile)){ + // write first line + fos.write(prefix.getBytes()); + byte[] buffer = new byte[1024]; + + int nRead = 0; + while((nRead = fis.read(buffer)) != -1) { + + fos.write(buffer,0, nRead); + } + fos.flush(); + } + + + input.delete(); + Files.move(mFile, input); + } + } diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGeneratorTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGeneratorTest.java index f04ed2dc495506362ddb99661dccc80c0b00fbd8..19a918f22102fcd77c61c4ad220bba93aeae1b27 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGeneratorTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/utils/SMPSchemaGeneratorTest.java @@ -9,6 +9,7 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import java.io.File; +import java.io.IOException; import java.util.Collections; import java.util.List; @@ -22,6 +23,7 @@ public class SMPSchemaGeneratorTest { private static final String DIALECT_MYSQL_INNO5="org.hibernate.dialect.MySQL5InnoDBDialect"; private static final String ENTITY_PACKAGE= "eu.europa.ec.edelivery.smp.data.model"; + private static final Object[] dialectTestCases() { return new Object[][]{ {DIALECT_MYSQL_INNO5, "eu.europa.ec.edelivery.smp.data.dao.utils.SMPMySQL5InnoDBDialect"}, @@ -40,45 +42,64 @@ public class SMPSchemaGeneratorTest { @Test - public void createDDLScript() throws ClassNotFoundException { + public void createDDLScript() throws ClassNotFoundException, IOException { // given String folder = "target"; String dialect = DIALECT_ORACLE; String version = "4.1.0-SNAPSHOT"; List<String> lstPackages = Collections.singletonList(ENTITY_PACKAGE); - File f = new File("target/oracle10g-4.1.0.ddl"); + File f = new File("target/oracle10g.ddl"); + File fDrop = new File("target/oracle10g-drop.ddl"); f.delete(); // delete if exists + fDrop.delete(); // delete if exists assertTrue(!f.exists()); + assertTrue(!fDrop.exists()); testInstance.createDDLScript(folder, dialect, lstPackages, version); assertTrue(f.exists()); assertTrue(f.length()>0); + assertTrue(fDrop.exists()); + assertTrue(fDrop.length()>0); } @Test public void createFileNameOracleDialect() { - // given String dialect = DIALECT_ORACLE; - String version = "4.1.0"; - //when - String filaName = testInstance.createFileName(dialect, version); + String filaName = testInstance.createFileName(dialect, SMPSchemaGenerator.filenameTemplate); // then - assertEquals("oracle10g-4.1.0.ddl", filaName); + assertEquals("oracle10g.ddl", filaName); } @Test public void createFileNameMySQLDialect() { // given String dialect = DIALECT_MYSQL_INNO5; - String version = "4.1.0"; + //when + String fileName = testInstance.createFileName(dialect, SMPSchemaGenerator.filenameTemplate); + // then + assertEquals("mysql5innodb.ddl", fileName); + } + @Test + public void createDropFileNameOracleDialect() { + String dialect = DIALECT_ORACLE; + //when + String fileName = testInstance.createFileName(dialect, SMPSchemaGenerator.filenameDropTemplate); + // then + assertEquals("oracle10g-drop.ddl", fileName); + } + + @Test + public void createDropFileNameMySQLDialect() { + // given + String dialect = DIALECT_MYSQL_INNO5; //when - String filaName = testInstance.createFileName(dialect, version); + String fileName = testInstance.createFileName(dialect, SMPSchemaGenerator.filenameDropTemplate); // then - assertEquals("mysql5innodb-4.1.0.ddl", filaName); + assertEquals("mysql5innodb-drop.ddl", fileName); } @Test diff --git a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.0.0.ddl b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.0.0.ddl deleted file mode 100644 index d90768e68f545a75affa33e81c4c68e119e0937e..0000000000000000000000000000000000000000 --- a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.0.0.ddl +++ /dev/null @@ -1,171 +0,0 @@ --- Copyright 2018 European Commission | CEF eDelivery --- --- Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence"); --- You may not use this work except in compliance with the Licence. --- --- You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf --- --- Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the Licence for the specific language governing permissions and limitations under the Licence. - -CREATE TABLE smp_domain ( - domainId VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - bdmslClientCertHeader VARCHAR(4000) - CHARACTER SET utf8 - COLLATE utf8_bin NULL, - bdmslClientCertAlias VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NULL, - bdmslSmpId VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - signatureCertAlias VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NULL, - PRIMARY KEY(domainId) -) - ENGINE = InnoDB - DEFAULT CHARSET = utf8; - - -CREATE TABLE smp_service_group ( - businessIdentifier VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - businessIdentifierScheme VARCHAR(100) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - domainId VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL - DEFAULT 'domain1', - xmlContent TEXT NULL DEFAULT NULL, - PRIMARY KEY (businessIdentifier, businessIdentifierScheme), - CONSTRAINT FK_srv_group_domain FOREIGN KEY (domainId) - REFERENCES smp_domain (domainId) -) - ENGINE = InnoDB - DEFAULT CHARSET = utf8; - - -CREATE TABLE smp_service_metadata ( - documentIdentifier VARCHAR(500) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - documentIdentifierScheme VARCHAR(100) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - businessIdentifier VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - businessIdentifierScheme VARCHAR(100) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - xmlcontent TEXT, - PRIMARY KEY (documentIdentifier, documentIdentifierScheme, businessIdentifier, businessIdentifierScheme), - KEY FK_service_metadata_service_group (businessIdentifier, businessIdentifierScheme), - CONSTRAINT FK_service_metadata_service_group FOREIGN KEY (businessIdentifier, businessIdentifierScheme) REFERENCES smp_service_group (businessIdentifier, businessIdentifierScheme) - ON DELETE CASCADE - ON UPDATE CASCADE -) - ENGINE = InnoDB - DEFAULT CHARSET = utf8; - - -CREATE TABLE smp_user ( - username VARCHAR(256) NOT NULL, - password VARCHAR(256), - isadmin TINYINT(1) DEFAULT 0 NOT NULL, - PRIMARY KEY (username) -) - ENGINE = InnoDB - DEFAULT CHARSET = utf8; - - -CREATE TABLE smp_ownership ( - username VARCHAR(256) NOT NULL, - businessIdentifier VARCHAR(50) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - businessIdentifierScheme VARCHAR(100) - CHARACTER SET utf8 - COLLATE utf8_bin NOT NULL, - KEY FK_ownership_service_group (businessIdentifier, businessIdentifierScheme), - KEY FK_ownership_user (username), - CONSTRAINT FK_ownership_service_group FOREIGN KEY (businessIdentifier, businessIdentifierScheme) REFERENCES smp_service_group (businessIdentifier, businessIdentifierScheme) - ON DELETE CASCADE - ON UPDATE CASCADE, - CONSTRAINT FK_ownership_user FOREIGN KEY (username) REFERENCES smp_user (username) - ON DELETE CASCADE - ON UPDATE CASCADE -) - ENGINE = InnoDB - DEFAULT CHARSET = utf8; - - - -DELIMITER // - -DROP PROCEDURE IF EXISTS validate_new_user // -CREATE PROCEDURE validate_new_user (IN new_user_is_admin TINYINT(1)) -BEGIN - IF new_user_is_admin <> 0 AND new_user_is_admin <> 1 - THEN - SIGNAL SQLSTATE '99999' - SET MESSAGE_TEXT = '0 or 1 are the only allowed values for ISADMIN column'; - END IF; - END // - -DROP PROCEDURE IF EXISTS validate_new_domain // -CREATE PROCEDURE validate_new_domain (IN new_bdmsl_client_cert_alias varchar(50), IN new_bdmsl_client_cert_header varchar(4000)) -BEGIN - IF ((new_bdmsl_client_cert_alias > '' OR new_bdmsl_client_cert_alias = null) AND (new_bdmsl_client_cert_header > '' OR new_bdmsl_client_cert_header = null)) - THEN - SIGNAL SQLSTATE '99999' - SET MESSAGE_TEXT = 'Both BDMSL authentication ways cannot be switched ON at the same time: bdmslClientCertAlias and bdmslClientCertHeader'; - END IF; - END // - - -DROP TRIGGER IF EXISTS smp_domain_check_bdmsl_auth_before_insert // -DROP TRIGGER IF EXISTS smp_domain_check_bdmsl_auth_before_update // -CREATE TRIGGER smp_domain_check_bdmsl_auth_before_update -BEFORE UPDATE ON smp_domain -FOR EACH ROW - BEGIN - call validate_new_domain(NEW.bdmslClientCertAlias, NEW.bdmslClientCertHeader); - END // -CREATE TRIGGER smp_domain_check_bdmsl_auth_before_insert -BEFORE INSERT ON smp_domain -FOR EACH ROW - BEGIN - call validate_new_domain(NEW.bdmslClientCertAlias, NEW.bdmslClientCertHeader); - END // - - -DROP TRIGGER IF EXISTS smp_user_check_is_admin_value_before_insert // -DROP TRIGGER IF EXISTS smp_user_check_is_admin_value_before_update // - -CREATE TRIGGER smp_user_check_is_admin_value_before_insert -BEFORE INSERT ON smp_user -FOR EACH ROW - BEGIN - call validate_new_user(NEW.ISADMIN); - END // -CREATE TRIGGER smp_user_check_is_admin_value_before_update -BEFORE UPDATE ON smp_user -FOR EACH ROW - BEGIN - call validate_new_user(NEW.ISADMIN); - END // - -DELIMITER ; - - - -INSERT INTO smp_domain(domainId, bdmslSmpId) VALUES('domain1', 'DEFAULT-SMP-ID'); --- default admin user with password "changeit" -INSERT INTO smp_user(username, password, isadmin) VALUES ('smp_admin', '$2a$10$SZXMo7K/wA.ULWxH7uximOxeNk4mf3zU6nxJx/2VfKA19QlqwSpNO', '1'); - -commit; \ No newline at end of file diff --git a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl new file mode 100644 index 0000000000000000000000000000000000000000..a29274ce9dbb4da5aafff067dffc19909791ff89 --- /dev/null +++ b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl @@ -0,0 +1,124 @@ +-- ------------------------------------------------------------------------ +-- This file was generated by hibernate for SMP version 4.1.1-SNAPSHOT. +-- ------------------------------------------------------------------------ + + + alter table SMP_CERTIFICATE + drop + foreign key FKayqgpj5ot3o8vrpduul7sstta; + + alter table SMP_CERTIFICATE_AUD + drop + foreign key FKnrwm8en8vv10li8ihwnurwd9e; + + alter table SMP_DOMAIN_AUD + drop + foreign key FK35qm8xmi74kfenugeonijodsg; + + alter table SMP_OWNERSHIP + drop + foreign key FKrnqwq06lbfwciup4rj8nvjpmy; + + alter table SMP_OWNERSHIP + drop + foreign key FKgexq5n6ftsid8ehqljvjh8p4i; + + alter table SMP_OWNERSHIP_AUD + drop + foreign key FK1lqynlbk8ow1ouxetf5wybk3k; + + alter table SMP_SERVICE_GROUP_AUD + drop + foreign key FKj3caimhegwyav1scpwrxoslef; + + alter table SMP_SERVICE_GROUP_DOMAIN + drop + foreign key FKo186xtefda6avl5p1tuqchp3n; + + alter table SMP_SERVICE_GROUP_DOMAIN + drop + foreign key FKgcvhnk2n34d3c6jhni5l3s3x3; + + alter table SMP_SERVICE_GROUP_DOMAIN_AUD + drop + foreign key FK6uc9r0eqw16baooxtmqjkih0j; + + alter table SMP_SERVICE_METADATA + drop + foreign key FKfvcml6b8x7kn80m30h8pxs7jl; + + alter table SMP_SERVICE_METADATA_AUD + drop + foreign key FKbqr9pdnik1qxx2hi0xn4n7f61; + + alter table SMP_SERVICE_METADATA_XML + drop + foreign key FK4b1x06xlavcgbjnuilgksi7nm; + + alter table SMP_SERVICE_METADATA_XML_AUD + drop + foreign key FKevatmlvvwoxfnjxkvmokkencb; + + alter table SMP_SG_EXTENSION + drop + foreign key FKtf0mfonugp2jbkqo2o142chib; + + alter table SMP_SG_EXTENSION_AUD + drop + foreign key FKmdo9v2422adwyebvl34qa3ap6; + + alter table SMP_USER_AUD + drop + foreign key FK2786r5minnkai3d22b191iiiq; + + drop table if exists SMP_CERTIFICATE; + + drop table if exists SMP_CERTIFICATE_AUD; + + drop table if exists SMP_CONFIGURATION; + + drop table if exists SMP_DOMAIN; + + drop table if exists SMP_DOMAIN_AUD; + + drop table if exists SMP_DOMAIN_SEQ; + + drop table if exists SMP_OWNERSHIP; + + drop table if exists SMP_OWNERSHIP_AUD; + + drop table if exists SMP_REV_INFO; + + drop table if exists SMP_REVISION_SEQ; + + drop table if exists SMP_SERVICE_GROUP; + + drop table if exists SMP_SERVICE_GROUP_AUD; + + drop table if exists SMP_SERVICE_GROUP_DOMAIN; + + drop table if exists SMP_SERVICE_GROUP_DOMAIN_AUD; + + drop table if exists SMP_SERVICE_GROUP_DOMAIN_SEQ; + + drop table if exists SMP_SERVICE_GROUP_SEQ; + + drop table if exists SMP_SERVICE_METADATA; + + drop table if exists SMP_SERVICE_METADATA_AUD; + + drop table if exists SMP_SERVICE_METADATA_SEQ; + + drop table if exists SMP_SERVICE_METADATA_XML; + + drop table if exists SMP_SERVICE_METADATA_XML_AUD; + + drop table if exists SMP_SG_EXTENSION; + + drop table if exists SMP_SG_EXTENSION_AUD; + + drop table if exists SMP_USER; + + drop table if exists SMP_USER_AUD; + + drop table if exists SMP_USER_SEQ; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0.ddl b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl similarity index 71% rename from smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0.ddl rename to smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl index ce1c1ec0ba5f4bcfc08ebd0990d4762764024263..b1af7e26be383b6d936ff3eafee2b9487164f0d2 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl @@ -1,45 +1,64 @@ +-- ------------------------------------------------------------------------ +-- This file was generated by hibernate for SMP version 4.1.1-SNAPSHOT. +-- ------------------------------------------------------------------------ + create table SMP_CERTIFICATE ( - ID bigint not null, - CERTIFICATE_ID varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, + ID bigint not null comment 'Shared primary key with master table SMP_USER', + CERTIFICATE_ID varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin comment 'Formatted Certificate id using tags: cn, o, c:serialNumber', CREATED_ON datetime not null, - issuer varchar(512) CHARACTER SET utf8 COLLATE utf8_bin, + CRL_URL varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin comment 'URL to the certificate revocation list (CRL)', + ISSUER varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin comment 'Certificate issuer (canonical form)', LAST_UPDATED_ON datetime not null, - serialNumber varchar(128) CHARACTER SET utf8 COLLATE utf8_bin, - subject varchar(512) CHARACTER SET utf8 COLLATE utf8_bin, - VALID_FROM datetime, - VALID_TO datetime, + PEM_ENCODED_CERT longtext comment 'PEM encoded certificate', + SERIALNUMBER varchar(128) CHARACTER SET utf8 COLLATE utf8_bin comment 'Certificate serial number', + SUBJECT varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin comment 'Certificate subject (canonical form)', + VALID_FROM datetime comment 'Certificate valid from date.', + VALID_TO datetime comment 'Certificate valid to date.', primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='SMP user certificates' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_CERTIFICATE_AUD ( ID bigint not null, REV bigint not null, REVTYPE tinyint, - CERTIFICATE_ID varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, + CERTIFICATE_ID varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin, CREATED_ON datetime, - issuer varchar(512) CHARACTER SET utf8 COLLATE utf8_bin, + CRL_URL varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, + ISSUER varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin, LAST_UPDATED_ON datetime, - serialNumber varchar(128) CHARACTER SET utf8 COLLATE utf8_bin, - subject varchar(512) CHARACTER SET utf8 COLLATE utf8_bin, + PEM_ENCODED_CERT longtext, + SERIALNUMBER varchar(128) CHARACTER SET utf8 COLLATE utf8_bin, + SUBJECT varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin, VALID_FROM datetime, VALID_TO datetime, primary key (ID, REV) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + create table SMP_CONFIGURATION ( + PROPERTY varchar(512) CHARACTER SET utf8 COLLATE utf8_bin not null comment 'Property name/key', + CREATED_ON datetime not null comment 'Row inserted on date', + DESCRIPTION varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin comment 'Property description', + LAST_UPDATED_ON datetime not null comment 'Row modified on date', + VALUE varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin comment 'Property value', + primary key (PROPERTY) + ) comment='SMP user certificates' ENGINE=InnoDB DEFAULT CHARSET=utf8; + create table SMP_DOMAIN ( - ID bigint not null, + ID bigint not null comment 'Unique domain id', CREATED_ON datetime not null, - DOMAIN_CODE varchar(256) CHARACTER SET utf8 COLLATE utf8_bin not null, + DOMAIN_CODE varchar(256) CHARACTER SET utf8 COLLATE utf8_bin not null comment 'Domain code used as http parameter in rest webservices', LAST_UPDATED_ON datetime not null, - SIGNATURE_KEY_ALIAS varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, - SML_CLIENT_CERT_HEADER varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, - SML_CLIENT_KEY_ALIAS varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, - SML_PARTC_IDENT_REGEXP varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, - SML_SMP_ID varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, - SML_SUBDOMAIN varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, + SIGNATURE_KEY_ALIAS varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'Signature key alias used for SML integration', + SML_BLUE_COAT_AUTH bit not null comment 'Flag for SML authentication type - use CLientCert header or HTTPS ClientCertificate (key)', + SML_CLIENT_CERT_HEADER varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin comment 'Client-Cert header used behind RP - BlueCoat for SML integration', + SML_CLIENT_KEY_ALIAS varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'Client key alias used for SML integration', + SML_PARTC_IDENT_REGEXP varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin comment 'Reqular expresion for participant ids', + SML_REGISTERED bit not null comment 'Flag for: Is domain registered in SML', + SML_SMP_ID varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'SMP ID used for SML integration', + SML_SUBDOMAIN varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'SML subdomain', primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='SMP can handle multiple domains. This table contains domain specific data' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_DOMAIN_AUD ( ID bigint not null, @@ -49,9 +68,11 @@ DOMAIN_CODE varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, LAST_UPDATED_ON datetime, SIGNATURE_KEY_ALIAS varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, + SML_BLUE_COAT_AUTH bit, SML_CLIENT_CERT_HEADER varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, SML_CLIENT_KEY_ALIAS varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, SML_PARTC_IDENT_REGEXP varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin, + SML_REGISTERED bit, SML_SMP_ID varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, SML_SUBDOMAIN varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, primary key (ID, REV) @@ -92,13 +113,13 @@ insert into SMP_REVISION_SEQ values ( 1 ); create table SMP_SERVICE_GROUP ( - ID bigint not null, + ID bigint not null comment 'Unique Servicegroup id', CREATED_ON datetime not null, LAST_UPDATED_ON datetime not null, PARTICIPANT_IDENTIFIER varchar(256) CHARACTER SET utf8 COLLATE utf8_bin not null, PARTICIPANT_SCHEME varchar(256) CHARACTER SET utf8 COLLATE utf8_bin not null, primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='Service group data - Identifier and scheme' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_SERVICE_GROUP_AUD ( ID bigint not null, @@ -115,7 +136,7 @@ ID bigint not null, CREATED_ON datetime not null, LAST_UPDATED_ON datetime not null, - SML_REGISTRED bit not null, + SML_REGISTERED bit not null, FK_DOMAIN_ID bigint, FK_SG_ID bigint, primary key (ID) @@ -127,7 +148,7 @@ REVTYPE tinyint, CREATED_ON datetime, LAST_UPDATED_ON datetime, - SML_REGISTRED bit, + SML_REGISTERED bit, FK_DOMAIN_ID bigint, FK_SG_ID bigint, primary key (ID, REV) @@ -146,14 +167,14 @@ insert into SMP_SERVICE_GROUP_SEQ values ( 1 ); create table SMP_SERVICE_METADATA ( - ID bigint not null, + ID bigint not null comment 'Shared primary key with master table SMP_SERVICE_METADATA', CREATED_ON datetime not null, DOCUMENT_IDENTIFIER varchar(500) CHARACTER SET utf8 COLLATE utf8_bin not null, DOCUMENT_SCHEME varchar(500) CHARACTER SET utf8 COLLATE utf8_bin, LAST_UPDATED_ON datetime not null, FK_SG_DOM_ID bigint not null, primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='Service metadata' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_SERVICE_METADATA_AUD ( ID bigint not null, @@ -177,9 +198,9 @@ ID bigint not null, CREATED_ON datetime not null, LAST_UPDATED_ON datetime not null, - XML_CONTENT longblob, + XML_CONTENT longblob comment 'XML service metadata ', primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='Service group metadata xml blob' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_SERVICE_METADATA_XML_AUD ( ID bigint not null, @@ -194,10 +215,10 @@ create table SMP_SG_EXTENSION ( ID bigint not null, CREATED_ON datetime not null, - EXTENSION longblob, + EXTENSION longblob comment 'XML extension(s) for servicegroup ', LAST_UPDATED_ON datetime not null, primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='Service group extension blob' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_SG_EXTENSION_AUD ( ID bigint not null, @@ -210,17 +231,17 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_USER ( - ID bigint not null, - ACTIVE bit not null, + ID bigint not null comment 'Unique user id', + ACTIVE bit not null comment 'Is user active', CREATED_ON datetime not null, - EMAIL varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, + EMAIL varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'User email', LAST_UPDATED_ON datetime not null, - PASSWORD varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, - PASSWORD_CHANGED datetime, - ROLE varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, - USERNAME varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, + PASSWORD varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'BCrypted password for username/password login', + PASSWORD_CHANGED datetime comment 'Last date when password was changed', + ROLE varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'User role', + USERNAME varchar(256) CHARACTER SET utf8 COLLATE utf8_bin comment 'Login username', primary key (ID) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + ) comment='SMP can handle multiple domains. This table contains domain specific data' ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_USER_AUD ( ID bigint not null, diff --git a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.0.0.ddl b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.0.0.ddl deleted file mode 100644 index edf0167142539ff6fbf003a321bee05cceecf418..0000000000000000000000000000000000000000 --- a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.0.0.ddl +++ /dev/null @@ -1,77 +0,0 @@ --- --- Copyright 2018 European Commission | CEF eDelivery --- --- Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence"); --- You may not use this work except in compliance with the Licence. --- --- You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf --- --- Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the Licence for the specific language governing permissions and limitations under the Licence. - -CREATE TABLE smp_domain ( - domainId VARCHAR(50), - bdmslClientCertHeader VARCHAR(4000), - bdmslClientCertAlias VARCHAR(50), - bdmslSmpId VARCHAR(50) NOT NULL, - signatureCertAlias VARCHAR(50), - PRIMARY KEY(domainId), - CONSTRAINT check_max_one_auth CHECK ( - NOT (bdmslClientCertAlias IS NOT NULL AND bdmslClientCertHeader IS NOT NULL) - ) -); - -CREATE TABLE smp_service_group ( - extension CLOB, - businessIdentifier VARCHAR(50) NOT NULL, - businessIdentifierScheme VARCHAR(100) NOT NULL, - domainId VARCHAR(50) DEFAULT 'domain1' NOT NULL, - PRIMARY KEY (businessIdentifier, businessIdentifierScheme), - CONSTRAINT - FK_srv_group_domain FOREIGN KEY (domainId) - REFERENCES smp_domain (domainId) -); - -CREATE TABLE smp_service_metadata ( - documentIdentifierScheme VARCHAR(100) NOT NULL, - businessIdentifier VARCHAR(50) NOT NULL, - businessIdentifierScheme VARCHAR(100) NOT NULL, - documentIdentifier VARCHAR(500) NOT NULL, - xmlcontent CLOB, - PRIMARY KEY ( - documentIdentifierScheme, - businessIdentifier, - businessIdentifierScheme, - documentIdentifier), - CONSTRAINT - FK_srv_metadata_srv_group FOREIGN KEY ( - businessIdentifier, businessIdentifierScheme) - REFERENCES smp_service_group (businessIdentifier, businessIdentifierScheme) -); - -CREATE TABLE smp_user ( - username VARCHAR(256), - password VARCHAR(256), - isadmin NUMBER(1) DEFAULT 0 NOT NULL, - PRIMARY KEY (username), - CONSTRAINT check_is_admin_value CHECK (isadmin = 0 OR isadmin = 1) -); - -CREATE TABLE smp_ownership ( - username VARCHAR(256) NOT NULL, - businessIdentifier VARCHAR(50) NOT NULL, - businessIdentifierScheme VARCHAR(100) NOT NULL, - PRIMARY KEY (username, businessIdentifier, businessIdentifierScheme), - CONSTRAINT FK_ownership_user FOREIGN KEY (username) REFERENCES smp_user (username), - CONSTRAINT FK_ownership_service_group FOREIGN KEY ( - businessIdentifier, businessIdentifierScheme) - REFERENCES smp_service_group (businessIdentifier, businessIdentifierScheme) -); - - -INSERT INTO smp_domain(domainId, bdmslSmpId) VALUES('domain1', 'DEFAULT-SMP-ID'); --- default admin user with password "changeit" -INSERT INTO smp_user(username, password, isadmin) VALUES ('smp_admin', '$2a$10$SZXMo7K/wA.ULWxH7uximOxeNk4mf3zU6nxJx/2VfKA19QlqwSpNO', '1'); - -commit; \ No newline at end of file diff --git a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl new file mode 100644 index 0000000000000000000000000000000000000000..82847edd4d27f9a35e67db88d3dce9963f01b0ce --- /dev/null +++ b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl @@ -0,0 +1,56 @@ +-- ------------------------------------------------------------------------ +-- This file was generated by hibernate for SMP version 4.1.1-SNAPSHOT. +-- ------------------------------------------------------------------------ + + + drop table SMP_CERTIFICATE cascade constraints; + + drop table SMP_CERTIFICATE_AUD cascade constraints; + + drop table SMP_CONFIGURATION cascade constraints; + + drop table SMP_DOMAIN cascade constraints; + + drop table SMP_DOMAIN_AUD cascade constraints; + + drop table SMP_OWNERSHIP cascade constraints; + + drop table SMP_OWNERSHIP_AUD cascade constraints; + + drop table SMP_REV_INFO cascade constraints; + + drop table SMP_SERVICE_GROUP cascade constraints; + + drop table SMP_SERVICE_GROUP_AUD cascade constraints; + + drop table SMP_SERVICE_GROUP_DOMAIN cascade constraints; + + drop table SMP_SERVICE_GROUP_DOMAIN_AUD cascade constraints; + + drop table SMP_SERVICE_METADATA cascade constraints; + + drop table SMP_SERVICE_METADATA_AUD cascade constraints; + + drop table SMP_SERVICE_METADATA_XML cascade constraints; + + drop table SMP_SERVICE_METADATA_XML_AUD cascade constraints; + + drop table SMP_SG_EXTENSION cascade constraints; + + drop table SMP_SG_EXTENSION_AUD cascade constraints; + + drop table SMP_USER cascade constraints; + + drop table SMP_USER_AUD cascade constraints; + + drop sequence SMP_DOMAIN_SEQ; + + drop sequence SMP_REVISION_SEQ; + + drop sequence SMP_SERVICE_GROUP_DOMAIN_SEQ; + + drop sequence SMP_SERVICE_GROUP_SEQ; + + drop sequence SMP_SERVICE_METADATA_SEQ; + + drop sequence SMP_USER_SEQ; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0.ddl b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl similarity index 64% rename from smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0.ddl rename to smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl index 89868bbda8b0fa24e7858b79fc71cad069633581..d033109dcefcf6862c03f3028c5e7c66cdd17be4 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl @@ -1,52 +1,152 @@ +-- ------------------------------------------------------------------------ +-- This file was generated by hibernate for SMP version 4.1.1-SNAPSHOT. +-- ------------------------------------------------------------------------ + create sequence SMP_DOMAIN_SEQ start with 1 increment by 1; create sequence SMP_REVISION_SEQ start with 1 increment by 1; -create sequence SMP_SERVICE_GROUP_DOMAIN_SEQ start with 1 increment by 50; -create sequence SMP_SERVICE_GROUP_SEQ start with 1 increment by 50; -create sequence SMP_SERVICE_METADATA_SEQ start with 1 increment by 50; -create sequence SMP_USER_SEQ start with 1 increment by 50; +create sequence SMP_SERVICE_GROUP_DOMAIN_SEQ start with 1 increment by 1; +create sequence SMP_SERVICE_GROUP_SEQ start with 1 increment by 1; +create sequence SMP_SERVICE_METADATA_SEQ start with 1 increment by 1; +create sequence SMP_USER_SEQ start with 1 increment by 1; create table SMP_CERTIFICATE ( ID number(19,0) not null, - CERTIFICATE_ID varchar2(4000 char), + CERTIFICATE_ID varchar2(1024 char), CREATED_ON timestamp not null, - issuer varchar2(512 char), + CRL_URL varchar2(4000 char), + ISSUER varchar2(1024 char), LAST_UPDATED_ON timestamp not null, - serialNumber varchar2(128 char), - subject varchar2(512 char), + PEM_ENCODED_CERT clob, + SERIALNUMBER varchar2(128 char), + SUBJECT varchar2(1024 char), VALID_FROM timestamp, VALID_TO timestamp, primary key (ID) ); + comment on table SMP_CERTIFICATE is + 'SMP user certificates'; + + comment on column SMP_CERTIFICATE.ID is + 'Shared primary key with master table SMP_USER'; + + comment on column SMP_CERTIFICATE.CERTIFICATE_ID is + 'Formatted Certificate id using tags: cn, o, c:serialNumber'; + + comment on column SMP_CERTIFICATE.CRL_URL is + 'URL to the certificate revocation list (CRL)'; + + comment on column SMP_CERTIFICATE.ISSUER is + 'Certificate issuer (canonical form)'; + + comment on column SMP_CERTIFICATE.PEM_ENCODED_CERT is + 'PEM encoded certificate'; + + comment on column SMP_CERTIFICATE.SERIALNUMBER is + 'Certificate serial number'; + + comment on column SMP_CERTIFICATE.SUBJECT is + 'Certificate subject (canonical form)'; + + comment on column SMP_CERTIFICATE.VALID_FROM is + 'Certificate valid from date.'; + + comment on column SMP_CERTIFICATE.VALID_TO is + 'Certificate valid to date.'; + create table SMP_CERTIFICATE_AUD ( ID number(19,0) not null, REV number(19,0) not null, REVTYPE number(3,0), - CERTIFICATE_ID varchar2(4000 char), + CERTIFICATE_ID varchar2(1024 char), CREATED_ON timestamp, - issuer varchar2(512 char), + CRL_URL varchar2(4000 char), + ISSUER varchar2(1024 char), LAST_UPDATED_ON timestamp, - serialNumber varchar2(128 char), - subject varchar2(512 char), + PEM_ENCODED_CERT clob, + SERIALNUMBER varchar2(128 char), + SUBJECT varchar2(1024 char), VALID_FROM timestamp, VALID_TO timestamp, primary key (ID, REV) ); + create table SMP_CONFIGURATION ( + PROPERTY varchar2(512 char) not null, + CREATED_ON timestamp not null, + DESCRIPTION varchar2(4000 char), + LAST_UPDATED_ON timestamp not null, + VALUE varchar2(4000 char), + primary key (PROPERTY) + ); + + comment on table SMP_CONFIGURATION is + 'SMP user certificates'; + + comment on column SMP_CONFIGURATION.PROPERTY is + 'Property name/key'; + + comment on column SMP_CONFIGURATION.CREATED_ON is + 'Row inserted on date'; + + comment on column SMP_CONFIGURATION.DESCRIPTION is + 'Property description'; + + comment on column SMP_CONFIGURATION.LAST_UPDATED_ON is + 'Row modified on date'; + + comment on column SMP_CONFIGURATION.VALUE is + 'Property value'; + create table SMP_DOMAIN ( ID number(19,0) not null, CREATED_ON timestamp not null, DOMAIN_CODE varchar2(256 char) not null, LAST_UPDATED_ON timestamp not null, SIGNATURE_KEY_ALIAS varchar2(256 char), + SML_BLUE_COAT_AUTH number(1,0) not null, SML_CLIENT_CERT_HEADER varchar2(4000 char), SML_CLIENT_KEY_ALIAS varchar2(256 char), SML_PARTC_IDENT_REGEXP varchar2(4000 char), + SML_REGISTERED number(1,0) not null, SML_SMP_ID varchar2(256 char), SML_SUBDOMAIN varchar2(256 char), primary key (ID) ); + comment on table SMP_DOMAIN is + 'SMP can handle multiple domains. This table contains domain specific data'; + + comment on column SMP_DOMAIN.ID is + 'Unique domain id'; + + comment on column SMP_DOMAIN.DOMAIN_CODE is + 'Domain code used as http parameter in rest webservices'; + + comment on column SMP_DOMAIN.SIGNATURE_KEY_ALIAS is + 'Signature key alias used for SML integration'; + + comment on column SMP_DOMAIN.SML_BLUE_COAT_AUTH is + 'Flag for SML authentication type - use CLientCert header or HTTPS ClientCertificate (key)'; + + comment on column SMP_DOMAIN.SML_CLIENT_CERT_HEADER is + 'Client-Cert header used behind RP - BlueCoat for SML integration'; + + comment on column SMP_DOMAIN.SML_CLIENT_KEY_ALIAS is + 'Client key alias used for SML integration'; + + comment on column SMP_DOMAIN.SML_PARTC_IDENT_REGEXP is + 'Reqular expresion for participant ids'; + + comment on column SMP_DOMAIN.SML_REGISTERED is + 'Flag for: Is domain registered in SML'; + + comment on column SMP_DOMAIN.SML_SMP_ID is + 'SMP ID used for SML integration'; + + comment on column SMP_DOMAIN.SML_SUBDOMAIN is + 'SML subdomain'; + create table SMP_DOMAIN_AUD ( ID number(19,0) not null, REV number(19,0) not null, @@ -55,9 +155,11 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; DOMAIN_CODE varchar2(256 char), LAST_UPDATED_ON timestamp, SIGNATURE_KEY_ALIAS varchar2(256 char), + SML_BLUE_COAT_AUTH number(1,0), SML_CLIENT_CERT_HEADER varchar2(4000 char), SML_CLIENT_KEY_ALIAS varchar2(256 char), SML_PARTC_IDENT_REGEXP varchar2(4000 char), + SML_REGISTERED number(1,0), SML_SMP_ID varchar2(256 char), SML_SUBDOMAIN varchar2(256 char), primary key (ID, REV) @@ -94,6 +196,12 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; primary key (ID) ); + comment on table SMP_SERVICE_GROUP is + 'Service group data - Identifier and scheme'; + + comment on column SMP_SERVICE_GROUP.ID is + 'Unique Servicegroup id'; + create table SMP_SERVICE_GROUP_AUD ( ID number(19,0) not null, REV number(19,0) not null, @@ -109,7 +217,7 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; ID number(19,0) not null, CREATED_ON timestamp not null, LAST_UPDATED_ON timestamp not null, - SML_REGISTRED number(1,0) not null, + SML_REGISTERED number(1,0) not null, FK_DOMAIN_ID number(19,0), FK_SG_ID number(19,0), primary key (ID) @@ -121,7 +229,7 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; REVTYPE number(3,0), CREATED_ON timestamp, LAST_UPDATED_ON timestamp, - SML_REGISTRED number(1,0), + SML_REGISTERED number(1,0), FK_DOMAIN_ID number(19,0), FK_SG_ID number(19,0), primary key (ID, REV) @@ -137,6 +245,12 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; primary key (ID) ); + comment on table SMP_SERVICE_METADATA is + 'Service metadata'; + + comment on column SMP_SERVICE_METADATA.ID is + 'Shared primary key with master table SMP_SERVICE_METADATA'; + create table SMP_SERVICE_METADATA_AUD ( ID number(19,0) not null, REV number(19,0) not null, @@ -157,6 +271,12 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; primary key (ID) ); + comment on table SMP_SERVICE_METADATA_XML is + 'Service group metadata xml blob'; + + comment on column SMP_SERVICE_METADATA_XML.XML_CONTENT is + 'XML service metadata '; + create table SMP_SERVICE_METADATA_XML_AUD ( ID number(19,0) not null, REV number(19,0) not null, @@ -175,6 +295,12 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; primary key (ID) ); + comment on table SMP_SG_EXTENSION is + 'Service group extension blob'; + + comment on column SMP_SG_EXTENSION.EXTENSION is + 'XML extension(s) for servicegroup '; + create table SMP_SG_EXTENSION_AUD ( ID number(19,0) not null, REV number(19,0) not null, @@ -198,6 +324,30 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; primary key (ID) ); + comment on table SMP_USER is + 'SMP can handle multiple domains. This table contains domain specific data'; + + comment on column SMP_USER.ID is + 'Unique user id'; + + comment on column SMP_USER.ACTIVE is + 'Is user active'; + + comment on column SMP_USER.EMAIL is + 'User email'; + + comment on column SMP_USER.PASSWORD is + 'BCrypted password for username/password login'; + + comment on column SMP_USER.PASSWORD_CHANGED is + 'Last date when password was changed'; + + comment on column SMP_USER.ROLE is + 'User role'; + + comment on column SMP_USER.USERNAME is + 'Login username'; + create table SMP_USER_AUD ( ID number(19,0) not null, REV number(19,0) not null,