Oracle WebLogic for DevOps

Post on 13-Jan-2015

916 views 0 download

description

Vortrag von Andreas Koop (@enpit) auf der DOAG 2013 Konferenz zum Thema WebLogic im Kontext einer DevOps Strategie (#doag2013).

Transcript of Oracle WebLogic for DevOps

DOAG 2013 Konferenz+Ausstellung

Andreas KoopGeschäftsführung

& Consulting

WEBLOGIC FOR DEVOPS

Andreas KoopGeschäftsführung

& ConsultingÜBER MICH

Beratung, Training Oracle TechnologieADF Certified Implementation Specialist

CommunityDOAG, ADF EMG, ADF German Community, Twitter @multikoop

BlogTechnical http://multikoop.blogspot.comSonstiges http://www.enpit.de/blog

2

Training DevelopmentConsultingOracle Business

IntelligenceOracle ADFADF Mobile

OracleWebLogic

OracleWebCenter

ENTERPRISE PRAGMATIC IT

Oracle Fusion Middleware

3

Andreas Koop

AGENDA

Wer oder Was ist „DevOps“?

WebLogic „DevOps Features“ Silent Install, JMX, WLST, RESTful Services

Automatisierung mit Vagrant und Puppet

Fazit

4

Andreas Koop

KNACKPUNKTE

5

Entwicklung / Integration

Betrieb

AntMavenGradle

wldeploy1x Umgebung...

BashPerl

WLST

10+x Umgebungen...

StabilPerformant

24x7 VerfügbarLogging

Monitoring

Andreas Koop

KNACKPUNKTE ZWISCHEN ENTWICKLUNG UND BETRIEB‣ „Silo-Denke“ - Meist keine übergreifende

Zusammenarbeit vorhanden

‣ Es werden meist unterschiedliche Ziele verfolgt (New Features / Versions <-> Gesicherter Lifecycle)

‣ Unterschiedliche Definition von „Fertig!“

‣ Automatisierung unzureichend genutzt

‣ Veränderungswille oft nicht gegeben6

Andreas Koop

HERAUSFORDERUNGEN IM BETRIEB GROßER APPS‣ Provisionierung von „Maschinen“

‣ Konfiguration von Servern

‣ Deployment von Apps

‣ (Performance) Monitoring

‣ Hochverfügbarkeit

7

Andreas Koop

DEVOPS WIRD GEBOREN

8

Quality AssuranceDev

elopm

ent

Operations

DevOps

Quelle: http://www.collab.net/solutions/devops

plan code build test release deploy operate

Agile Development

Continuous Integration

Continuous Delivery

DevOps

Andreas Koop

DEVOPS IST...‣ Ganzheitliche Betrachtung von

Entwicklung und Betrieb

‣ Konfliktminimierung

‣ „Environment as Code“

‣ Automatisierung von Build Test, Release, Deployment

9

Andreas Koop

AGENDA

Wer oder Was ist „DevOps“?

WebLogic „DevOps Features“ Silent Install, JMX, WLST, RESTful Services

Automatisierung mit Vagrant und Puppet

Fazit

10

Andreas Koop

WEBLOGIC „DEVOPS FEATURES“‣ Silent Installation

‣ JMX MBean Zugang

‣ WLST (Scripting Tool)

‣ Deployment Plans

‣ RESTful Management Services

11

Andreas Koop

WEBLOGIC SILENT INSTALLATION (1/2)‣ WebLogic Version < 12.1.2

java -jar wls1036_generic.jar -mode=silent -silent_xml=silent.xml

12

<bea-installer> <input-fields> <data-value name="BEAHOME" value="/opt/oracle/middleware" /> <data-value name="WLS_INSTALL_DIR" value="/opt/oracle/middleware/wlserver_10.3" /> <data-value name="COMPONENT_PATHS" ! value="WebLogic Server/Core| usw.." /> ... <!-- For Windows Installationa -->

<data-value name="INSTALL_NODE_MANAGER_SERVICE" value="yes" /> <data-value name="NODEMGR_PORT" value="5559" /> <data-value name="INSTALL_SHORTCUT_IN_ALL_USERS_FOLDER" value="yes"/>

<!-- <data-value name="LOCAL_JVMS"! value="/opt/oracle/jrockit_160_05"/> -->

</input-fields> </bea-installer>

Weitere Parameter: http://docs.oracle.com/cd/E24329_01/doc.1211/e24492/silent.htm

Andreas Koop

WEBLOGIC SILENT INSTALLATION (2/2)‣ WebLogic Version >= 12.1.2

java -jar wls_121200.jar -silent -response /home/oracle/install/wls.rsp

13

[ENGINE] #DO NOT CHANGE THIS.Response File Version=1.0.0.0.0 [GENERIC] #The oracle home location. This can be an existing Oracle Home or a new Oracle HomeORACLE_HOME=/opt/oracle/middleware #Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples.INSTALL_TYPE=WebLogic Server...

Weitere Parameter: http://docs.oracle.com/middleware/1212/core/OUIRF/silent.htm

Andreas Koop

JMX MBEANS‣ Java Management Extension

‣ MBeans haben Attribute und Operationen

‣ WebLogic MBeans bieten Zugang zuKonfigurations- und Laufzeitdaten

14

JMX ermöglicht erst die vollständige Automatisierung von WebLogic Konfigurationen & Monitoring !

Andreas Koop

JMX TOOLS‣ Prominent Tools

WLS Admin Console, EM, JConsole, WLST

‣ Less prominent

‣ WLS RESTful Management Services

‣ Jolokia*Remote JMX with JSON over HTTP

‣ wlsagent**Nagios Plugin by remote JMX over HTTP

15

*: http://www.jolokia.org**:https://code.google.com/p/wlsagent/

Andreas Koop

JMX JAVA CLIENT (1/2)‣ Open JMX Connection

16

...Map<String, String> map = new HashMap<String,String>();

// User credentialsmap.put(Context.SECURITY_PRINCIPAL, "weblogic");map.put(Context.SECURITY_CREDENTIALS, "welcome1");

// Use a t3 connector with a 20 seconds timeoutmap.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");map.put("jmx.remote.x.request.waiting.timeout", "20000");

// We build the URL with the sample 'hostname' and 'port' paramsJMXServiceURL url = new JMXServiceURL("service:jmx:t3://adminhost:7001/jndi/weblogic.management.mbeanservers.runtime");connector = JMXConnectorFactory.connect(url, map);connection = connector.getMBeanServerConnection();...

Andreas Koop

JMX JAVA CLIENT (2/2)‣ Read MBean Attributes (Sample: ServerRuntime)

17

// Obtain reference to WebLogic server MBean - ServerRuntimeObjectName serverRuntimeMBean = (ObjectName)connection.getAttribute(new ObjectName("com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean"), "ServerRuntime");

// Sample output: ManagedServer1 String serverName = (String)connection.getAttribute(serverRuntimeMBean, "Name");

// Sample output: RUNNINGString serverState = (String)connection.getAttribute(serverRuntimeMBean, "State");...

Andreas Koop

WEBLOGIC SCRIPTING TOOL‣ Jython basierte Scriptsprache zur Automatisierung jeglicher WebLogic

Administrationsaufgabe

‣ Read / Write MBeans

‣ Offline

‣ ~ ConfigurationWizard

‣ Online

‣ ~ Administration Console

18

Andreas Koop

DOMAIN ERSTELLEN

19

readTemplate(os.environ['WL_HOME'] + '/common/templates/domains/wls.jar')cd('/')cmo.setName('my_domain')cd('Servers/AdminServer')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()

Current Management Object

Andreas Koop

HOW TO DEPLOY

20

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

deploy('myApp', '/path/to/myApp.ear', targets='Cluster1')# targets='Server1'startApplication('myApp')

disconnect()exit()

Andreas Koop

HANDLING DIFFERENT ENV REQUIREMENTS WITH PLANS

21

Development Test Production

DataSource DataSource DataSource

plan.xml

web.xml -> session-timeout = 3600

weblogic.xml -> ...

plan.xml

web.xml -> session-timeout = 60

weblogic.xml -> ...

plan.xml

web.xml -> session-timeout = 7200

weblogic.xml -> ...

EAR EAR EAR

......

deploy deploy deploy

+ ++

Andreas Koop

WEBLOGIC RESTFUL MANAGEMENT SERVICES‣ Abfrage per REST-URL (XML oder JSON) von

Server StatusApplicationsClustersData Sources

‣ Vorherige Aktivierung in der Admin Console notwendig

22

Andreas Koop

WEBLOGIC RESTFUL MANAGEMENT SERVICES‣ http://host:port/management/tenant-monitoring/

servers

‣ Test-Client http://host:port/management/ajaxtest.html

23

Andreas Koop

AGENDA

Wer oder Was ist „DevOps“?

WebLogic „DevOps Features“ Silent Install, JMX, WLST, RESTful Services

Automatisierung mit Vagrant und Puppet

Fazit

24

Andreas Koop

Konfigurations-werkzeug

JDeveloper

Tools

DATABASE_TEST

WLS_DOMAIN_TEST

DATABASE_INT

WLS_DOMAIN_INT

DATABASE_PROD

WLS_DOMAIN_PROD

HERAUSFORDERUNG GLEICHE UMGEBUNGEN

DevVMTemplate

TestVMTemplate

ProdVMTemplate

VM Provisioning Service

Konfiguration

Konfiguriert und Überwacht

Stellt Basismaschine bereit

Andreas Koop

DevVMTemplate

TestVMTemplate

ProdVMTemplate

VM Provisioning Service

Konfiguriert und Überwacht

VM PROVISIONING SERVICE‣ Virtualisierung ermöglicht das schnelle

bereitstellen von Laufzeitumgebungen

‣ Basis für die Anforderung von GLEICHEN Umgebungen

‣ Warum nicht dieses Verfahren auch für Entwicklungsumgebung und Entwickler-Rechner nutzen ?

Beispieltool:

www.vagrantup.com

Andreas Koop

Konfigurations-werkzeug

KONFIGURATIONSWERKZEUG

Konfiguration

‣ Umgebungen sind vielzählig und unterliegen einem Wandel (Versionen, Patches, etc)

‣ Wieviele Administratoren werden benötigt, um den Betrieb von 10 Rechner eines Systems im Aufbau GLEICH zu halten ?

‣ Notwendigkeit: Automatisierung, Dokumentation, Konfiguration und Überwachung !

Beispieltool:

https://forge.puppetlabs.com/biemond/orautilsOracle PlugIns für puppet von Edwin Biemond

Andreas Koop

KONFIGURATIONS-MANAGEMENT MIT PUPPET‣ Automatisierung von Konfigurationen von

Computer SystemenUsers, Groups, Services, Packages, Deployments, etc..

‣ Verteilung im Netzwerk

28

user { 'oracle': ensure => 'present', home => '/home/oracle', shell => '/bin/bash'...}

host {"node1": ip => "10.10.0.101", host_aliases => ['node1.sample.com','node1']}

...

Master

NodeNode

Node

...

Andreas Koop

WLS PUPPET SAMPLE

29

https://forge.puppetlabs.com/biemond/orautilsBased on: Oracle PlugIns für puppet von Edwin Biemond

Andreas Koop

VAGRANT / PUPPET / WEBLOGIC SINGLE NODE

30

Local machineOracle VirtualBox

Software Repository (jdk, weblogic_121200.jar)

Source Repository(Github)

Vagrant

Git

Virtual Machine

VM Template Repository (centos64.box, oel64.box,...)

Puppet

Shared folders/vagrant/software

JDK

WLS

WLS Domain

Andreas Koop

VAGRANT / PUPPET / WEBLOGIC MULTIPLE NODES

31

Local machineOracle VirtualBox

Software Repository (jdk, weblogic_121200.jar)

Source Repository(Github)

Vagrant

Git

VM Template Repository (centos64.box, oel64.box,...)

...

...

Node1

Node2

NodeAdmin

Andreas Koop

MASTER IMAGES MIT PACKER ERSTELLEN‣ Identische VM Images aus Konfiguration erstellen

‣ Multi-Provider SupportVagrant BoxesVMWare Image TemplatesAmazon AMI

32

w w w . p a c k e r . i o

{"builders": [{ "type": "virtualbox", "iso_url": "...ubuntu-12.04.2-server-amd64.iso" }, ... ], [{ "type": "vmware", "iso_url": "...ubuntu-12.04.2-server-amd64.iso" }, ... ], [{ "type": "amazon-instance", "source_ami": "ami-d9d6a6b0" }, ... ],...}

...

VirtualBox Image(for Development e.g.)

VMWare Image(for Development e.g.)

Amazon EC2 Image(for Production e.g.)

...

...

Andreas Koop

FAZIT‣ WebLogic Installation / Patching / Konfiguration /

Monitoring lässt sich sehr gut automatisieren

‣ WebLogic Umgebungen „auf Knopfdruck“ möglich mit Vagrant, Puppet und WLST

‣ Höherer Aufwand zu Beginn

‣ Sehr hoher Nutzen mittelfristigRisikominimierungContinous Delivery

33

Andreas Koop

WEITERE INFORMATIONEN‣ Was ist DevOps?

http://radar.oreilly.com/2012/06/what-is-devops.html

‣ Accessing WebLogic Server MBeans with JMXhttp://docs.oracle.com/middleware/1212/wls/JMXCU/accesswls.htm

‣ Oracle RESTful Management Serviceshttp://www.oracle.com/technetwork/articles/soa/oliveira-wls-rest-javafx-1723982.htmlhttp://multikoop.blogspot.de/2011/12/restful-management-services-in-oracle.html

‣ Vagrant / Puppet / WLShttp://multikoop.blogspot.de/2013/11/setup-weblogic-12c-environment-with.html

34

VIELEN DANK FÜR IHRE AUFMERKSAMKEIT

HABEN SIE NOCH FRAGEN?