oracle middleware forum canberra: ci fundamentals - wlst

13
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Continuous Integration Fundamentals WLST Joel Nation, Senior Solution Architect

Upload: joelith

Post on 11-Nov-2014

462 views

Category:

Software


2 download

DESCRIPTION

Presentation from the Oracle Middleware Forum Canberra. This covers the fundamentals of WLST. Check out ofmcanberra.wordpress.com for more information as well as links to the resources mentioned in this presentation

TRANSCRIPT

Page 1: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Continuous Integration FundamentalsWLST

Joel Nation, Senior Solution Architect

Page 2: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

WebLogic Scripting Tool (WLST)• Scripting tool for administering a domain• Based on Jython• Great for automating repetitive tasks– Configuring domains– Creating domains– Starting servers– Deploy applications

2

Page 3: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

How to use it• Via command line:– java weblogic.WLST

– wlst.sh

• With a jython script– wlst.sh script.py

• This will set the domain environment variables

• In Java code– import weblogic.management.scripting.utils.WLSTInterpreter

Page 4: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Online/Offline• Online mode: connect to a running admin or

managed server– Modifies server’s config MBeans directly

– Equivalent to manual changes in the WebLogic console

• Offline mode: not connected to a running domain– Offline edits on a running domain will be ignored

Online Offline

Create/modify templates X

Create/extend domains X

Change domain configuration X Limited

View runtime performance data X

Modify security data X

Deploy applications X

Page 5: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Example 1: Modify Listen Port

readDomain(‘<path to domain>’)

cd(‘Server/AdminServer’)

set(‘ListenPort’, 7777)

updateDomain()

exit()

5

Page 6: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Example 2: Recording• You can record your changes in the WebLogic console– Note: Not all changes will be recorded

• This will output a script of all the changes you made

• Use this to upgrade any other domains, or use this as a basis for your domain creation script

Page 7: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Templates• Use domain templates to create a domain– Several shipped with WLS– Create your own using Template Builder–Modify an existing template using WLST offline

• Use templates when domain is complete– Use scripts when developing your domain

WLS WLS

Page 8: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Example 3: Build domainhttps://github.com/Joelith/wlst/blob/master/OSB/osb_domain.py

Page 9: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Example 4: Starting Servershttps://github.com/Joelith/wlst/blob/master/OSB/osb_build.sh

• startServer()• Recommended to use node manager:– nmStart()

• Make sure ‘StartScriptEnabled’ is set in your node manager properties–Otherwise, pass startup properties to nmStart. Eg:

args = "Arguments=\" -server -Xms512m -Xmx768m -XX:MaxPermSize=256m -Xrs\""prps = makePropertiesObject(args)nmStart('AdminServer', props=prps)

Page 10: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Deployments• Online:– Use the deploy command: deploy(appName, path)

• Offline:– Add an application to a template: addApplication(appName)

• OSB (online):– Get a session, upload the JAR, activate the session

Page 11: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Example 5: OSB Deploymenthttps://github.com/Joelith/wlst/blob/master/OSB/osb_deploy.py

Page 12: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Make Life Easier• Install rlwords so you can use directional arrows– Install EPEL– Download word list from https://blogs.oracle.com/johngraves/resource/code/wlst.words – Add an alias for wlst in bash_profile

alias wlst='rlwrap -f /home/oracle/.rlwords --multi-line java weblogic.WLST'

• Use a syntax highlighter for scripts – WLST Sublime plugin: https://github.com/Joelith/sublime-wlst (or use PackageControl)

• Disable module scanning on WLST startup with -skipWLSModuleScanning• Language reference: http://docs.oracle.com/cd/E13222_01/wls/docs90/config_scripting/reference.html

Page 13: Oracle Middleware Forum Canberra: CI Fundamentals - WLST

13