Skip to content

Commit 0ded852

Browse files
committed
use new fmw infra docker image
1 parent 611c8a2 commit 0ded852

File tree

8 files changed

+245
-195
lines changed

8 files changed

+245
-195
lines changed

integration-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<artifactId>guava</artifactId>
6868
<version>${guava-version}</version>
6969
</dependency>
70-
<!-- JSON processing: jackson -->
70+
<!-- JSON processing: jackson -->
7171
<dependency>
7272
<groupId>com.fasterxml.jackson.core</groupId>
7373
<artifactId>jackson-core</artifactId>

integration-tests/src/test/java/oracle/kubernetes/operator/JrfInOperatorTest.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,13 @@ public static void staticPrepare() throws Exception {
4848
// create DB used for jrf domain
4949
OracleDB db = DBUtils.createOracleDB(DB_PROP_FILE);
5050

51-
// populate the jrf/create-domain-script.sh
5251
// copy the integration-tests/src/test/resources/domain-home-on-pv/jrf to
5352
// BaseTest.getResultDir()
5453
TestUtils.exec(
5554
"cp -rf "
5655
+ BaseTest.getProjectRoot()
5756
+ "/integration-tests/src/test/resources/domain-home-on-pv/jrf "
5857
+ BaseTest.getResultDir());
59-
// replace the db connection string with true value
60-
String dbConnectString =
61-
db.getName()
62-
+ "."
63-
+ db.getNamespace()
64-
+ ".svc.cluster.local:"
65-
+ db.getPort()
66-
+ "/"
67-
+ db.getDBPdb()
68-
+ "."
69-
+ db.getDBDomain();
70-
TestUtils.replaceStringInFile(
71-
BaseTest.getResultDir() + "/jrf/create-domain-script.sh",
72-
"%CONNECTION_STRING%",
73-
dbConnectString);
7458
}
7559

7660
/**

integration-tests/src/test/java/oracle/kubernetes/operator/utils/JRFDomain.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ private void updateDomainMapForJRF() throws Exception {
5555
"image", DEFAULT_FMWINFRA_DOCKER_IMAGENAME + ":" + DEFAULT_FMWINFRA_DOCKER_IMAGETAG);
5656

5757
if (!domainMap.containsKey("domainHomeImageBase")) {
58-
// update jrf/create-domain-script.sh with domain_name and rcuprefix
59-
TestUtils.replaceStringInFile(
60-
BaseTest.getResultDir() + "/jrf/create-domain-script.sh", "%RCUPREFIX%", domainUid);
61-
TestUtils.replaceStringInFile(
62-
BaseTest.getResultDir() + "/jrf/create-domain-script.sh", "%DOMAIN_NAME%", domainUid);
6358
domainMap.put("createDomainFilesDir", BaseTest.getResultDir() + "/jrf");
6459
}
6560

Lines changed: 141 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
#!/bin/bash
22
#
33
#
4-
# Copyright (c) 2014-2019 Oracle and/or its affiliates. All rights reserved.
4+
# Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.
55
#
66
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
77
#
8-
# If AdminServer.log does not exists, container is starting for 1st time
9-
# So it should start NM and also associate with AdminServer
10-
# Otherwise, only start NM (container restarted)
8+
#Define DOMAIN_HOME
9+
10+
# get domain properties from domain.properties file
11+
DOMAIN_PROPERTIES_FILE=/u01/weblogic/domain.properties
12+
if [ -e "${DOMAIN_PROPERTIES_FILE}" ]; then
13+
DOMAIN_NAME=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep DOMAIN_NAME | cut -d "=" -f2`
14+
CONNECTION_STRING=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep CONNECTION_STRING | cut -d "=" -f2`
15+
RCUPREFIX=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep RCUPREFIX | cut -d "=" -f2`
16+
ADMIN_LISTEN_PORT=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep ADMIN_LISTEN_PORT | cut -d "=" -f2`
17+
ADMIN_NAME=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep ADMIN_NAME | cut -d "=" -f2`
18+
ADMINISTRATION_PORT_ENABLED=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep ADMINISTRATION_PORT_ENABLED | cut -d "=" -f2`
19+
ADMINISTRATION_PORT=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep ADMINISTRATION_PORT= | cut -d "=" -f2`
20+
MANAGED_NAME=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep MANAGED_NAME | cut -d "=" -f2`
21+
MANAGEDSERVER_PORT=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep MANAGEDSERVER_PORT | cut -d "=" -f2`
22+
PRODUCTION_MODE=`awk '{print $1}' $DOMAIN_PROPERTIES_FILE | grep PRODUCTION_MODE | cut -d "=" -f2`
23+
fi
24+
export DOMAIN_ROOT="/shared/domains"
25+
export DOMAIN_HOME=${DOMAIN_ROOT}/${DOMAIN_NAME}
26+
echo "Domain Home is: " $DOMAIN_HOME
27+
1128
########### SIGTERM handler ############
1229
function _term() {
1330
echo "Stopping container."
@@ -20,19 +37,6 @@ function _kill() {
2037
echo "SIGKILL received, shutting down the server!"
2138
kill -9 $childPID
2239
}
23-
#####Random Password Generation########
24-
function rand_pwd(){
25-
while true; do
26-
s=$(cat /dev/urandom | tr -dc "A-Za-z0-9" | fold -w 8 | head -n 1)
27-
if [[ ${#s} -ge 8 && "$s" == *[A-Z]* && "$s" == *[a-z]* && "$s" == *[0-9]* ]]
28-
then
29-
break
30-
else
31-
echo "Password does not Match the criteria, re-generating..." >&2
32-
fi
33-
done
34-
echo "${s}"
35-
}
3640

3741
# Set SIGTERM handler
3842
trap _term SIGTERM
@@ -41,160 +45,170 @@ trap _term SIGTERM
4145
trap _kill SIGKILL
4246

4347
echo "Configuring Domain for first time "
44-
echo "If Domain has already been Configured"
4548
echo "Start the Admin and Managed Servers "
4649
echo "====================================="
4750

48-
export CONNECTION_STRING=%CONNECTION_STRING%
49-
export RCUPREFIX=%RCUPREFIX%
50-
export DB_PASSWORD=Oradoc_db1
51-
export DB_USERNAME=sys
52-
export ADMIN_PASSWORD=welcome1
53-
export DB_SCHEMA_PASSWORD=Welcome1
54-
export DOMAIN_NAME=%DOMAIN_NAME%
55-
5651
# Check that the User has passed on all the details needed to configure this image
5752
# Settings to call RCU....
5853
echo "CONNECTION_STRING=${CONNECTION_STRING:?"Please set CONNECTION_STRING for connecting to the Database"}"
5954
echo "RCUPREFIX=${RCUPREFIX:?"Please set RCUPREFIX for the database schemas"}"
6055
echo "DOMAIN_NAME=${DOMAIN_NAME:?"Please set DOMAIN_NAME for creating the new Domain"}"
56+
echo "DOMAIN_HOME=$DOMAIN_HOME"
57+
58+
# Settings to call domain creation ...
59+
echo "ADMIN_LISTEN_PORT=${ADMIN_LISTEN_PORT:-7001}"
60+
echo "ADMIN_NAME=${ADMIN_NAME:-AdminServer}"
61+
echo "ADMINISTRATION_PORT_ENABLED=${ADMINISTRATION_PORT_ENABLED:-true}"
62+
echo "ADMINISTRATION_PORT=${ADMINISTRATION_PORT:-9002}"
63+
echo "MANAGED_NAME=${MANAGED_NAME:-infraServer1}"
64+
echo "MANAGEDSERVER_PORT=${MANAGEDSERVER_PORT:-8001}"
65+
echo "PRODUCTION_MODE=${PRODUCTION_MODE:-prod}"
6166

6267
RUN_RCU="true"
6368
CONTAINERCONFIG_DIR=/u01/oracle/ContainerData
6469
export CONNECTION_STRING=$CONNECTION_STRING
6570
export RCUPREFIX=$RCUPREFIX
6671

67-
export DB_USERNAME=$DB_USERNAME
68-
export DB_PASSWORD=$DB_PASSWORD
69-
7072
export jdbc_url="jdbc:oracle:thin:@"$CONNECTION_STRING
7173

72-
#Set the password for RCU
73-
echo -e $DB_PASSWORD"\n"$DB_SCHEMA_PASSWORD > /u01/oracle/pwd.txt
7474

7575
echo "Loading RCU Phase"
7676
echo "================="
7777

7878
echo "CONNECTION_STRING=$CONNECTION_STRING"
7979
echo "RCUPREFIX=$RCUPREFIX"
80-
echo "DB_PASSWORD=$DB_PASSWORD"
8180
echo "jdbc_url=$jdbc_url"
82-
echo "ADMIN_PASSWORD=$ADMIN_PASSWORD"
83-
echo "DB_SCHEMA_PASSWORD=$DB_SCHEMA_PASSWORD"
84-
echo "DB_USERNAME=$DB_USERNAME"
85-
echo "DOMAIN_HOME: $DOMAIN_HOME"
8681

8782

8883
# Create an Infrastructure domain
8984
# set environments needed for the script to work
9085
ADD_DOMAIN=1
91-
export MW_HOME="/u01/oracle"
92-
export WL_HOME="/u01/oracle/wlserver"
93-
export ADMIN_USER="weblogic"
94-
export DOMAIN_ROOT="/shared/domains"
95-
export DOMAIN_HOME="${DOMAIN_ROOT}/${DOMAIN_NAME}"
9686

97-
98-
echo "MW_HOME: $MW_HOME"
99-
echo "WL_HOME: $WL_HOME"
100-
echo "ADMIN_USER: $ADMIN_USER"
101-
echo "DOMAIN_ROOT: $DOMAIN_ROOT"
102-
echo "DOMAIN HOME: $DOMAIN_HOME"
103-
104-
if [ ! -f ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log ]; then
87+
if [ ! -f ${DOMAIN_HOME}/servers/${ADMIN_NAME}/logs/${ADMIN_NAME}.log ]; then
10588
ADD_DOMAIN=0
10689
fi
10790

10891
# Create Domain only if 1st execution
10992
if [ $ADD_DOMAIN -eq 0 ];
11093
then
94+
echo "Creating Domain 1st execution"
95+
mkdir -p $ORACLE_HOME/properties
96+
# Create Domain only if 1st execution
97+
SEC_PROPERTIES_FILE=/u01/weblogic/domain_security.properties
98+
99+
if [ ! -e "$SEC_PROPERTIES_FILE" ]; then
100+
echo "A properties file with the username and password needs to be supplied."
101+
exit
102+
fi
103+
104+
# Get Username
105+
USER=`awk '{print $1}' $SEC_PROPERTIES_FILE | grep username | cut -d "=" -f2`
106+
if [ -z "$USER" ]; then
107+
echo "The domain username is blank. The Admin username must be set in the properties file."
108+
exit
109+
fi
110+
# echo "Username: $USER"
111+
# Get Password
112+
PASS=`awk '{print $1}' $SEC_PROPERTIES_FILE | grep password | cut -d "=" -f2`
113+
if [ -z "$PASS" ]; then
114+
echo "The domain password is blank. The Admin password must be set in the properties file."
115+
exit
116+
fi
117+
# echo "Password: $PASS"
118+
# Get Database Username
119+
DB_USER=`awk '{print $1}' $SEC_PROPERTIES_FILE | grep db_user | cut -d "=" -f2`
120+
if [ -z "$DB_USER" ]; then
121+
echo "The domain username is blank. The Admin username must be set in the properties file."
122+
exit
123+
fi
124+
# echo "Database Username $DB_USER"
125+
# Get Database Password
126+
DB_PASS=`awk '{print $1}' $SEC_PROPERTIES_FILE | grep db_pass | cut -d "=" -f2`
127+
if [ -z "$DB_PASS" ]; then
128+
echo "The domain password is blank. The Admin password must be set in the properties file."
129+
exit
130+
fi
131+
# echo "Database Password $DB_PASS"
132+
# Get databasse Schema Password
133+
DB_SCHEMA_PASS=`awk '{print $1}' $SEC_PROPERTIES_FILE | grep db_schema | cut -d "=" -f2`
134+
if [ -z "$DB_SCHEMA_PASS" ]; then
135+
echo "The databse schema password is blank. The database schema password must be set in the properties file."
136+
exit
137+
fi
138+
# echo "Database Schema Password: $DB_SCHEMA_PASS"
139+
140+
141+
#Only call RCU the first time we create the domain
142+
if [ -e $CONTAINERCONFIG_DIR/RCU.$RCUPREFIX.suc ]
143+
then
144+
#RCU has already been executed successfully, no need to rerun
145+
RUN_RCU="false"
146+
echo "SOA RCU has already been loaded.. skipping"
147+
fi
148+
149+
if [ "$RUN_RCU" == "true" ]
150+
then
151+
#Set the password for RCU
152+
echo -e ${DB_PASS}"\n"${DB_SCHEMA_PASS} > /u01/oracle/pwd.txt
153+
echo "Loading SOA RCU into database"
154+
# Run the RCU to load the schemas into the database
155+
/u01/oracle/oracle_common/bin/rcu -silent -createRepository -databaseType ORACLE -connectString ${CONNECTION_STRING} -dbUser ${DB_USER} -dbRole sysdba -useSamePasswordForAllSchemaUsers true -selectDependentsForComponents true -schemaPrefix ${RCUPREFIX} -component MDS -component MDS -component IAU -component IAU_APPEND -component IAU_VIEWER -component OPSS -component WLS -component STB -f < /u01/oracle/pwd.txt >> /u01/oracle/RCU.out
156+
retval=$?
157+
158+
if [ $retval -ne 0 ];
159+
then
160+
echo "RCU has some error "
161+
#RCU was already called once and schemas are in the database
162+
#continue with Domain creation
163+
grep -q "RCU-6016 The specified prefix already exists" "/u01/oracle/RCU.out"
164+
if [ $? -eq 0 ] ; then
165+
echo "RCU has already loaded schemas into the Database"
166+
echo "RCU Ignore error"
167+
else
168+
echo "RCU Loading Failed.. Please check the RCU logs"
169+
cat /u01/oracle/RCU.out
170+
exit
171+
fi
172+
fi
173+
174+
# cleanup : remove the password file for security
175+
rm -f "/u01/oracle/pwd.txt"
176+
fi
177+
178+
echo "Domain Configuration Phase"
179+
echo "=========================="
180+
181+
wlst.sh -skipWLSModuleScanning /u01/weblogic/createInfraDomain.py -oh ${ORACLE_HOME} -jh ${JAVA_HOME} -parent ${DOMAIN_ROOT} -name ${DOMAIN_NAME} -user ${USER} -password ${PASS} -rcuDb ${CONNECTION_STRING} -rcuPrefix ${RCUPREFIX} -rcuSchemaPwd ${DB_SCHEMA_PASS} -adminListenPort ${ADMIN_LISTEN_PORT} -adminName ${ADMIN_NAME} -adminPortEnabled ${ADMINISTRATION_PORT_ENABLED} -administrationPort ${ADMINISTRATION_PORT} -managedName ${MANAGED_NAME} -managedServerPort ${MANAGEDSERVER_PORT} -prodMode ${PRODUCTION_MODE}
111182

112-
# Auto generate Oracle WebLogic Server admin password
113-
if [ -z ${ADMIN_PASSWORD} ]
114-
then
115-
# Auto generate Oracle WebLogic Server admin password
116-
ADMIN_PASSWORD=$(rand_pwd)
117-
echo ""
118-
echo " Oracle WebLogic Server Password Auto Generated :"
119-
echo ""
120-
echo " ----> 'weblogic' admin password: $ADMIN_PASSWORD"
121-
echo ""
122-
fi;
123-
124-
if [ -z ${DB_SCHEMA_PASSWORD} ]
125-
then
126-
# Auto generate Oracle Database Schema password
127-
temp_pwd=$(rand_pwd)
128-
#Password should not start with a number for database
129-
f_str=`echo $temp_pwd|cut -c1|tr [0-9] [A-Z]`
130-
s_str=`echo $temp_pwd|cut -c2-`
131-
DB_SCHEMA_PASSWORD=${f_str}${s_str}
132-
echo ""
133-
echo " Database Schema password Auto Generated :"
134-
echo ""
135-
echo " ----> Database schema password: $DB_SCHEMA_PASSWORD"
136-
echo ""
137-
fi;
138-
139-
export ADMIN_PASSWORD=$ADMIN_PASSWORD
140-
export DB_SCHEMA_PASSWORD=$DB_SCHEMA_PASSWORD
141-
#Only call RCU the first time we create the domain
142-
if [ -e $CONTAINERCONFIG_DIR/RCU.$RCUPREFIX.suc ]
143-
then
144-
#RCU has already been executed successfully, no need to rerun
145-
RUN_RCU="false"
146-
echo "SOA RCU has already been loaded.. skipping"
147-
fi
148-
149-
if [ "$RUN_RCU" == "true" ]
150-
then
151-
echo "Loading SOA RCU into database"
152-
# Run the RCU to load the schemas into the database
153-
/u01/oracle/oracle_common/bin/rcu -silent -createRepository -databaseType ORACLE -connectString $CONNECTION_STRING -dbUser $DB_USERNAME -dbRole sysdba -useSamePasswordForAllSchemaUsers true -selectDependentsForComponents true -schemaPrefix $RCUPREFIX -component MDS -component MDS -component IAU -component IAU_APPEND -component IAU_VIEWER -component OPSS -component WLS -component STB -f < /u01/oracle/pwd.txt >> /u01/oracle/RCU.out
154183
retval=$?
155184

185+
echo "RetVal from Domain creation $retval"
186+
156187
if [ $retval -ne 0 ];
157188
then
158-
echo "RCU has some error "
159-
#RCU was already called once and schemas are in the database
160-
#continue with Domain creation
161-
grep -q "RCU-6016 The specified prefix already exists" "/u01/oracle/RCU.out"
162-
if [ $? -eq 0 ] ; then
163-
echo "RCU has already loaded schemas into the Database"
164-
echo "RCU Ignore error"
165-
else
166-
echo "RCU Loading Failed.. Please check the RCU logs"
167-
exit
168-
fi
189+
echo "Domain Creation Failed.. Please check the Domain Logs"
190+
exit
169191
fi
170192

171-
# cleanup : remove the password file for security
172-
rm -f "/u01/oracle/pwd.txt"
173-
fi
174-
175-
echo "Domain Configuration Phase"
176-
echo "=========================="
193+
# Create the security file to start the server(s) without the password prompt
194+
mkdir -p ${DOMAIN_HOME}/servers/${ADMIN_NAME}/security/
195+
echo "username=${USER}" >> ${DOMAIN_HOME}/servers/${ADMIN_NAME}/security/boot.properties
196+
echo "password=${PASS}" >> ${DOMAIN_HOME}/servers/${ADMIN_NAME}/security/boot.properties
177197

178-
wlst.sh -skipWLSModuleScanning /u01/weblogic/createInfraDomain.py -oh $ORACLE_HOME -jh $JAVA_HOME -parent $DOMAIN_ROOT -name $DOMAIN_NAME -user $ADMIN_USER -password $ADMIN_PASSWORD -rcuDb $CONNECTION_STRING -rcuPrefix $RCUPREFIX -rcuSchemaPwd $DB_SCHEMA_PASSWORD
179-
retval=$?
198+
${DOMAIN_HOME}/bin/setDomainEnv.sh
199+
fi
180200

181-
echo "RetVal from Domain creation $retval"
201+
#Set Java options
202+
export JAVA_OPTIONS=${JAVA_OPTIONS}
203+
echo "Java Options: ${JAVA_OPTIONS}"
182204

183-
if [ $retval -ne 0 ];
184-
then
185-
echo "Domain Creation Failed.. Please check the Domain Logs"
186-
exit
187-
fi
205+
echo "Starting the Admin Server"
206+
echo "=========================="
188207

189-
# Create the security file to start the server(s) without the password prompt
190-
mkdir -p ${DOMAIN_HOME}/servers/AdminServer/security/
191-
echo "username=weblogic" > ${DOMAIN_HOME}/servers/AdminServer/security/boot.properties
192-
echo "password=$ADMIN_PASSWORD" >> ${DOMAIN_HOME}/servers/AdminServer/security/boot.properties
193-
194-
mkdir -p ${DOMAIN_HOME}/servers/infraserver1/security/
195-
echo "username=weblogic" > ${DOMAIN_HOME}/servers/infraserver1/security/boot.properties
196-
echo "password="$ADMIN_PASSWORD >> ${DOMAIN_HOME}/servers/infraserver1/security/boot.properties
197-
198-
${DOMAIN_HOME}/bin/setDomainEnv.sh
199-
fi
208+
# Start Admin Server and tail the logs
209+
# ${DOMAIN_HOME}/startWebLogic.sh
210+
# touch ${DOMAIN_HOME}/servers/${ADMIN_NAME}/logs/${ADMIN_NAME}.log
211+
# tail -f ${DOMAIN_HOME}/servers/${ADMIN_NAME}/logs/${ADMIN_NAME}.log &
200212

213+
childPID=$!
214+
wait $childPID

0 commit comments

Comments
 (0)