Wednesday, January 29, 2020

Oracle Service Bus (OSB) Silent mode installation

Welcome 🎻🎷🎷 to MyOFMWExpeirments blog fans!! In this post I would like to share the OSB installation in silent mode. 

The basic assumptions are you have already provisioned a Linux VM. It can be on your own Laptop or on the one of Cloud provider.

The Begining

You could download the OSB Software which is available as zip file V78173-01.zip from edilvery.oracle.com it will be changing for every time when Oracle packs a new bundle.

Oracle Service Bus OSB silent mode installation

For this learning and experiment purposes, alternative download is available on OTN.

Prerequisites

  1. JDK 1.8.0_xxx installation
  2. Oracle Fusion Middleware Infrastructure installation
  3. Oracle SOA Suite 12.2.1 installation [Optional]

Preparing for the installation, Firstly do unzip the downloaded file and then proceed with the following steps.

Step 1: Create oraInst.loc file

Just like other products you tell about Oracle inventory details. If you don't have already on your machine then you can give the Oracle inventory path, installation user group here is my sample: oraInst.loc
inventory_loc=/home/oracle/oraInventory
inst_group=oinstall

Step 2: Create an OSB Response File

Create the answers as response file which contains major changes are where you wish to install the OSB product and what is INSTALL_TYPE value here it is Service Bus for the Silent mode installation;

[ENGINE]

#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0

[GENERIC]
ORACLE_HOME=/home/oracle/products/12.2.1/Oracle_Home
#Set this variable value to the Installation Type selected. e.g. Fusion Middleware Infrastructure, Fusion Middleware Infrastructure With Examples.
INSTALL_TYPE=Service Bus

#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
DECLINE_SECURITY_UPDATES=true

#Set this to true if My Oracle Support Password is specified
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
Note that after simplified responses, it looks smaller in size, this is a complete OSB response file which I've used in this experiment.

Step 3: Install OSB in Silent mode

Before you go for installation of OSB you need to check all pre-requisites satisfied then run the below given silent mode command to install the OSB

java -jar /vagrant_data/fmw_12.2.1.0.0_osb.jar -silent \
-responseFile /home/oracle/silent/osbinstall.rsp \
-invPtrLoc /home/oracle/silent/oraInst.loc

This experiment we have done successfully on my Oracle VirtualBox on Oracle Linux 7

OSB installation completed then needs to proceed on the Domain configuration you can do it by config.sh or using WLST.

That's it!!

Happy Learning keeps writing your comments or errors if you have any, we will update accordingly.



Creating SOA domain using WLST

Hello, Oracle products fans!! This post I would like to dedicate to all who are interested to grow with the automation skills and part of paradigm shift from on-prem to Cloud platforms. There is lots of need in the various Oracle cloud platforms where internally uses Python scripting that is, WLST automation are base for building the Enterprise level architecture.

Prerequisite for SOA domain 

To run the script you must have
Please read all parameters which are used in this WLST script and do changes as per your project requirements.


Oracle SOA Domain using WLST




Create a below create_soa_domain.py file and place in any location on your machine where you can run WLST

WLHOME      = ORACLE_HOME+'/wlserver'
ORACLE_HOME = '/home/oracle/products/12.2.1/Oracle_Home'
DOMAIN      = 'soa_domain'
DOMAIN_PATH = '/home/oracle/wls_domains/domains/soa_domain'
APP_PATH    = '/home/oracle/wls_domains/applications/soa_domain'

SERVER_ADDRESS = '192.168.33.100'
LOG_FOLDER     = '/var/log/weblogic/'

JSSE_ENABLED     = true
DEVELOPMENT_MODE = true
WEBTIER_ENABLED  = true

ADMIN_SERVER   = 'AdminServer'
ADMIN_USER     = 'weblogic'
ADMIN_PASSWORD = 'weblogic1'

JAVA_HOME      = '/home/oracle/jdk1.8.0_65'

ADM_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m -Dweblogic.Stdout='+LOG_FOLDER+'AdminServer.out -Dweblogic.Stderr='+LOG_FOLDER+'AdminServer_err.out'
OSB_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m '
SOA_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=752m -Xms1024m -Xmx1532m '
BAM_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m '


SOA_REPOS_DBURL          = 'jdbc:oracle:thin:@192.168.33.115:1521/orcl'
SOA_REPOS_DBUSER_PREFIX  = 'DEV'
SOA_REPOS_DBPASSWORD     = 'welcome1'

BPM_ENABLED=false
BAM_ENABLED=true
B2B_ENABLED=true
ESS_ENABLED=true

def createBootPropertiesFile(directoryPath,fileName, username, password):
  serverDir = File(directoryPath)
  bool = serverDir.mkdirs()
  fileNew=open(directoryPath + '/'+fileName, 'w')
  fileNew.write('username=%s\n' % username)
  fileNew.write('password=%s\n' % password)
  fileNew.flush()
  fileNew.close()

def createAdminStartupPropertiesFile(directoryPath, args):
  adminserverDir = File(directoryPath)
  bool = adminserverDir.mkdirs()
  fileNew=open(directoryPath + '/startup.properties', 'w')
  args=args.replace(':','\\:')
  args=args.replace('=','\\=')
  fileNew.write('Arguments=%s\n' % args)
  fileNew.flush()
  fileNew.close()

def changeDatasourceToXA(datasource):
  print 'Change datasource '+datasource
  cd('/')
  cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDriverParams/NO_NAME_0')
  set('DriverName','oracle.jdbc.xa.client.OracleXADataSource')
  set('UseXADataSourceInterface','True') 
  cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDataSourceParams/NO_NAME_0')
  set('GlobalTransactionsProtocol','TwoPhaseCommit')
  cd('/')

def changeManagedServer(server,port,java_arguments):
  cd('/Servers/'+server)
  set('Machine'      ,'LocalMachine')
  set('ListenAddress',SERVER_ADDRESS)
  set('ListenPort'   ,port)

  create(server,'ServerStart')
  cd('ServerStart/'+server)
  set('Arguments' , java_arguments+' -Dweblogic.Stdout='+LOG_FOLDER+server+'.out -Dweblogic.Stderr='+LOG_FOLDER+server+'_err.out')
  set('JavaVendor','Sun')
  set('JavaHome'  , JAVA_HOME)

  cd('/Server/'+server)
  create(server,'SSL')
  cd('SSL/'+server)
  set('Enabled'                    , 'False')
  set('HostNameVerificationIgnored', 'True')

  if JSSE_ENABLED == true:
    set('JSSEEnabled','True')
  else:
    set('JSSEEnabled','False')  

  cd('/Server/'+server)
  create(server,'Log')
  cd('/Server/'+server+'/Log/'+server)
  set('FileName'     , LOG_FOLDER+server+'.log')
  set('FileCount'    , 10)
  set('FileMinSize'  , 5000)
  set('RotationType' ,'byTime')
  set('FileTimeSpan' , 24)

print('Start...wls domain with template /home/oracle/products/12.2.1/Oracle_Home/wlserver/common/templates/wls/wls.jar')
readTemplate(ORACLE_HOME+'/wlserver/common/templates/wls/wls.jar')


cd('/')

print('Set domain log')
create('base_domain','Log')

cd('/Log/base_domain')
set('FileName'    ,LOG_FOLDER+DOMAIN+'.log')
set('FileCount'   ,10)
set('FileMinSize' ,5000)
set('RotationType','byTime')
set('FileTimeSpan',24)

cd('/Servers/AdminServer')
# name of adminserver
set('Name',ADMIN_SERVER )

cd('/Servers/'+ADMIN_SERVER)

# address and port
set('ListenAddress',SERVER_ADDRESS)
set('ListenPort'   ,7001)

setOption( "AppDir", APP_PATH )

create(ADMIN_SERVER,'ServerStart')
cd('ServerStart/'+ADMIN_SERVER)
set('Arguments' , ADM_JAVA_ARGUMENTS)
set('JavaVendor','Sun')
set('JavaHome'  , JAVA_HOME)

cd('/Server/'+ADMIN_SERVER)
create(ADMIN_SERVER,'SSL')
cd('SSL/'+ADMIN_SERVER)
set('Enabled'                    , 'False')
set('HostNameVerificationIgnored', 'True')

if JSSE_ENABLED == true:
  set('JSSEEnabled','True')
else:
  set('JSSEEnabled','False')


cd('/Server/'+ADMIN_SERVER)

create(ADMIN_SERVER,'Log')
cd('/Server/'+ADMIN_SERVER+'/Log/'+ADMIN_SERVER)
set('FileName'    ,LOG_FOLDER+ADMIN_SERVER+'.log')
set('FileCount'   ,10)
set('FileMinSize' ,5000)
set('RotationType','byTime')
set('FileTimeSpan',24)

print('Set password...')
cd('/')
cd('Security/base_domain/User/weblogic')

# weblogic user name + password
set('Name',ADMIN_USER)
cmo.setPassword(ADMIN_PASSWORD)

if DEVELOPMENT_MODE == true:
  setOption('ServerStartMode', 'dev')
else:
  setOption('ServerStartMode', 'prod')

setOption('JavaHome', JAVA_HOME)

print('write domain...')
# write path + domain name
writeDomain(DOMAIN_PATH)
closeTemplate()

createAdminStartupPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/data/nodemanager',ADM_JAVA_ARGUMENTS)
createBootPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
createBootPropertiesFile(DOMAIN_PATH+'/config/nodemanager','nm_password.properties',ADMIN_USER,ADMIN_PASSWORD)

es = encrypt(ADMIN_PASSWORD,DOMAIN_PATH)
readDomain(DOMAIN_PATH)

print('set domain password...') 
cd('/SecurityConfiguration/'+DOMAIN)
set('CredentialEncrypted',es)

print('Set nodemanager password')
set('NodeManagerUsername'         ,ADMIN_USER )
set('NodeManagerPasswordEncrypted',es )

cd('/')
setOption( "AppDir", APP_PATH )
print('Extend...osb domain with template /home/oracle/products/12.2.1/Oracle_Home/osb/common/templates/wls/oracle.osb_template.jar')
addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.wls-webservice-template.jar')
addTemplate(ORACLE_HOME+'/osb/common/templates/wls/oracle.osb_template.jar')

print 'Adding ApplCore Template'
addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.applcore.model.stub_template.jar')

print 'Adding SOA Template'
addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.soa_template.jar')

if BAM_ENABLED == true:
  print 'Adding BAM Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.bam.server_template.jar')

if BPM_ENABLED == true:
  print 'Adding BPM Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.bpm_template_12.1.3.jar')
  
if WEBTIER_ENABLED == true:
  print 'Adding OHS Template'
  addTemplate(ORACLE_HOME+'/ohs/common/templates/wls/ohs_managed_template.jar')

if B2B_ENABLED == true:
  print 'Adding B2B Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.soa.b2b_template.jar')

if ESS_ENABLED == true:
  print 'Adding ESS Template'
  addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.ess.basic_template.jar')
  
  

  addTemplate(ORACLE_HOME+'/em/common/templates/wls/oracle.em_ess_template.jar')
   

dumpStack()

print 'Change datasources'

print 'Change datasource LocalScvTblDataSource'
cd('/JDBCSystemResource/LocalSvcTblDataSource/JdbcResource/LocalSvcTblDataSource/JDBCDriverParams/NO_NAME_0')
set('URL',SOA_REPOS_DBURL)
set('PasswordEncrypted',SOA_REPOS_DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',SOA_REPOS_DBUSER_PREFIX+'_STB')

print 'Call getDatabaseDefaults which reads the service table'
getDatabaseDefaults()    

changeDatasourceToXA('EDNDataSource')
changeDatasourceToXA('wlsbjmsrpDataSource')
changeDatasourceToXA('OraSDPMDataSource')
changeDatasourceToXA('SOADataSource')

if BAM_ENABLED == true:
  changeDatasourceToXA('BamDataSource')

print 'end datasources'


print('Create machine LocalMachine with type UnixMachine')
cd('/')
create('LocalMachine','UnixMachine')
cd('UnixMachine/LocalMachine')
create('LocalMachine','NodeManager')
cd('NodeManager/LocalMachine')
set('ListenAddress',SERVER_ADDRESS)

print 'Change AdminServer'
cd('/Servers/'+ADMIN_SERVER)
set('Machine','LocalMachine')

print 'change soa_server1'
cd('/')
changeManagedServer('soa_server1',8001,SOA_JAVA_ARGUMENTS)

if BAM_ENABLED == true:
  print 'change bam_server1'
  cd('/')
  changeManagedServer('bam_server1',9001,BAM_JAVA_ARGUMENTS)

print 'change osb_server1'
cd('/')
changeManagedServer('osb_server1',8011,OSB_JAVA_ARGUMENTS)

print 'Add server groups WSM-CACHE-SVR WSMPM-MAN-SVR JRF-MAN-SVR to AdminServer'
serverGroup = ["WSM-CACHE-SVR" , "WSMPM-MAN-SVR" , "JRF-MAN-SVR"]
setServerGroups(ADMIN_SERVER, serverGroup)                      

if ESS_ENABLED == true:
  print 'Add server group SOA-MGD-SVRS,ESS-MGD-SVRS to soa_server1'
  cd('/')
  delete('ess_server1', 'Server')
  serverGroup = ["SOA-MGD-SVRS","ESS-MGD-SVRS"]
else:
  print 'Add server group SOA-MGD-SVRS to soa_server1'
  serverGroup = ["SOA-MGD-SVRS"]

setServerGroups('soa_server1', serverGroup)                      

if BAM_ENABLED == true:
  print 'Add server group BAM12-MGD-SVRS to bam_server1'
  serverGroup = ["BAM12-MGD-SVRS"]
  setServerGroups('bam_server1', serverGroup)                      

print 'Add server group OSB-MGD-SVRS-COMBINED to osb_server1'
serverGroup = ["OSB-MGD-SVRS-COMBINED"]
setServerGroups('osb_server1', serverGroup)                      

print 'end server groups'

updateDomain()
closeDomain();

createBootPropertiesFile(DOMAIN_PATH+'/servers/soa_server1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

if BAM_ENABLED == true:
  createBootPropertiesFile(DOMAIN_PATH+'/servers/bam_server1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

createBootPropertiesFile(DOMAIN_PATH+'/servers/osb_server1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

print('Exiting SOA Domain creation completed ...')
exit()
Run the below command to complete the domain creation

wlst create_soa_domain.py



Write back your experiment success stories, Issues if you faced in the journey of automation,
That's it for now!! Happy Coding, Have A Happy Learning