@@ -1256,47 +1256,7 @@ encrypt_decrypt_domain_secret() {
12561256}
12571257
12581258# prepare mii server
1259-
1260- prepareMIIServer () {
1261-
1262- trace " Model-in-Image: Creating domain home."
1263-
1264- # primordial domain contain the basic structures, security and other fmwconfig templated info
1265- # domainzip only contains the domain configuration (config.xml jdbc/ jms/)
1266- # Both are needed for the complete domain reconstruction
1267-
1268- if [ ! -f /weblogic-operator/introspector/primordial_domainzip.secure ] ; then
1269- trace SEVERE " Domain Source Type is FromModel, the primordial model archive is missing, cannot start server"
1270- return 1
1271- fi
1272-
1273- if [ ! -f /weblogic-operator/introspector/domainzip.secure ] ; then
1274- trace SEVERE " Domain type is FromModel, the domain configuration archive is missing, cannot start server"
1275- return 1
1276- fi
1277-
1278- trace " Model-in-Image: Restoring primordial domain"
1279- restorePrimordialDomain || return 1
1280-
1281- trace " Model-in-Image: Restore domain secret"
1282- # decrypt the SerializedSystemIni first
1283- if [ -f ${RUNTIME_ENCRYPTION_SECRET_PASSWORD} ] ; then
1284- MII_PASSPHRASE=$( cat ${RUNTIME_ENCRYPTION_SECRET_PASSWORD} )
1285- else
1286- trace SEVERE " Domain Source Type is 'FromModel' which requires specifying a runtimeEncryptionSecret " \
1287- " in your domain resource and deploying this secret with a 'password' key, but the secret does not have this key."
1288- return 1
1289- fi
1290- encrypt_decrypt_domain_secret " decrypt" ${DOMAIN_HOME} ${MII_PASSPHRASE}
1291-
1292- # restore the config zip
1293- #
1294- trace " Model-in-Image: Restore domain config"
1295- restoreDomainConfig || return 1
1296-
1297- # restore the archive apps and libraries
1298- #
1299- trace " Model-in-Image: Restoring apps and libraries"
1259+ restorAppAndLibs () {
13001260
13011261 createFolder " ${DOMAIN_HOME} /lib" " This is the './lib' directory within DOMAIN_HOME directory 'domain.spec.domainHome'." || return 1
13021262 local WLSDEPLOY_DOMAINLIB=" wlsdeploy/domainLibraries"
@@ -1327,16 +1287,60 @@ prepareMIIServer() {
13271287
13281288 # expand the archive apps and shared lib to the wlsdeploy/* directories
13291289 # the config.xml is referencing them from that path
1330-
1290+ # exclude standalone app module in wlsdeploy/applications/*.xml since it is included int zipped up domain config
1291+ # zip, the original xml in the archive may have wdt tokenized notations.
13311292 cd ${DOMAIN_HOME} || return 1
1332- ${JAVA_HOME} /bin/jar xf ${IMG_ARCHIVES_ROOTDIR} /${file} wlsdeploy/
1293+ unzip ${IMG_ARCHIVES_ROOTDIR} /${file} -x " wlsdeploy/domainBin/* "
13331294 if [ $? -ne 0 ] ; then
13341295 trace SEVERE " Domain Source Type is FromModel, error in extracting application archive ${IMG_ARCHIVES_ROOTDIR} /${file} "
13351296 return 1
13361297 fi
1337- # No need to have domainLibraries in domain home
1338- rm -fr ${WLSDEPLOY_DOMAINLIB}
13391298 done
1299+
1300+ }
1301+
1302+ prepareMIIServer () {
1303+
1304+ trace " Model-in-Image: Creating domain home."
1305+
1306+ # primordial domain contain the basic structures, security and other fmwconfig templated info
1307+ # domainzip only contains the domain configuration (config.xml jdbc/ jms/)
1308+ # Both are needed for the complete domain reconstruction
1309+
1310+ if [ ! -f /weblogic-operator/introspector/primordial_domainzip.secure ] ; then
1311+ trace SEVERE " Domain Source Type is FromModel, the primordial model archive is missing, cannot start server"
1312+ return 1
1313+ fi
1314+
1315+ if [ ! -f /weblogic-operator/introspector/domainzip.secure ] ; then
1316+ trace SEVERE " Domain type is FromModel, the domain configuration archive is missing, cannot start server"
1317+ return 1
1318+ fi
1319+
1320+ trace " Model-in-Image: Restoring primordial domain"
1321+ restorePrimordialDomain || return 1
1322+
1323+ trace " Model-in-Image: Restore domain secret"
1324+ # decrypt the SerializedSystemIni first
1325+ if [ -f ${RUNTIME_ENCRYPTION_SECRET_PASSWORD} ] ; then
1326+ MII_PASSPHRASE=$( cat ${RUNTIME_ENCRYPTION_SECRET_PASSWORD} )
1327+ else
1328+ trace SEVERE " Domain Source Type is 'FromModel' which requires specifying a runtimeEncryptionSecret " \
1329+ " in your domain resource and deploying this secret with a 'password' key, but the secret does not have this key."
1330+ return 1
1331+ fi
1332+ encrypt_decrypt_domain_secret " decrypt" ${DOMAIN_HOME} ${MII_PASSPHRASE}
1333+
1334+ # We restore the app and libs from the archive first, the domain zip may contain any standalone application
1335+ # modules under wlsdeploy/applications/*.xml. In the next step, if any standalon application module exists collected
1336+ # during introspection, it will overwrite the tokenized version in the archive.
1337+
1338+ trace " Model-in-Image: Restoring apps and libraries"
1339+ restorAppAndLibs || return 1
1340+
1341+ trace " Model-in-Image: Restore domain config"
1342+ restoreDomainConfig || return 1
1343+
13401344 return 0
13411345}
13421346
0 commit comments