Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few tidy ups (beautify, find unset vars, quote variables, add more detailed error messages) #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 90 additions & 88 deletions OracleFormsReports/dockerfiles/12.2.1.2/container-scripts/crDomain.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#=====================================================================
#
#
# $Id: crDomain.sh $
# $Name: crDomain.sh
#
Expand All @@ -11,11 +11,13 @@
#
# AUTHOR: Robert Crames (https://robertcrames.blogspot.com) , 2017
#
# Modified : Dirk Nachbar (https://dirknachbar.blogspot.com) , 2017
# Modified : Dirk Nachbar (https://dirknachbar.blogspot.com) , 2017
#
#
#=====================================================================
# set -x
#set -e
set -u

# Set Start Time
start_time=$(date +%s)
Expand All @@ -24,101 +26,101 @@ echo "Building Forms & Reports Domain: ${DOMAIN_NAME}"

function warten
{
echo " "
echo "ENTER to proceed ..."
read
echo "The Installation Process is started ..."
echo " "
echo "ENTER to proceed ..."
read
echo "The Installation Process is started ..."
}

echo "======================================================================================"
echo " Program : crDomain.sh ........"
echo "======================================================================================"

if [ -z "${WLST_HOME}" ]; then
echo "Environment not correctly set - please verify"
exit 1
echo "Environment not correctly set - please verify"
exit 1
fi

if ! test -d "${DOMAIN_BASE}/${DOMAIN_NAME}"; then
echo "=================================================="
echo "Domain will be installed ..."
echo "=================================================="
if [ -z "${ADM_PWD}" -o -z "${TEMPLATE}" -o -z "${ADMINPORT}" -o -z "${MW}" -o -z "${ADMINPORTSSL}" -o -z " ${DOMAIN_NAME}" ]; then
echo "Environment not set - Exit"
exit 1
fi

# In case we are facing problems with /dev/random
export CONFIG_JVM_ARGS=-Djava.security.egd=file:/dev/./urandom:$CONFIG_JVM_ARGS
# Avoiding MDS-11019 error messages
export JAVA_OPTIONS="${JAVA_OPTIONS} -Dfile.encoding=UTF8"

${WLST_HOME}/wlst.sh ${SCRIPT_HOME}/crDomain.py

mkdir -p ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${AS_NAME}/security
echo "username=${ADM_USER}" > ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${AS_NAME}/security/boot.properties
echo "password=${ADM_PWD}" >> ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${AS_NAME}/security/boot.properties

if [ "${FORMS12C}" == "true" ] || [ "${REPORTS12C}" == "true" ]; then
echo "==========================================="
echo "Oracle Forms and Reports will be configured"
echo "==========================================="
cd ${SCRIPT_HOME}
${SCRIPT_HOME}/crFRExtension.sh
mkdir -p ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${FORMS_MS_NAME}/security
echo "username=${ADM_USER}" > ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${FORMS_MS_NAME}/security/boot.properties
echo "password=${ADM_PWD}" >> ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${FORMS_MS_NAME}/security/boot.properties
mkdir -p ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${REPORTS_MS_NAME}/security
echo "username=${ADM_USER}" > ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${REPORTS_MS_NAME}/security/boot.properties
echo "password=${ADM_PWD}" >> ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${REPORTS_MS_NAME}/security/boot.properties
echo "DOMAIN with Forms and Reports are created"
fi

if [ "${WEBTIER12C}" == "true" ]; then
echo "==========================================="
echo "Oracle Webtier will be configured"
echo "==========================================="
nohup ${DOMAIN_BASE}/${DOMAIN_NAME}/bin/startNodeManager.sh > /dev/null 2>&1 &
echo "==========================================="
echo " Node Manager starting, wait for 30 seconds"
echo "==========================================="
sleep 30
nohup ${DOMAIN_BASE}/${DOMAIN_NAME}/startWebLogic.sh > /dev/null 2>&1 &
echo "==========================================="
echo "Admin Server ${AS_NAME} starting, wait for 2 Minutes"
echo "==========================================="
sleep 120
cd ${SCRIPT_HOME}
${SCRIPT_HOME}/crWebtierDomain.sh
echo "DOMAIN with OHS is created"
fi

if [ "${REP_SERVER}" == "true" ]; then
echo "==========================================="
echo "Oracle Reports Server will be configured"
echo "==========================================="
nohup ${DOMAIN_BASE}/${DOMAIN_NAME}/bin/startManagedWebLogic.sh ${REPORTS_MS_NAME} > /dev/null 2>&1 &
echo "==========================================="
echo "Starting Managed Server ${REPORTS_MS_NAME}, wait for 2 Minutes"
echo "==========================================="
sleep 120
cd ${SCRIPT_HOME}
${SCRIPT_HOME}/crReports.sh
echo "Oracle Reports Server ${REP_SERVER_NAME} is created"
fi

# Set End Time
finish_time=$(date +%s)
echo "Finished"
echo "Domain Build Time: $(( $((finish_time - start_time))/60)) minutes."
else
# Docker Hack, if Domain is already created (first run), we will be here
# and can startup the Forms & Reports Domain
echo "Domain is already installed and will be started..."
nohup ${DOMAIN_BASE}/${DOMAIN_NAME}/bin/startNodeManager.sh > /dev/null 2>&1 &
echo "Wait 30 seconds for Node Manager to start ..."
sleep 30
${DOMAIN_BASE}/${DOMAIN_NAME}/startWebLogic.sh
fi
echo "=================================================="
echo "Domain will be installed ..."
echo "=================================================="
if [ -z "${ADM_PWD}" -o -z "${TEMPLATE}" -o -z "${ADMINPORT}" -o -z "${MW}" -o -z "${ADMINPORTSSL}" -o -z " ${DOMAIN_NAME}" ]; then
echo "Environment not set - Exit"
exit 1
fi
# In case we are facing problems with /dev/random
export CONFIG_JVM_ARGS=-Djava.security.egd=file:/dev/./urandom:"$CONFIG_JVM_ARGS"
# Avoiding MDS-11019 error messages
export JAVA_OPTIONS="${JAVA_OPTIONS} -Dfile.encoding=UTF8"
"${WLST_HOME}/wlst.sh" "${SCRIPT_HOME}/crDomain.py"
mkdir -p "${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${AS_NAME}/security"
echo "username=${ADM_USER}" > "${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${AS_NAME}/security/boot.properties"
echo "password=${ADM_PWD}" >> "${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${AS_NAME}/security/boot.properties"
if [ "${FORMS12C}" == "true" ] || [ "${REPORTS12C}" == "true" ]; then
echo "==========================================="
echo "Oracle Forms and Reports will be configured"
echo "==========================================="
cd "${SCRIPT_HOME}"
"${SCRIPT_HOME}/crFRExtension.sh"
mkdir -p ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${FORMS_MS_NAME}/security
echo "username=${ADM_USER}" > ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${FORMS_MS_NAME}/security/boot.properties
echo "password=${ADM_PWD}" >> ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${FORMS_MS_NAME}/security/boot.properties
mkdir -p ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${REPORTS_MS_NAME}/security
echo "username=${ADM_USER}" > ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${REPORTS_MS_NAME}/security/boot.properties
echo "password=${ADM_PWD}" >> ${DOMAIN_BASE}/${DOMAIN_NAME}/servers/${REPORTS_MS_NAME}/security/boot.properties
echo "DOMAIN with Forms and Reports are created"
fi
if [ "${WEBTIER12C}" == "true" ]; then
echo "==========================================="
echo "Oracle Webtier will be configured"
echo "==========================================="
nohup "${DOMAIN_BASE}/${DOMAIN_NAME}/bin/startNodeManager.sh" > /dev/null 2>&1 &
echo "==========================================="
echo " Node Manager starting, wait for 30 seconds"
echo "==========================================="
sleep 30
nohup "${DOMAIN_BASE}/${DOMAIN_NAME}/startWebLogic.sh" > /dev/null 2>&1 &
echo "==========================================="
echo "Admin Server ${AS_NAME} starting, wait for 2 Minutes"
echo "==========================================="
sleep 120
cd "${SCRIPT_HOME}"
"${SCRIPT_HOME}/crWebtierDomain.sh"
echo "DOMAIN with OHS is created"
fi
if [ "${REP_SERVER}" == "true" ]; then
echo "==========================================="
echo "Oracle Reports Server will be configured"
echo "==========================================="
nohup "${DOMAIN_BASE}/${DOMAIN_NAME}/bin/startManagedWebLogic.sh" "${REPORTS_MS_NAME}" > /dev/null 2>&1 &
echo "==========================================="
echo "Starting Managed Server ${REPORTS_MS_NAME}, wait for 2 Minutes"
echo "==========================================="
sleep 120
cd "${SCRIPT_HOME}"
"${SCRIPT_HOME}/crReports.sh"
echo "Oracle Reports Server ${REP_SERVER_NAME} is created"
fi
# Set End Time
finish_time=$(date +%s)
echo "Finished"
echo "Domain Build Time: $(( $((finish_time - start_time))/60)) minutes."
else
# Docker Hack, if Domain is already created (first run), we will be here
# and can startup the Forms & Reports Domain
echo "Domain is already installed and will be started..."
nohup "${DOMAIN_BASE}/${DOMAIN_NAME}/bin/startNodeManager.sh" > /dev/null 2>&1 &
echo "Wait 30 seconds for Node Manager to start ..."
sleep 30
"${DOMAIN_BASE}/${DOMAIN_NAME}/startWebLogic.sh"
fi


Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def printInfo(infoText):
printHeader( "readDomain "+v_domain+" started")
readDomain(v_setup_domain_base+'/'+v_domain)
printInfo( "readDomain successful")
except:
printInfo( "readDomain failed")
except Exception, e:
printInfo("readDomain failed: " + str(e))
exit()

try:
Expand All @@ -70,8 +70,8 @@ def printInfo(infoText):
printInfo( "select templates successful")
loadTemplates()
printInfo( "load templates successful")
except:
printInfo( "select and load templates failed")
except Exception, e:
printInfo("select and load templates failed: " + str(e))
exit()

printHeader("JDBC configuration")
Expand All @@ -87,8 +87,8 @@ def printInfo(infoText):
cd('Property/user')
cmo.setValue(v_SchemaPrefix+'_STB')
printInfo("Configure LocalSvcTblDataSource successful")
except:
printInfo("Configure LocalSvcTblDataSource failed")
except Exception, e:
printInfo("Configure LocalSvcTblDataSource failed: " + str(e))
exit()

try:
Expand All @@ -103,8 +103,8 @@ def printInfo(infoText):
cd('Property/user')
cmo.setValue(v_SchemaPrefix+'_OPSS')
printInfo("Configure opss-data-source successful")
except:
printInfo("Configure opss-data-source failed")
except Exception, e:
printInfo("Configure opss-data-source failed: " + str(e))
exit()

try:
Expand All @@ -119,8 +119,8 @@ def printInfo(infoText):
cd('Property/user')
cmo.setValue(v_SchemaPrefix+'_IAU_VIEWER')
printInfo("Configure opss-audit-viewDS successful")
except:
printInfo("Configure opss-audit-viewDS failed")
except Exception, e:
printInfo("Configure opss-audit-viewDS failed: " + str(e))
exit()

try:
Expand All @@ -135,8 +135,8 @@ def printInfo(infoText):
cd('Property/user')
cmo.setValue(v_SchemaPrefix+'_IAU_APPEND')
printInfo("Configure opss-audit-DBDS successful")
except:
printInfo("Configure opss-audit-DBDS failed")
except Exception, e:
printInfo("Configure opss-audit-DBDS failed: " + str(e))
exit()

try:
Expand All @@ -146,8 +146,8 @@ def printInfo(infoText):
changeDatasourceToXA('opss-audit-viewDS')
changeDatasourceToXA('opss-data-source')
printInfo("Modify Datasources successful")
except:
printInfo("Modify Datasources failed")
except Exception, e:
printInfo("Modify Datasources failed: " + str(e))

printHeader('Customize Domain Settings')
try:
Expand All @@ -166,14 +166,14 @@ def printInfo(infoText):
cd('/Server/'+v_reportsMSName)
cmo.setListenPort(int(v_reportsPort))
printInfo("Modification of Name and Ports are successful")
except:
printInfo("ERROR: Modification of Name and Ports are failed")
except Exception, e:
printInfo("ERROR: Modification of Name and Ports are failed: " + str(e))

try:
if v_reports_in_forms == 'false':
printInfo("Reports are remaining in own Managed Server")
except:
printInfo("x")
except Exception, e:
printInfo("Customize Domain Settings failed: " + str(e))

try:
if v_reports_in_forms == 'true':
Expand All @@ -185,8 +185,8 @@ def printInfo(infoText):
cd('/Library/oracle.reports.applib#[email protected]')
set('Target','cluster_forms')
printInfo("Move Reports into Forms Managed Server are successful")
except:
printInfo("ERROR: Move Reports into Forms Managed Server failed")
except Exception, e:
printInfo("ERROR: Move Reports into Forms Managed Server failed: " + str(e))

try:
printHeader("Nodemanager Configuration")
Expand All @@ -200,15 +200,15 @@ def printInfo(infoText):
cmo.setNodeManagerUsername(v_NMUsername)
cmo.setNodeManagerPasswordEncrypted(v_NMPwd)
printInfo("Nodemanager Configuration successful")
except:
printInfo("ERROR: Nodemanager Configuration failed")
except Exception, e:
printInfo("ERROR: Nodemanager Configuration failed: " + str(e))

try:
printHeader("AppDir will be set to "+v_setup_application_base+"/"+v_domain)
try:
setOption('AppDir',v_setup_application_base+"/"+v_domain)
except Exception, e:
print "Error Message "+ str(e)
print "Error Message: " + str(e)

printInfo("Domain will be updated and saved")
printInfo("... this can take up to 5 minutes")
Expand All @@ -218,21 +218,21 @@ def printInfo(infoText):

# exit()
except:
print "Domain could not be saved"
print "Domain could not be saved: " + str(e)

try:
printHeader("Admin Server will be assigned to Machine")
readDomain(v_setup_domain_base+'/'+v_domain)
printInfo( "readDomain successful")
printInfo("readDomain successful")
cd('Servers/'+v_asName)
set('Machine','AdminServerMachine')
printInfo("Domain will be updated and saved")
printInfo("... this can take up to 5 minutes")
updateDomain()
closeDomain()
# exit()
except:
printInfo( "readDomain failed")
except Exception, e:
printInfo("readDomain failed: " + str(e))
exit()

try:
Expand All @@ -247,7 +247,7 @@ def printInfo(infoText):
closeDomain()
print "======================================================================================"
exit()
except:
printInfo( "readDomain failed")
except Exception, e:
printInfo("readDomain failed: " + str(e))
exit()

Loading