SlideShare ist ein Scribd-Unternehmen logo
1 von 39
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
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
ENTERPRISE.PRAGMATIC.IT




   Consulting                  Training                Development
 Oracle Fusion         Oracle                 Oracle        Oracle
  Middleware          WebCenter                ADF         WebLogic

Enable productive IT by Oracle Technologies
AGENDA

Motivation „Infrastructure as Code“

Überblick WebLogic Scripting Tool

Best Practices Administration und Deployment




Andreas Koop               4
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
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
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
MANUELLE KONFIGURATION
IST KEINE LÖSUNG




Andreas Koop   8
WEBLOGIC SCRIPTING TOOL
‣       Jython basierte Scriptsprache zur Automatisierung jeglicher WebLogic
        Administrationsaufgabe

‣       Read / Write MBeans

‣       Offline

    ‣          ~ Configuration
               Wizard

‣       Online

    ‣          ~ Administration Console

Andreas Koop                              9
DOMAIN ERSTELLEN
readTemplate(os.environ['WL_HOME'] + '/common/templates/
domains/wls.jar')
cd('/')                    Current
cmo.setName('my_domain')   Management
cd('Servers/AdminServer') Object
cmo.setListenAddress( 'All Local Addresses' )
cmo.setListenPort( int(ADMIN_PORT) )
cd( '/' )
cd( 'Security/'+DOMAIN_NAME+'/User/' + ADMIN_USER )
cmo.setPassword( ADMIN_PWD )
cd('/')
setOption( 'JavaHome', os.environ['JAVA_HOME'] )
setOption( "ServerStartMode", "prod")
setOption( "OverwriteDomain", "true" )

writeDomain( DOMAIN_DIR )
closeTemplate()


Andreas Koop                 10
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
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
WLST EXECUTION
BEST PRACTICE (OFFLINE)




Andreas Koop   13
WLST ONLINE
  connect('weblogic', 'welcome1', 't3://adminhost:7001')

  edit()
  startEdit()

  # do something

  save()
  activate()

  disconnect()
  exit()




Andreas Koop                  14
DOMAIN ERWEITERN
 connect('weblogic', 'welcome1', 't3://adminhost:7001')
 edit()
 startEdit()

 cmo.createServer(os.environ['MS_NAME'])

 cd('/Servers/'+ os.environ['MS_NAME'])
 cmo.setListenAddress('')
 cmo.setListenPort(os.environ['MS_PORT'])
 cmo.setListenPortEnabled(true)
 cmo.setJavaCompiler('javac')
 cmo.setMachine(getMBean('/Machines/Machine1'))
 cmo.setCluster('Cluster1')

 cd('/Servers/'+os.environ['MS_NAME']+'/SSL/'+os.environ['MS_NAME'])
 cmo.setEnabled(false)

 cd('/Servers/'+os.environ['MS_NAME']+'/ServerStart/'+os.environ['MS_NAME'])
 cmo.setArguments('-Xms512M -Xmx1024M')

 save()
 activate()
 disconnect()

                           bin/wlst/create.server.py
Andreas Koop                            15
MODULARIZE WLST SCRIPTS
                                       connect('weblogic', 'welco..)


   execfile('connect.py')
    execfile('connect.py')                           edit()
     execfile('connect.py')
   execfile('start.edit.session.py')                 startEdit()
    execfile('start.edit.session.py')
     execfile('start.edit.session.py')
   ## do something
     # do something
        do something
                                                     try:
   execfile('end.edit.session.py')
    execfile('end.edit.session.py')                     save()
     execfile('end.edit.session.py')
   execfile('disconnect.py')
    execfile('disconnect.py')
     execfile('disconnect.py')                          activate()
   exit()
    exit()                                           except ...
     exit()
                                                     ..
               bin/wlst/myscriptX.py

                                   disconnect()



Andreas Koop                             16
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
WLST DOMAIN INTERACTION




                    Quelle: Oracle FMW Doc Lib



Andreas Koop   18
DOMAIN STARTUP
nmConnect('Dh4bZwJNNP', 'welcome1', DOMAIN_NAME, NM_PORT)

nmStart('AdminServer')
nmStart('WLS_FORMS')
nmStart('WLS_REPORTS')
nmStart('WLS_DISCO')
nmStart('WLS_MY_APPS')
..

nmDisconnect()
exit()




                         bin/wlst/start.domain.py
Andreas Koop                      19
WLST NODE MANAGER
ENCRYPTED PASSWORD


  nmConnect('Dh4bZwJNNP', 'welcome1', DOMAIN_NAME, NM_PORT)
  storeUserConfig(userConfigFile = .., userKeyFile = .., true)
  disconnect()

  # Ab jetzt: Anmeldung ohne   Passwort im Klartext
  nmConnect(userConfigFile =   NM_HOME + '/userconfigNM.secure',
            userKeyFile    =   NM_HOME + '/userkeyNM.secure',
            domainName     =   DOMAIN_NAME, port='5556')
  exit()

Andreas Koop                    20
DOMAIN SHUTDOWN
NM_HOME = WL_HOME + '/common/nodemanager'
nmConnect(userConfigFile = NM_HOME + '/userconfigNM.secure',
          userKeyFile    = NM_HOME + '/userkeyNM.secure',
          domainName     = DOMAIN_NAME, port='5556')

nmKill('WLS_FORMS')
nmKill('WLS_REPORTS')
nmKill('WLS_DISCO')
nmKill('WLS_MY_APPS')
..
nmKill('AdminServer')

nmDisconnect()
exit()



                    bin/wlst/shutdown.domain.py
Andreas Koop                   21
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
LOGGING KONFIGURATION
  execfile('connect.py')
  execfile('start.edit.session.py')


  cd('/Servers/AdminServer/Log/AdminServer')
  cmo.setStacktraceDepth(5)
  cmo.setRotationType('bySize')
  cmo.setDomainLogBroadcasterBufferSize(10)
  cmo.setLog4jLoggingEnabled(false)
  cmo.setNumberOfFilesLimited(false)
  cmo.setDateFormatPattern('dd.MM.yyyy HH:mm' Uhr 'z')
  cmo.setBufferSizeKB(8)
  cmo.setFileMinSize(5000)
  cmo.setLoggerSeverity('Info')
  cmo.setRotateLogOnStartup(false)
  ..
  cmo.setRedirectStdoutToServerLogEnabled(true)
  cmo.setFileName('logs/AdminServer.log')
  execfile('end.edit.session.py')
  execfile('disconnect.py')
  exit()




Andreas Koop                           23
DEPLOYMENT
‣       Data Source vorbereiten
                                       Java EE App
‣       Targets
                                                            deploy
‣       Deploy

    ‣          Application

    ‣          Shared Libs                           App1            App2



    ‣          EJBs




Andreas Koop                      24
DATA SOURCE ANLEGEN
‣ JNDI Lookup
#connect(..), edit() startEdit()
cd('/')
create('myDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/myDSName')
set('DriverName','oracle.jdbc.OracleDriver')
set('URL','jdbc:oracle:thin:@localhost:1521:XE')
set('Password', 'HR')
set('UseXADataSourceInterface', 'false')
create('myProps','Properties')
cd('Properties/myDSName')
create('user', 'Property')
cd('Property/user')
cmo.setValue('HR')
..
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/myDSName')
set('JNDIName', java.lang.String("jdbc/hrDS"))




Andreas Koop                           25
DATA SOURCE
ENCRYPTED PASSWORD
Shell
  akmac2:doag1_domain ak$ . ./bin/setDomainEnv.sh
  akmac2:doag1_domain ak$ java weblogic.security.Encrypt HR

  {AES}s77UdlHeZXMziW4i8WoPxBSN/DovWtnpYEPTJbBQ70M=



create.datasource.py
  ..
  cd('/')
  create('myDataSource', 'JDBCSystemResource')
  ..
  set('PasswordEncrypted', '{AES}s77UdlHeZXMziW4i8WoPxBSN/DovWtnpYEPTJbBQ70M=')
  ..

  set('Targets',jarray.array([ObjectName('com.bea:Name=MS1,Type=Server')],
  ObjectName))




Andreas Koop                           26
APPLICATION DEPLOYMENT
‣       2 Phasen
                                             Java EE App
    ‣          Vorbereiten

    ‣          Deployment Durchführen               deploy

‣       Modi

    ‣          No Stage                                    App1   App2



    ‣          Stage

    ‣          External Stage

Andreas Koop                            27
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
HOW TO UNDEPLOY

  connect('weblogic', 'welcome1', ADMIN_URL)


  stopApplication('myApp')
  undeploy('myApp')
  # default: from all targets

  disconnect()
  exit()




Andreas Koop                           29
DEPLOYMENT COMMANDS
Command

deploy(appName, path, [targets], [stageMode], [planPath], [options])

startApplication(appName, [options])

stopApplication(appName, [options])

undeploy(appName,[targets],[options])

                                                                       Mittels plan.xml
updateApplication(appName, [planPath], [options])
                                                                       aktualisieren
listApplications()




Andreas Koop                                30
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
SIDE-BY-SIDY DEPLOYMENT
  deploy('myApp', '/path/to/myApp.ear', ..,appVersion = '1.0')


               Bestehende Client-
                 Verbindungen



                        app v1.0            app v2.0




                                      Neue Client-
                                      Verbindungen
  deploy('myApp', '/path/to/myApp.ear', ..,appVersion = '2.0')


Andreas Koop                           32
SERVER MONITORING
  ..
  state('<ServerName>')

  ..



  domainConfig()
  serverNames = cmo.getServers()
  domainRuntime()
  for name in serverNames:
    cd("/ServerRuntimes/"+name.getName()+"/JVMRuntime/"+name.getName())
    heapFree = int(get('HeapFreeCurrent'))/(1024*1024)
    heapTotal = int(get('HeapSizeCurrent'))/(1024*1024)
    heapUsed = (heapTotal - heapFree)
    print '%14s %4d MB %4d MB %4d MB' % (name.getName(),heapTotal, heapFree, heapUsed)




Andreas Koop                                    33
SERVER THREAD DUMP
  ..
  threadDump(writeToFile='true',fileName='/tmp/threaddump.txt',
  serverName='AdminServer')

  ..




Andreas Koop                           34
DOMAIN CONFIG AS CODE
Domain Configuration
wls:offline>configToScript(configPath='$DH',
pyPath='config.mydomain.py')

MDS per Application
wls:online>exportMetadata(application='doag-
demo', server='AdminServer', toLocation='/tmp/exportmds'


User / Groups Embedded LDAP
wls:online> domainRuntime() cd(‘/DomainServices/
DomainRuntimeService/DomainConfiguration/<domain>/
SecurityConfiguration/<domain>/DefaultRealm/myre alm/
AuthenticationProviders/DefaultAuthenticator’)
cmo.exportData('DefaultAtn', '/export.ldif', Properties())


Andreas Koop                 35
WLST RECORDING FEATURE
‣      WebLogic Console Record (Aufzeichnen)-Button klicken




‣      Gewünschte Konfiguration vornehmen

‣      Generiertes WLST-Skript anpassen und integrieren




Andreas Koop                          36
CONCLUSION
‣       WLST RULEZ!

‣       MUST for every Oracle FMW Admin!

‣       Vollständige Automatisierung von

    ‣          Domainerstellung, -konfiguration

    ‣          Application, Library Deployment

    ‣          Export / Import MDS

    ‣          Server - Startup / Shutdown - Monitoring

Andreas Koop                                37
VIELEN DANK FÜR IHRE
   AUFMERKSAMKEIT



HABEN SIE NOCH FRAGEN?
WebLogic Administration und Deployment mit WLST

Weitere ähnliche Inhalte

Andere mochten auch

Weblogic configuration & administration
Weblogic   configuration & administrationWeblogic   configuration & administration
Weblogic configuration & administration
Muhammad Mansoor
 
WebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLSTWebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLST
enpit GmbH & Co. KG
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic Concepts
James Bayer
 

Andere mochten auch (8)

Weblogic server administration
Weblogic server administrationWeblogic server administration
Weblogic server administration
 
WebLogic im Docker Container
WebLogic im Docker ContainerWebLogic im Docker Container
WebLogic im Docker Container
 
Weblogic configuration & administration
Weblogic   configuration & administrationWeblogic   configuration & administration
Weblogic configuration & administration
 
Weblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastWeblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencast
 
WebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLSTWebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLST
 
Administration von ADF Anwendungen
Administration von ADF AnwendungenAdministration von ADF Anwendungen
Administration von ADF Anwendungen
 
Java WebApps und Services on Oracle Java Cloud Service
Java WebApps und Services on Oracle Java Cloud ServiceJava WebApps und Services on Oracle Java Cloud Service
Java WebApps und Services on Oracle Java Cloud Service
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic Concepts
 

Mehr von Andreas Koop

Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Andreas Koop
 
WepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als dasWepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als das
Andreas Koop
 
ADF User Interface Design Best Pratices
ADF User Interface Design Best PraticesADF User Interface Design Best Pratices
ADF User Interface Design Best Pratices
Andreas Koop
 
Integration of BI Publisher in ADF applications
Integration of BI Publisher in ADF applicationsIntegration of BI Publisher in ADF applications
Integration of BI Publisher in ADF applications
Andreas Koop
 
DOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic Server
DOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic ServerDOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic Server
DOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic Server
Andreas Koop
 

Mehr von Andreas Koop (16)

Von Big Data zu Künstlicher Intelligenz - Maschinelles Lernen auf dem Vormarsch
Von Big Data zu Künstlicher Intelligenz - Maschinelles Lernen auf dem VormarschVon Big Data zu Künstlicher Intelligenz - Maschinelles Lernen auf dem Vormarsch
Von Big Data zu Künstlicher Intelligenz - Maschinelles Lernen auf dem Vormarsch
 
Mit Legosteinen Maschinelles Lernen lernen
Mit Legosteinen Maschinelles Lernen lernenMit Legosteinen Maschinelles Lernen lernen
Mit Legosteinen Maschinelles Lernen lernen
 
Cloud-native Apps - Architektur, Implementierung, Demo
Cloud-native Apps - Architektur, Implementierung, DemoCloud-native Apps - Architektur, Implementierung, Demo
Cloud-native Apps - Architektur, Implementierung, Demo
 
Development in der Cloud-Ära
Development in der Cloud-ÄraDevelopment in der Cloud-Ära
Development in der Cloud-Ära
 
REST mit ADF
REST mit ADFREST mit ADF
REST mit ADF
 
ADF Spotlight: ADF 12c Deck component overview and progammer examples
ADF Spotlight: ADF 12c Deck component overview and progammer examplesADF Spotlight: ADF 12c Deck component overview and progammer examples
ADF Spotlight: ADF 12c Deck component overview and progammer examples
 
WebCenter Portal - Integrate Custom Taskflows
WebCenter Portal - Integrate Custom TaskflowsWebCenter Portal - Integrate Custom Taskflows
WebCenter Portal - Integrate Custom Taskflows
 
Java Web Apps and Services on Oracle Java Cloud Service
Java Web Apps and Services on Oracle Java Cloud ServiceJava Web Apps and Services on Oracle Java Cloud Service
Java Web Apps and Services on Oracle Java Cloud Service
 
Multichannel Application Development Best Practices
Multichannel Application Development Best PracticesMultichannel Application Development Best Practices
Multichannel Application Development Best Practices
 
Oracle WebLogic for DevOps
Oracle WebLogic for DevOpsOracle WebLogic for DevOps
Oracle WebLogic for DevOps
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
 
WepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als dasWepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als das
 
ADF User Interface Design Best Pratices
ADF User Interface Design Best PraticesADF User Interface Design Best Pratices
ADF User Interface Design Best Pratices
 
Administration for Oracle ADF Applications
Administration for Oracle ADF ApplicationsAdministration for Oracle ADF Applications
Administration for Oracle ADF Applications
 
Integration of BI Publisher in ADF applications
Integration of BI Publisher in ADF applicationsIntegration of BI Publisher in ADF applications
Integration of BI Publisher in ADF applications
 
DOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic Server
DOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic ServerDOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic Server
DOAG 2011 - Upgrade Guide for Oracle ADF on WebLogic Server
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

WebLogic Administration und Deployment mit WLST

  • 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
  • 4. AGENDA Motivation „Infrastructure as Code“ Überblick WebLogic Scripting Tool Best Practices Administration und Deployment Andreas Koop 4
  • 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
  • 8. MANUELLE KONFIGURATION IST KEINE LÖSUNG Andreas Koop 8
  • 9. WEBLOGIC SCRIPTING TOOL ‣ Jython basierte Scriptsprache zur Automatisierung jeglicher WebLogic Administrationsaufgabe ‣ Read / Write MBeans ‣ Offline ‣ ~ Configuration Wizard ‣ Online ‣ ~ Administration Console Andreas Koop 9
  • 10. DOMAIN ERSTELLEN readTemplate(os.environ['WL_HOME'] + '/common/templates/ domains/wls.jar') cd('/') Current cmo.setName('my_domain') Management cd('Servers/AdminServer') Object cmo.setListenAddress( 'All Local Addresses' ) cmo.setListenPort( int(ADMIN_PORT) ) cd( '/' ) cd( 'Security/'+DOMAIN_NAME+'/User/' + ADMIN_USER ) cmo.setPassword( ADMIN_PWD ) cd('/') setOption( 'JavaHome', os.environ['JAVA_HOME'] ) setOption( "ServerStartMode", "prod") setOption( "OverwriteDomain", "true" ) writeDomain( DOMAIN_DIR ) closeTemplate() Andreas Koop 10
  • 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
  • 13. WLST EXECUTION BEST PRACTICE (OFFLINE) Andreas Koop 13
  • 14. WLST ONLINE connect('weblogic', 'welcome1', 't3://adminhost:7001') edit() startEdit() # do something save() activate() disconnect() exit() Andreas Koop 14
  • 15. DOMAIN ERWEITERN connect('weblogic', 'welcome1', 't3://adminhost:7001') edit() startEdit() cmo.createServer(os.environ['MS_NAME']) cd('/Servers/'+ os.environ['MS_NAME']) cmo.setListenAddress('') cmo.setListenPort(os.environ['MS_PORT']) cmo.setListenPortEnabled(true) cmo.setJavaCompiler('javac') cmo.setMachine(getMBean('/Machines/Machine1')) cmo.setCluster('Cluster1') cd('/Servers/'+os.environ['MS_NAME']+'/SSL/'+os.environ['MS_NAME']) cmo.setEnabled(false) cd('/Servers/'+os.environ['MS_NAME']+'/ServerStart/'+os.environ['MS_NAME']) cmo.setArguments('-Xms512M -Xmx1024M') save() activate() disconnect() bin/wlst/create.server.py Andreas Koop 15
  • 16. MODULARIZE WLST SCRIPTS connect('weblogic', 'welco..) execfile('connect.py') execfile('connect.py') edit() execfile('connect.py') execfile('start.edit.session.py') startEdit() execfile('start.edit.session.py') execfile('start.edit.session.py') ## do something # do something do something try: execfile('end.edit.session.py') execfile('end.edit.session.py') save() execfile('end.edit.session.py') execfile('disconnect.py') execfile('disconnect.py') execfile('disconnect.py') activate() exit() exit() except ... exit() .. bin/wlst/myscriptX.py disconnect() Andreas Koop 16
  • 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
  • 18. WLST DOMAIN INTERACTION Quelle: Oracle FMW Doc Lib Andreas Koop 18
  • 19. DOMAIN STARTUP nmConnect('Dh4bZwJNNP', 'welcome1', DOMAIN_NAME, NM_PORT) nmStart('AdminServer') nmStart('WLS_FORMS') nmStart('WLS_REPORTS') nmStart('WLS_DISCO') nmStart('WLS_MY_APPS') .. nmDisconnect() exit() bin/wlst/start.domain.py Andreas Koop 19
  • 20. WLST NODE MANAGER ENCRYPTED PASSWORD nmConnect('Dh4bZwJNNP', 'welcome1', DOMAIN_NAME, NM_PORT) storeUserConfig(userConfigFile = .., userKeyFile = .., true) disconnect() # Ab jetzt: Anmeldung ohne Passwort im Klartext nmConnect(userConfigFile = NM_HOME + '/userconfigNM.secure', userKeyFile = NM_HOME + '/userkeyNM.secure', domainName = DOMAIN_NAME, port='5556') exit() Andreas Koop 20
  • 21. DOMAIN SHUTDOWN NM_HOME = WL_HOME + '/common/nodemanager' nmConnect(userConfigFile = NM_HOME + '/userconfigNM.secure', userKeyFile = NM_HOME + '/userkeyNM.secure', domainName = DOMAIN_NAME, port='5556') nmKill('WLS_FORMS') nmKill('WLS_REPORTS') nmKill('WLS_DISCO') nmKill('WLS_MY_APPS') .. nmKill('AdminServer') nmDisconnect() exit() bin/wlst/shutdown.domain.py Andreas Koop 21
  • 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
  • 23. LOGGING KONFIGURATION execfile('connect.py') execfile('start.edit.session.py') cd('/Servers/AdminServer/Log/AdminServer') cmo.setStacktraceDepth(5) cmo.setRotationType('bySize') cmo.setDomainLogBroadcasterBufferSize(10) cmo.setLog4jLoggingEnabled(false) cmo.setNumberOfFilesLimited(false) cmo.setDateFormatPattern('dd.MM.yyyy HH:mm' Uhr 'z') cmo.setBufferSizeKB(8) cmo.setFileMinSize(5000) cmo.setLoggerSeverity('Info') cmo.setRotateLogOnStartup(false) .. cmo.setRedirectStdoutToServerLogEnabled(true) cmo.setFileName('logs/AdminServer.log') execfile('end.edit.session.py') execfile('disconnect.py') exit() Andreas Koop 23
  • 24. DEPLOYMENT ‣ Data Source vorbereiten Java EE App ‣ Targets deploy ‣ Deploy ‣ Application ‣ Shared Libs App1 App2 ‣ EJBs Andreas Koop 24
  • 25. DATA SOURCE ANLEGEN ‣ JNDI Lookup #connect(..), edit() startEdit() cd('/') create('myDataSource', 'JDBCSystemResource') cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource') create('myJdbcDriverParams','JDBCDriverParams') cd('JDBCDriverParams/myDSName') set('DriverName','oracle.jdbc.OracleDriver') set('URL','jdbc:oracle:thin:@localhost:1521:XE') set('Password', 'HR') set('UseXADataSourceInterface', 'false') create('myProps','Properties') cd('Properties/myDSName') create('user', 'Property') cd('Property/user') cmo.setValue('HR') .. cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource') create('myJdbcDataSourceParams','JDBCDataSourceParams') cd('JDBCDataSourceParams/myDSName') set('JNDIName', java.lang.String("jdbc/hrDS")) Andreas Koop 25
  • 26. DATA SOURCE ENCRYPTED PASSWORD Shell akmac2:doag1_domain ak$ . ./bin/setDomainEnv.sh akmac2:doag1_domain ak$ java weblogic.security.Encrypt HR {AES}s77UdlHeZXMziW4i8WoPxBSN/DovWtnpYEPTJbBQ70M= create.datasource.py .. cd('/') create('myDataSource', 'JDBCSystemResource') .. set('PasswordEncrypted', '{AES}s77UdlHeZXMziW4i8WoPxBSN/DovWtnpYEPTJbBQ70M=') .. set('Targets',jarray.array([ObjectName('com.bea:Name=MS1,Type=Server')], ObjectName)) Andreas Koop 26
  • 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
  • 30. DEPLOYMENT COMMANDS Command deploy(appName, path, [targets], [stageMode], [planPath], [options]) startApplication(appName, [options]) stopApplication(appName, [options]) undeploy(appName,[targets],[options]) Mittels plan.xml updateApplication(appName, [planPath], [options]) aktualisieren listApplications() Andreas Koop 30
  • 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
  • 32. SIDE-BY-SIDY DEPLOYMENT deploy('myApp', '/path/to/myApp.ear', ..,appVersion = '1.0') Bestehende Client- Verbindungen app v1.0 app v2.0 Neue Client- Verbindungen deploy('myApp', '/path/to/myApp.ear', ..,appVersion = '2.0') Andreas Koop 32
  • 33. SERVER MONITORING .. state('<ServerName>') .. domainConfig() serverNames = cmo.getServers() domainRuntime() for name in serverNames: cd("/ServerRuntimes/"+name.getName()+"/JVMRuntime/"+name.getName()) heapFree = int(get('HeapFreeCurrent'))/(1024*1024) heapTotal = int(get('HeapSizeCurrent'))/(1024*1024) heapUsed = (heapTotal - heapFree) print '%14s %4d MB %4d MB %4d MB' % (name.getName(),heapTotal, heapFree, heapUsed) Andreas Koop 33
  • 34. SERVER THREAD DUMP .. threadDump(writeToFile='true',fileName='/tmp/threaddump.txt', serverName='AdminServer') .. Andreas Koop 34
  • 35. DOMAIN CONFIG AS CODE Domain Configuration wls:offline>configToScript(configPath='$DH', pyPath='config.mydomain.py') MDS per Application wls:online>exportMetadata(application='doag- demo', server='AdminServer', toLocation='/tmp/exportmds' User / Groups Embedded LDAP wls:online> domainRuntime() cd(‘/DomainServices/ DomainRuntimeService/DomainConfiguration/<domain>/ SecurityConfiguration/<domain>/DefaultRealm/myre alm/ AuthenticationProviders/DefaultAuthenticator’) cmo.exportData('DefaultAtn', '/export.ldif', Properties()) Andreas Koop 35
  • 36. WLST RECORDING FEATURE ‣ WebLogic Console Record (Aufzeichnen)-Button klicken ‣ Gewünschte Konfiguration vornehmen ‣ Generiertes WLST-Skript anpassen und integrieren Andreas Koop 36
  • 37. CONCLUSION ‣ WLST RULEZ! ‣ MUST for every Oracle FMW Admin! ‣ Vollständige Automatisierung von ‣ Domainerstellung, -konfiguration ‣ Application, Library Deployment ‣ Export / Import MDS ‣ Server - Startup / Shutdown - Monitoring Andreas Koop 37
  • 38. VIELEN DANK FÜR IHRE AUFMERKSAMKEIT HABEN SIE NOCH FRAGEN?

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. WLS Domain\n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. DEMO: Domain erstellen\n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. TODO: ugb fragen bzgl. erstellung der userconfig keys\nWarum keine Loop &amp;#xFC;ber alle Server?\n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. - retireTimeout Parameter vorhanden\n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. -Braucht man WLST in ZEiten von Cloud Control noch?\n- Wie schauts mit WebCenter, SOA, BPM Modulen aus? Gibt es seitens WLST unterst&amp;#xFC;tzung?\n
  39. \n