MintPress - Oracle Weblogic Automation Controller (oracle-weblogic)
Copyright 2014 © LimePoint Pty Ltd. All rights reserved.
Welcome to the MintPress Oracle Weblogic automation controller.
This gem provides support for the installation, patching, and configuration of Oracle Weblogic software and Weblogic domains.
Key Information (oracle-weblogic)
Name: oracle-weblogic
Minimum Supported Version (Oracle Weblogic + FMW): 12.2.1.3
Dependencies:
- LimePoint Automation Suite RPC Utils
- MintPress Utilities
- MintPress Logger
- MintPress Common
Structure
This gem has the following structure
│
├── CHANGELOG.md
├── Gemfile
├── LICENSE
├── README.md
├── Rakefile
├── build.sh
├── files
│ └── wlst
├── lib
│ ├── oracle-weblogic
│ │ ├── exception.rb
│ │ ├── installation.rb
│ │ ├── model
│ │ ├── patch.rb
│ │ ├── utils.rb
│ │ └── version.rb
│ └── oracle-weblogic.rb
├── oracle-weblogic.gemspec
├── templates
│ ├── 12
│ ├── install.rsp.erb
│ └── oraInst.loc.erb
└── test
-
lib/model
: Contains the Oracle Weblogic class model and related objects -
lib/installation
: Contains the Oracle Weblogic Installation class related objects -
lib/patch
: Contains the Oracle Weblogic Patch class related objects
MintPress::OracleWeblogic::Installation
and MintPress::OracleWeblogic::Domain
The main objects provided by this gem are MintPress::OracleWeblogic::Installation
, MintPress::OracleWeblogic::Patch
and MintPress::OracleWeblogic::Domain
. These objects are used to define Weblogic Installations, Patches, and Domain objects. Methods are available on these classes for performing associated actions against them, such as install
, create
, start_all
, and stop_all
.
A MintPress::OracleWeblogic::Installation and MintPress::OracleWeblogic::Patch are classes that provide all the methods to install and patch an Oracle Weblogic Installation.
A MintPress::OracleWeblogic::Domain is a class that provides all the methods to create and configure an Oracle Weblogic domain.
For full details on these classes and methods, please refer to the relevant detailed documentation MintPress::OracleWeblogic.
Example: Usage of MintPress::OracleWeblogic
Before you begin, create a number of host
objects
require 'oracle-weblogic'
# Don't repeat ourselves - a transport factory contains repeated credentials
MintPress::Infrastructure::TransportFactory.new(connect_user: 'mintpress', final_user: 'oracle').new
host1=MintPress::Infrastructure::Host.new('appserver1.mintpress.io')
host2=MintPress::Infrastructure::Host.new('appserver2.mintpress.io')
The following code creates two installation objects (of type Java provided by oracle-java gem. See MintPress::OracleJava for details). Each installation is associated with a transport. This is a one to one mapping. An installation can only be mapped to one and only one transport.
require 'oracle-java'
java_opts={
version: '1.8.0_172',
java_home: "/oracle/app/#{product}/java",
owner: 'oracle',
group: 'oinstall',
software_stage: '/oracle/stage/jdk/jdk-8u172-linux-x64.tar.gz'
}
java_installation1=MintPress::OracleJava::Installation.new(java_opts.merge(host: host1))
java_installation2=MintPress::OracleJava::Installation.new(java_opts.merge(host: host2))
Now we define an Oracle Weblogic installation pointing at this java - it will reuse its transport.
wls_install_opts={
version: '12.2.1.3',
fmw_home: "/oracle/app/#{product}/fmw",
inventory_location: "/oracle/app/#{product}/oraInventory",
software_stage: '/oracle/stage/wls/12.2.1.3/fmw_12.2.1.3.0_wls.jar',
opatch_autoupdate_file: '/oracle/stage/OPatch/p28186730_139400_Generic.zip'
}
wls_installation1=MintPress::OracleWeblogic::Installation.new(wls_install_opts.merge(java: java_installation1))
wls_installation2=MintPress::OracleWeblogic::Installation.new(wls_install_opts.merge(java: java_installation2))
Please note, again, these are definitions of the objects only. We have not yet started to perform actions on these. Think of these as the definition of the configuration before we operate on it.
Now, lets go ahead and create a definition of our Weblogic domain.
domain_opts={Name: 'wls_domain', AdminServerName: 'AdminServer', AdminUsername: 'weblogic', AdminPassword: admin_password, RootDirectory: '/oracle/app/wls/environments'}
domain=MintPress::OracleWeblogic::Domain.new(domain_opts, installations: [wls_installation1,wls_installation2])
Note: there are multiple installations now associated with the domain. Now lets go ahead and add machines to our domain.
domain.add_machine(Name: "appserver1.mintpress.io", installations: wls_installation1, transport: transport1,
NodeManager: { Name: "appserver1.mintpress.io", Home: "#{domain.domainHome}/nodemanager", ListenAddress: "appserver1.mintpress.io", ListenPort: 5566, UserName: 'weblogic', Password: admin_password, NMType: 'Plain'})
domain.add_machine(Name: "appserver2.mintpress.io", installations: wls_installation2, transport: transport2,
NodeManager: { Name: "appserver2.mintpress.io", Home: "#{domain.domainHome}/nodemanager", ListenAddress: "appserver2.mintpress.io", ListenPort: 5566, UserName: 'weblogic', Password: admin_password, NMType: 'Plain'})
Now we can add any additional managed servers and clusters
domain.add_server(Name: "wls_server1")
domain.add_server(Name: "wls_server2")
domain.servers['wls_server1'].machine=domain.machines['appserver1.mintpress.io']
domain.servers['wls_server1'].listen_address = 'appserver1.mintpress.io'
domain.servers['wls_server1'].listen_port = 8010
domain.servers['wls_server1'].ssl.enabled = true
domain.servers['wls_server1'].ssl.listen_port = 8020
domain.servers['wls_server2'].machine=domain.machines['appserver2.mintpress.io']
domain.servers['wls_server2'].listen_address = 'appserver2.mintpress.io'
domain.servers['wls_server2'].listen_port = 8010
domain.servers['wls_server2'].ssl.enabled = true
domain.servers['wls_server2'].ssl.listen_port = 8020
domain.add_cluster(Name: 'wls_cluster')
domain.clusters['wls_cluster'].servers=[domain.servers['wls_server1'],domain.servers['wls_server2']]
and finally setup details on our AdminServer and domain home locations
domain.admin_server.machine = domain.machines['appserver1.mintpress.io']
domain.admin_server.listen_address = 'appserver1.mintpress.io'
domain.admin_server.listen_port = 7010
domain.admin_server.ssl.enabled = true
domain.admin_server.ssl.listen_port = 7020
domain.admin_server.machine.nodemanager.home = "#{domain.domain_home}/nodemanager"
domain.app_home="/oracle/app/wls/environments/applications/#{domain.domain_name}"
domain.domain_home="/oracle/app/wls/environments/domains/#{domain.domain_name}"
Your base configuration is complete. You are now ready to commence operating on your configuration.
Lets install Java binaries on each node over our registered transport.
# Install Java
java_installation1.install
java_installation2.install
Lets install Weblogic
# Install Binaries
wls_installation1.install
wls_installation2.install
Now lets apply patches to our Weblogic installation
# Define the patches
patch_details={ aru: '28298734',
stage: '/media/stage/fmwinfra/12.2.1.3/patches'
}
wls_installation1.add_patch(patch_details)
wls_installation2.add_patch(patch_details)
# Apply the patch
wls_installation1.patches.each { | x | x.apply }
wls_installation2.patches.each { | x | x.apply }
Now we have our software installed, we can now create the Weblogic domain
# Clobber any existing domain
domain.clobber
# Now go ahead and create the domain
domain.configure_offline
Please note, configure_offline performs the following activities. If you require finer grained control of your offline configuration, feel free to call the underlying methods directly.
def configure_offline
# offline
if ! exists?
info { "... Configuring Weblogic Domain (Offline)" }
# Create the metadata repository
.each do |k, v|
v.create unless v.nil?
end
# Now go ahead and create the domain (offline mode)
create
# Pack/Unpack to all machines
pack_unpack
# Configure and start nodemanager
configure_nodemanager
machines.each do | key, machine |
machine.nodemanager.start
end
admin_server.start
templates.each do | t |
t.post_first_admin_start
end
configure_system_components
configure_applications
end
end
At this time, we now have a configured domain with an AdminServer running. We can now perform any other actions as required to update the configuration on our domain.
# Start AdminServer
domain.adminserver.start
# Stop AdminServer
domain.adminserver.stop
# Restart AdminServer
domain.adminserver.restart
# Start AdminServer NodeManager [ start | stop | restart ]
domain.adminserver.machine.nodemanager.start
# Start NodeManager, AdminServer, and any ManagedServers and SystemComponents
domain.start_all
domain.stop_all
domain.start_all
Harvesting
Configuration harvesting is native to the MintPress::OracleWeblogic::Domain
class.
You only require an admin_url
, username
, and password
in order to start interacting with a Weblogic domain.
require 'oracle-weblogic'
domain=MintPress::OracleWeblogic::Domain.new(AdminUrl: 'http://appserver1.mintpress.io:7001', AdminUsername: 'weblogic', AdminPassword: 'welcome1')
# Harvest all config
domain.harvest
Now your domain
object above is fully populated from harvesting configuration from the running system. You can now begin to operate on the domain.
require 'oracle-weblogic'
domain=MintPress::OracleWeblogic::Domain.new(AdminUrl: 'http://appserver1.mintpress.io:7001', AdminUsername: 'weblogic', AdminPassword: 'welcome1')
# Harvest all config
domain.harvest
# Harvest only Machines, Managed Servers, AdminServer, and Clusters in order to perform BAU operations on them
domain.harvest_minimal
domain.stop_all
domain.start_all
domain.servers['wls_server1'].stop
domain.servers['wls_server1'].start
domain.clusters['wls_cluster'].stop
domain.clusters['wls_cluster'].start
domain.jdbc_system_resources['foo'].stop
domain.jdbc_system_resources['foo'].start
domain.system_components['ohs'].stop
domain.system_components['ohs'].start
Updating OPatch Version
Starting 3.14.0 MintPress SDK supports updating OPatch to any version the user wants to. This behavior is controlled by the following two properties:
Property | Default | Description |
---|---|---|
required_opatch_version | 13.9.4.0.0 | The minimum opatch version required, if we do not find this version, we will update it using the opatch_autoupdate_file |
opatch_autoupdate_file | Empty | The full path to the zip file of Opatch, e.g. ‘/oracle/stage/OPatch/p28186730_139400_Generic.zip’ |
MintPress will only update OPatch if the version installed on the system does not matches the version specifed by required_opatch_version
.
wls_install_opts={
version: '12.2.1.4',
java_home: '/oracle/app/soa/java',
fmw_home: "/oracle/app/soa/fmw",
inventory_location: "/oracle/app/soa/oraInventory",
owner: 'oracle',
group: 'oinstall',
software_stage: '/oracle/stage/wls/12.2.1.4/fmw_12.2.1.4.0_wls.jar',
opatch_autoupdate_file: '/oracle/stage/OPatch/p28186730_139400_Generic.zip',
required_opatch_version: '13.9.4.2.4'
}
wls_installation=MintPress::OracleWeblogic::Installation.new(wls_install_opts, transport: transport1)
# The patch details
patch_details={
aru: '28298734',
stage: '/media/stage/fmwinfra/12.2.1.4/patches'
}
# Add patch to configuration
wls_installation.add_patch(patch_details)
# Apply the patch
wls_installation.patches.each { | x | x.apply }
Patching Weblogic Using Stack Patch Bundle
Starting 3.14.0 MintPress SDK supports using Stack Patch Bundle (SPB) to apply a bundle patch to Weblogic/FMWinfra.
There are three main properties that control how MintPress uses SPB. These properties can be applied to either the installation or the patch itself.
Property | Default | Description |
---|---|---|
required_opatch_version | 13.9.4.0.0 | The minimum opatch version required, if we do not find this version, we will update it using the opatch_autoupdate_file |
enable_stack_patch_bundle | false | Set this property if you want to use the Stack Patch Bundle method of applying the patch. Remember that the patch must support SPB method. This is set to false by default |
opatch_base_file | linux64_patchlist.txt | The base file to use for SPB patching, defaults to linux64_patchlist.txt, only applicable if enable_stack_patch_bundle is set to true |
To use SPB, you must set the property enable_stack_patch_bundle
to true either on the installation or on the patch itself. If the SPB
patch requires a newer OPatch
you also need to set the required_opatch_version
property. SPB
patches ship the required OPatch
with itself. MintPress will automatically pickup the file and update the opatch if required.
For example:
# Define the patches
patch_details={
aru: 'WLS_SPB_12.2.1.4.210411',
stage: '/oracle/stage/wls/12.2.1.4/patches',
enable_stack_patch_bundle: true,
required_opatch_version: '13.9.4.2.5'
}
wls_installation.add_patch(patch_details)
# Apply the patch
wls_installation.patches.each { | x | x.apply }
Execute Scripts Before or After Applying a Patch Or Install
Starting 3.15 (along with latest rollups), MintPress allows hooks for before and after a patch application or an installation. Consider the following example that will execute scripts or commands before installation and patch application.
wls_install_opts={
version: '12.2.1.4',
java_home: '/oracle/app/soa/java',
fmw_home: "/oracle/app/soa/fmw",
inventory_location: "/oracle/app/soa/oraInventory",
owner: 'oracle',
group: 'oinstall',
software_stage: '/oracle/stage/wls/12.2.1.4/fmw_12.2.1.4.0_wls.jar',
execute_before: "echo 'I will run before Weblogic is installed'",
execute_after: "/mystage/custom_script.sh" # will run this script
}
wls_installation=MintPress::OracleWeblogic::Installation.new(wls_install_opts, transport: transport1)
# The patch details
patch_details={
aru: '28298734',
stage: '/media/stage/fmwinfra/12.2.1.4/patches',
# the below will run all these commands
execute_before: "cd 34761383 && ./changePerm.sh /oracle/app/binaries/obpoid/fmw;
export ORACLE_HOME=/oracle/app/binaries/obpoid/fmw;
export PATH=$ORACLE_HOME/bin:$PATH;
export DOMAIN_DIR=/oracle/app/runtime/obpoid/domains/obpoid_domain;
export DOMAIN_HOME=$DOMAIN_DIR;
export JAVA_HOME=/oracle/app/binaries/obpoid/java;
./fmw_12.2.1.19.0_dbclient_linux64.bin -invPtrLoc $ORACLE_HOME/oraInst.loc -silent ORACLE_HOME=$ORACLE_HOME",
execute_after: "python do_something.py"
}
# Add patch to configuration
wls_installation.add_patch(patch_details)
# Apply the patch
wls_installation.patches.each { | x | x.apply }
SPB Rollback Oracle does not supports rolling back SPB patches with the rollback
option. This is a limitation with Oracle Weblogic. Hence be careful when using SPB method to apply the patches.
SPB Idempotence Check Oracle also does not supports a way to check if an SPB has been applied or not, hence breaking idempotency rules. MintPress however uses an internal mechanism to test if the patch has been applied or not. Also note that there is no harm in re-applying the SPB over and over again as the SPB will only apply if the patch does not exists but there is no mechanism to test if the patch is applied.
License & Authors
-
Author:: LimePoint (support@limepoint.com)
# MintPress® - Automation and Configuration Management
#
# Copyright © 2014 LimePoint. All rights reserved.
#
# This program and its contents are confidential and owned by LimePoint.
# Only licenced users are permitted to access and use of this file.
# This program (or any part of it) may not be disclosed, copied or used
# except as expressly permitted in LimePoint’s End User Licence Agreement.
#
# LimePoint® and MintPress® are Registered Trademarks of LimePoint IP Limited.
# For more information contact LimePoint at http://www.limepoint.com