1. WEBLOGIC ADMINISTRATION UND
DEPLOYMENT MIT WLST
„Infrastructure as Code“
Oracle WebLogic Scripting Tool
Best Practices
Andreas Koop
Consultant
Oracle Technologies
DOAG SIG Middleware, Köln, 29. Aug. 2012
2. Andreas Koop
ÜBER MICH Consultant
Oracle Technologies
Beratung, Training Oracle Technologie
ADF Certified Implementation Specialist
Community
DOAG, ADF EMG, ADF German Community, Twitter @multikoop
Blog
Technical http://multikoop.blogspot.com
Sonstiges http://www.enpit.de/blog
2
3. ENTERPRISE.PRAGMATIC.IT
Consulting Training Development
Oracle Fusion Oracle Oracle Oracle
Middleware WebCenter ADF WebLogic
Enable productive IT by Oracle Technologies
5. INFRASTRUCTURE AS CODE
‣ Vision - Bereitstellung einer
lauffähigen Umgebung aus
‣ Source Code Repository
‣ Anwendungsdaten (Backup)
‣ Ressourcen (Physikalisch /
Virtuell)
‣ In Zeiten von Cloud und steigendem Bedarf nach horizontal skalierbaren
System ist IaC unabdingbar
Andreas Koop 5
6. RESTORE ENV FROM CODE
app source
App
App
SCM App
Artefacts
Artefacts
Artefacts
infra source
DB / Service
Endpoints configuration / Sh, Chef, WLST, ...
data /
backup
Andreas Koop 6
7. WAS BRAUCHT EINE
ORACLE FMW UMGEBUNG?
‣ WebLogic Installation, Domain ‣ WebLogic Konfiguration
‣ Application Deployment ‣ Data Sources
‣ System and Performance ‣ Message Queues
Monitoring
‣ Logging
‣ Diagnostics (WLDF)
App1 App2
‣ Security Provider
‣ ...
Andreas Koop 7
11. DOMAIN ERWEITERN
# Z.B. um die ADF Runtime in Form der JRF
readDomain(DOMAIN_DIR)
addTemplate(MW_HOME + '/oracle_common/
common/templates/applications/jrf_templ
ate_11.1.1.jar')
updateDomain()
closeDomain()
exit()
Andreas Koop 11
12. WLST EXECUTION
BEST PRACTICE (OFFLINE)
#!/bin/sh
export DOMAIN_HOME=/oracle/fmw
/11.1.1.6/user_projects/domains
/my_domain
export DOMAIN_NAME=my_domain
...
readTemplate(os.environ['WL_HOME'] + '/
env/env.sh common/templates/domains/wls.jar')
cd('/')
cmo.setName(os.environ['DOMAIN_NAME'])
#!/bin/sh
cd('Servers/AdminServer')
cmo.setListenAddress( 'All Local
. $PRJ_HOME/env/env.sh
Addresses' )
. $DOMAIN_HOME/bin/setDomainEnv.sh
cmo.setListenPort( int(
WL_ADMIN_PORT) )
cd $PRJ_HOME/bin/wlst
...
java weblogic.WLST create.domain.py
writeDomain( DOMAIN_DIR )
cd -
closeTemplate()
bin/create.domain.sh bin/wlst/create.domain.py
Andreas Koop 12
17. MODULARIZE WLST SCRIPTS
EVEN MORE
# Custom Functions
import os
def getDomainName():
return os.environ['DOMAIN_NAME'] $WL_HOME/
def startEditSession(): common/wlst
logInfo('start edit session')
edit()
startEdit()
...
Custom
Functions
bin/wlst/modules/enpit.utils.py stehen dann
alle Skripten
.. zur
startEditSession() Verfügung
# do something
saveAndActivate()
..
Andreas Koop 17
22. LOGGING LOGGING LOGGING
‣ Never-Ending-Story
‣ Was tun? Was berücksichtigen?
‣ Log Rotating
‣ Domain Log
‣ Server Logs
‣ „Wo sind die Log-Files???“
Andreas Koop 22
27. APPLICATION DEPLOYMENT
‣ 2 Phasen
Java EE App
‣ Vorbereiten
‣ Deployment Durchführen deploy
‣ Modi
‣ No Stage App1 App2
‣ Stage
‣ External Stage
Andreas Koop 27
28. HOW TO DEPLOY
connect('weblogic', 'welcome1', ADMIN_URL)
deploy('myApp', '/path/to/myApp.ear', targets='Cluster1')
# targets='Server1'
startApplication('myApp')
disconnect()
exit()
Andreas Koop 28
29. HOW TO UNDEPLOY
connect('weblogic', 'welcome1', ADMIN_URL)
stopApplication('myApp')
undeploy('myApp')
# default: from all targets
disconnect()
exit()
Andreas Koop 29
31. HOW TO RELAX
(CUSTOM SOLUTION) Keep last 10 EARs
‣ ...falls das Deployment mal 2012-08-02-myapp.ear
2012-08-02-myapp.ear
2012-08-02-myapp.ear
nicht reibungslos läuft?
‣ Deploy And Backup EAR deploy(...)
shutil.copy(...)
‣ Restore def restore():
#Get last EAR
#deploy(lastEAR)
myapp
Andreas Koop 31