• Save
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Upcoming SlideShare
Loading in...5
×
 

Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)

on

  • 507 views

 

Statistics

Views

Total Views
507
Slideshare-icon Views on SlideShare
507
Embed Views
0

Actions

Likes
2
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013) Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013) Presentation Transcript

    • DOAG 2013 IMC,Mainz, 06. Juni 2013Andreas KoopCEO & ConsultantOracle TechnologiesDEPLOYMENT BEST PRACTICESON WEBLOGIC SERVERChallengesStrategiesPlanBest Practices
    • Andreas KoopCEO & ConsultantOracle TechnologiesABOUTConsulting, Training Oracle Fusion MiddlewareADF Certified Implementation SpecialistCommunityDOAG, ADF EMG, ADF German Community, Twitter @multikoopBlogTechnical http://multikoop.blogspot.comSonstiges http://www.enpit.de/blog2
    • Training DevelopmentConsultingOracle FusionMiddlewareOracleADFOracleWebLogicOracleWebCenterENTERPRISE PRAGMATIC IT
    • Andreas KoopAGENDADeployment ChallengesDeployment Tools & StrategiesDeployment PlanProduction RedeploymentPain Points & Conclusion4
    • Andreas KoopDEPLOYMENT CHALLENGES‣ Multiple Apps, multiple versions, instant releases..‣ Application development becomes easy,Middleware becomes complex:DataSources, WebServices, Processes, JMS, MDS,App Roles, Permissions, custom configuration,What else?‣ Who can handle this?5
    • Andreas KoopAPPLICATION DEPLOYMENTOVERVIEW‣ Prepare‣ Copy deployment units totarget servers if needed‣ Deploy‣ Shared Libraries‣ ApplicationsDataSourcesJMS Topics/QueuesEJBs..6AS App1 App2App / LibdeployCluster(sample topology)
    • Andreas KoopWEBLOGIC DEPLOYMENTTOOLS‣ java weblogic.Deployer (. ./setWLSEnv.sh)‣ Ant Task / Maven / Autodeploy=> Development / Test‣ WLST Commands=> Development / Test / Production‣ Admin Console / EM=> Development / AdHoc Cases / Support7! Do not use inProductionMy Favorit! Gives alot of predictability andsafety!
    • Andreas KoopSTAGING MODE: STAGE FORSMALL APPLICATIONS‣ Admin Server copiesdeployment unit toservers/<name>/stage‣ Managed Servers deployusing their local copy‣ => Use for smallapplications !8AS App1 App2Appdeployearearcopyearcopy(sample topology)
    • Andreas Koop‣ Admin Server does notcopy deployment units‣ shared, directlyaccessibly by AS and MS‣ => Use for largeapplications or exploded-->Reload of JSP/Servlet‣ => Saves time!AS App1 App2STAGING MODE: NO STAGEFOR LARGE APPLICATIONS9/shared/apps/myapp1.earAppdeploy(sample topology)
    • Andreas Koop‣ Admin Server does notcopy deployment units‣ Manuel copy to AS andMS needed‣ => Use if no shared fsavailable‣ => Use if scripts formanual distrib. existsSTAGING MODE: EXTERNALSTAGE FOR...10AS App1 App2AppdeployearcopyearcopyearcopyAdminGuy(sample topology)
    • Andreas KoopWHERE TO LOCATEDEPLOYMENT UNITS‣ ! Prerequisite: Do not use default for domain home:$MW_HOME/user_projects/domains‣ Locate domain outside $MW_HOME‣ Locate App artefacts outside $MW_HOME11/domains/mydomain//applications/mydomain/myapp1/1.0/app/myapp1.ear/applications/mydomain/myapp1/1.0/plan/plan.xml
    • Andreas KoopQUIZ: WHAT DO THAT OPTIONSMEAN? (FROM ADMIN CONSOLE)12AS uses nostage bydefaultMS uses stage bydefaultdependsstagenostage
    • Andreas KoopDEPLOY WITH ANT13<?xml version="1.0" encoding="UTF-8" ?><project name="deploy-myapp" default="deploy"><path id="weblogic.deploy.path"><fileset file="${weblogic.home}/server/lib/weblogic.jar" /><fileset file="${weblogic.home}/server/lib/webservices.jar" /></path><taskdef name="wldeploy"classname="weblogic.ant.taskdefs.management.WLDeploy"classpathref="weblogic.deploy.path" /><target name="deploy"></target></project><wldeploy action="deploy"user="${weblogic.user}"password="${weblogic.password}"adminurl="${weblogic.adminurl}"source="${app.webapp}" name="${app.name}"targets="${weblogic.targets}" verbose="true"debug="false"/>
    • Andreas KoopDEPLOY WITH ANTEXTENDED14<?xml version="1.0" encoding="UTF-8" ?><project name="deploy-myapp" default="deploy">...<!-- WLS Taskdefs --><path id="wls.classpath"><fileset dir="${oracle.weblogic.home}/server/lib" includes="weblogic.jar"/></path><taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask"classpathref="wls.classpath"/><target name="deploy"><echo message=" Deploying application ... "/></target>...</project><wlst debug="true" failOnError="true" classpathref="wls.classpath"fileName="./wlst/deploy.py"arguments="....." ></wlst>Reuse existing WLSTScripts!
    • Andreas KoopDEPLOY WITH MAVENPREPARE‣ Need to generate maven plugin with the WebLogicJarBuilder Tool (at least in 11g)‣ Install into Maven Repository(see documentation)‣ Use in your projects pom.xml (see next slide)15$ java -jar wljarbuilder.jar -profile weblogic-maven-plugin....Created new jar file: ../wlserver_10.3/server/lib/weblogic-maven-plugin.jar
    • Andreas KoopDEPLOY WITH MAVENUSE‣ Directly‣ In ,install‘ Maven Lifecycle of your pom.xml16$ mvn weblogic:deploy<plugin>  <groupId>com.oracle.weblogic</groupId>  <artifactId>weblogic-maven-plugin</artifactId><version>10.3.6</version><configuration><adminurl>t3://localhost:7001</adminurl><user>weblogic</user><password>password</password><name>myapp</name><upload>true</upload><targets>AdminServer</targets> </configuration>
    • Andreas KoopDEPLOY WITH MAVENUSE‣ In ,install‘ Maven Lifecycle of your pom.xml17... <executions><execution><id>deploy</id><phase>install</phase>     <goals>       <goal>deploy</goal>     </goals>     <configuration>       <source>deploy/myapp.war</source>     </configuration>   </execution> </executions></plugin>
    • Andreas KoopDEPLOYMENT WITH ANT / MVNCONCLUSION‣ „Pure Ant“ WebLogic Deployment Tasks are notpowerful enough.‣ Extend where needed with custom WLST scripts‣ Fits typically well in existing CI Build Environment‣ Extended Maven Features in WLS 12c : create-domain, start-server .... !18
    • Andreas KoopDEPLOY WITH WLSTHOW TO19connect(weblogic, welcome1, ADMIN_URL)deploy(myApp, /path/to/myApp.ear, targets=Cluster1)# targets=Server1startApplication(myApp)disconnect()exit()
    • Andreas KoopUNDEPLOY WITH WLSTHOW TO20connect(weblogic, welcome1, ADMIN_URL)stopApplication(myApp)undeploy(myApp)# default: from all targetsdisconnect()exit()
    • Andreas KoopWLST DEPLOYMENTCOMMANDS21Commanddeploy(appName, path, [targets], [stageMode], [planPath], [options])startApplication(appName, [options])stopApplication(appName, [options])undeploy(appName,[targets],[options])updateApplication(appName, [planPath], [options])Update app withplan.xmllistApplications()
    • Andreas Koop‣ Always start with a cluster - even if only a singleMS is needed at the beginning‣ => Easily to scale afterwards‣ => No changes to deploymentstrategy neededDEPLOY TO A CLUSTER FROMTHE BEGINNING22App1 / LibdeployApp1ClusterApp1ClusterApp1...
    • Andreas KoopHANDLING DIFFERENT ENVREQUIREMENTS23Development Test ProductionDataSource DataSource DataSourceweblogic.xmljsp-descriptor/verbose= true...weblogic.xmljsp-descriptor/verbose= false...weblogic.xmljsp-descriptor/verbose= false...web.xmlinit-param/name[css-compression]=offsession-timeout = 3600...web.xmlinit-param/name[css-compression]=onsession-timeout = 60...web.xmlinit-param/name[css-compression]=onsession-timeout = 7200.........
    • Andreas KoopHANDLING DIFFERENT ENVREQUIREMENTS24Development Test ProductionDataSource DataSource DataSourceplan.xmlweb.xml -> session-timeout = 3600weblogic.xml -> ...plan.xmlweb.xml -> session-timeout = 60weblogic.xml -> ...plan.xmlweb.xml -> session-timeout = 7200weblogic.xml -> ...EAR EAR EAR......deploy deploy deploy+ ++
    • Andreas KoopWHAT IS A DEPLOYMENT PLAN‣ Plan (plan.xml) used with deployment artefact‣ Replacing values by XPath / Variables‣ Useful for‣ Changes to web.xml / weblogic.xml / Other XML‣ ! No changes to .properties possible‣ „Deploy myapp.ear -plan /path/to/plan.xml ...“25
    • Andreas KoopDEPLOYMENT PLANCREATION / EDITING‣ Working with plan.xml and plain text editor isdifficult! Best Practice: OEPE plan.xml Editor!26Or use,java weblogic.PlanGenerator‘
    • Andreas KoopEDIT DEPLOYMENT PLANWITH OEPE‣ Nice XPath Editor included! easy selection ofassignable elements and selection on variable!27
    • Andreas KoopHOW TO DEPLOY WITH PLAN‣ weblogic.Deployer‣ Or with WLST‣ Or Admin Console / EM28deploy(myApp, /path/to/1.0/app/myApp.ear, plan=/path/to/1.0/plan/plan.xml ..)java weblogic.Deployer .... -plan /path/to/1.0/plan/plan.xml ...
    • Andreas KoopUSE SHARED LIBRARIES‣ Static content: js, css, images‣ Common Functionality, Modules29
    • Andreas KoopHOW TO BUILDSHARED LIBRARIES30MANIFEST.MF
    • Andreas KoopHOW TO DEPLOYSHARED LIBRARIES‣ weblogic.Deployer‣ Or WLST31#!/bin/sh. $WL_HOME/server/bin/setWLSEnv.shjava weblogic.Deployer -adminurl t3://eden.local:7001 -username weblogic -password welcome1 -upload -library -targets Cluster1 -deploy -source enpit-shared-lib.war...deploy(enpit-shared-lib, /path/to/enpit-shared-lib.war,targets=Cluster1,libraryModule=true[, upload=true])
    • Andreas KoopHOW TO CONSUMESHARED LIBRARIES‣ Configure references in weblogic.xml or weblogic-application.xml32<?xml version=1.0 encoding=UTF-8?><weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd"xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">...<library-ref><library-name>enpit-common-lib</library-name><!--specification-version>1.0</specification-version><implementation-version>1.0.6</implementation-version><exact-match>true</exact-match--></library-ref></weblogic-web-app>
    • Andreas KoopSHARED LIBRARIES -POSSIBLE ERRORS‣ Precondition: Shared Library is referenced. App isrunning‣ Solution‣ Deploy Library as new version‣ „Production redeploy“ dependent application33Cannot undeploy library Extension-Name: enpit-common-war-lib, Specification-Version: 1,Implementation-Version: 1.0.4 from server AdminServer, because the following deployed applicationsreference it: enpittestcommons-reflib.war
    • Andreas KoopSECURITY DEPLOYMENTCONSIDERATIONS‣ Security Realm <- JAAS Security Standard <- OPPSProvider34<security-constraint><web-resource-collection><web-resource-name>administration</web-resource-name><url-pattern>/admin/*.jsp</url-pattern><http-method>GET</http-method><http-method>POST</http-method></web-resource-collection><auth-constraint><role-name>admin-users</role-name></auth-constraint></security-constraint><login-config><auth-method>BASIC</auth-method><realm-name>jazn.com</realm-name></login-config><security-role><role-name>admin-users</role-name></security-role>web.xml
    • Andreas KoopSECURITY DEPLOYMENTCONSIDERATIONS‣ Deployment Descriptor (DD only, Java EE Standard)‣‣ Custom Roles Model=> Any DD Role-Mapping is ignored‣ Custom Roles and Policy Model=> Not recommended for fine-grained control35<security-role-assignment><role-name>admin-users</role-name><principal-name>Administrator</principal-name></security-role-assignment>weblogic.xml
    • Andreas KoopSECURITY DEPLOYMENTCONSIDERATIONS‣ system-jazn-data.xml (OPSS specific)‣ The best tool currently is Enterprise Manager36BPM Role Mapping forinstance
    • Andreas KoopPRODUCTION REDEPLOYMENT37app v1.0 app v1.0.1Existing clientconnectionsNew ClientConnectionsdeploy(myApp, /path/to/myApp.ear, ..,appVersion = 1.0)deploy(myApp, /path/to/myApp.ear, ..,appVersion = 1.0.1)
    • Andreas KoopPRODUCTION REDEPLOYMENTBEST PRACTICE38‣ Provide Version information insideMANIFEST.MF‣ Set version during CI build process!‣ Specify retire grace period on redeploy‣ Retire immediately... -redeploy -source ...myapp.ear -retiretimeout 300... -undeploy -name myapp -appversion 1.0Arggh. Need thelower version no. Noteasy to automate...
    • Andreas KoopSOLUTION FORUNDEPLOY RETIRED APPS39def undeploy_retired_apps(l_appName):cd (AppDeployments)l_apps=cmo.getAppDeployments()for app in l_apps:domainConfig()cd (/AppDeployments/+app.getName()+/Targets)l_targets = ls(returnMap=true)domainRuntime()cd(AppRuntimeStateRuntime/AppRuntimeStateRuntime)for target in l_targets:l_state=cmo.getCurrentState(app.getName(),target)if app.getName().find(l_appName) != -1:if l_state == STOP_RUNNING:log_info (Found:+ app.getName()+ - +str(l_state))stopApplication(app.getName())l_state=cmo.getCurrentState(app.getName(),target)if l_state == STATE_RETIRED:log_info (Found:+ app.getName()+ - +str(l_state))undeploy_app(app.getName())undeploy_retired_apps()
    • Andreas KoopPRODUCTION REDEPLOYMENTBEST PRACTICE40‣ Rollback deployment to previousversion is an easy task‣ Keep in mind: In-Place redeployment destroysexisting sessions! To keep the session state:... -redeploy -source .../1.0/app/myapp.earweblogic.xml..<container-descriptor><save-sessions-enabled>true</save-sessions-enabled></container-descriptor>..!Hower, theapplication will not beavailable at redeploy!
    • Andreas KoopPAIN POINTS AND POSSIBLESOLUTIONS‣ Custom configuration dataSuggestion: Properties accessible by JNDI (See GlassFish)‣ Single Security Policy Store for all applications(system-jazn-data.xml)Recommendation: OID or DB based Policy-StoreSuggestion: Policy-Store bundled with app deployment41App1DomainApp 2system-jazn-data.xml- Role-Mapping App1- Role-Mapping App2- Permissions App1- Permissions App2
    • Andreas KoopCONCLUSION‣ Automate from the beginning‣ Stage mode depends on app size, existinginfrastructure‣ Use deployment plans & „productionredeployment“‣ Use shared libs where applicable42
    • Andreas KoopFURTHER READING‣ Oracle FMW Admin Guidehttp://docs.oracle.com/cd/E23943_01/core.1111/e10105/deployer_role.htm‣ Oracle FMW Deploying Applications to WLShttp://docs.oracle.com/cd/E23943_01/web.1111/e13702/toc.htm‣ Community / Blogshttp://middlewaremagic.comhttp://weblogic-wonders.comhttp://weblogic-tips.com...43
    • VIELEN DANK FÜR IHREAUFMERKSAMKEITHABEN SIE NOCH FRAGEN?