What it does not handles is the creation of a domain. The last few weeks I worked on a script to do that. It's based on a wlst script for 12.1.3 by Edwin Biemond. This one was quite educational for me. But as denoted: it was made for 12.1.3. And I wanted more control on what and how certain artefacts are created. So gave it my own swing, also to adapt it for some wishes of my current customer.
Although there are certainly some improvements thinkable, and probably will be done in future uses, for now it is ready to share with the world.
One of the changes I did was to divide the main function in sections to make clear what the structure of the script is. I also moved some of the duplicate code or functional parts into separate functions.
Let me describe the sections first.
1. Create Base domain
The script starts with creating a base domain. It reads the default wls template 'wls.jar'. Sets the log properties of the domain. It then adapts the AdminServer to- change name as set in the property file: you can have your own naming convention.
- change listen addres + port
- Set default SSL settings
- Set log file properties.
It then creates boot.properties files for nodemanager and AdminServer and set the password of the NodeManager. Finally setting the Applications home folder.
2. Extending domain with templates
The second section extends the domain with templates. Another improvement I did is that you can select which components you want to add by toggling the appropriate 'xxxEnabled' switches in the property file, where xxx stands for the component (for instance 'soa', 'bpm', 'osb', 'bam', 'ess', etc.)It supports the following components:
- ServiceBus
- SOA and BPM Suite and B2B
- BAM
- Enterprise Scheduler Service
3. DataSources
Section 3 takes care of setting the datasources to the created repository based on the repository user '{Prefix}_STB', via the 'LocalScvTblDataSource' datasource. In the property file you need to set- soaRepositoryDbUrl: jdbc connect string to the repository database
- soaRepositoryDbUserPrefix=prefix used in the Repository creation
- soaRepositoryStbPwd=Password for the {Prefix}_STB user.
4. Create UnixMachines, Clusters and Managed Servers
This section creates Machine definitions of type 'Unix', based on the properties:- server1Address=darlin-vce-db.darwin-it.local
- server1Machine=darlin-vce-db
- server2Enabled=true
- server2Address=darlin-vce-db2.darwin-it.local
- server2Machine=darlin-vce-db2
I realize that 'server' in this context might be a little confusing. In serverYAddress and serverYMachine, I actually mean a server-host, not a managed or admin server.
For each component to configure (soa, osb, etc.) a cluster, denoted with for instance osbClr or soaClr, is created.
When you extend the domain with SOA Suite or OSB then automatically a managed server called 'soa_server1' or 'osb_server1' created with the appropriate deployments targeted to it. In the script of Edwin these are removed and new ones are created. I found problems with that and found that it's quite unnecessary, since we can rename the current ones with the given name in the property file, denoted with soaSvr1 or osbSvr1, etc., as is done with the AdminServer. So I leave the already created ones, but rename them to the desired value.
These first servers are added to the appropriate cluster, what causes to re-target the deployments to that cluster, magically.
Then if enabled, as with osbSvr2Enabled or soaSvr2Enabled, etc., the particular 'second' servers are created and added to the particular cluster.
5. Add Servers to ServerGroups
New in 12c is the concept of ServerGroups. In 11g you had only one definition of USER_MEM_ARGS in the setDomainEnv.sh/cmd. So these counted for each server (admin or managed) that are started using the start(Managed)Weblogic.sh/cmd scripts. But in 12c the determination of the USER_MEM_ARGS are done in a separate script: setStartupEnv.sh/cmd.In this script the determination is done based on so-called ServerGroups. This provides a means to differentiate in memory settings for the particular servers, which was lacking in 11g.
So in this sections all the Managed and Admin Servers are added to a particular ServerGroup.
6. Create boot properties files
Lastly, for each created managed server a boot.properties file with the username password is created. Smart: I used to do this every single time by hand...The example property file
Here's an example of the property file:############################################################################# # Properties voor Creeƫren SOADomain # # @author Martien van den Akker, Darwin-IT Professionals # @version 1.0, 2016-04-15 # ############################################################################# # fmwHome=/u01/app/oracle/FMW12210 # soaDomainName=osb_domain domainsHome=/u01/app/work/domains applicationsHome=/u01/app/work/applications productionMode=true # # Server Settings server1Address=darlin-vce-db.darwin-it.local server1Machine=darlin-vce-db server2Enabled=true server2Address=darlin-vce-db2.darwin-it.local server2Machine=darlin-vce-db2 # # Properties for AdminServer adminServerName=AdminServer adminListenAddress=darlin-vce-db adminListenPort=7001 adminJavaArgsBase=-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m # Properties for OSB osbEnabled=true osbJavaArgsBase=-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m osbClr=OsbCluster osbSvr1=OsbServer1 osbSvr1Port=8011 osbSvr2Enabled=true osbSvr2=OsbServer2 osbSvr2Port=8012 # Properties for SOA soaEnabled=true bpmEnabled=true b2bEnabled=true soaJavaArgsBase=-XX:PermSize=256m -XX:MaxPermSize=752m -Xms1024m -Xmx1532m soaClr=SoaCluster soaSvr1=SoaServer1 soaSvr1Port=8001 soaSvr2Enabled=true soaSvr2=SoaServer2 soaSvr2Port=8002 # Properties for ESS essEnabled=true essJavaArgsBase=-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m essClr=essCluster essSvr1=EssServer1 essSvr1Port=8021 essSvr2Enabled=true essSvr2=EssServer2 essSvr2Port=8022 # Properties for BAM bamEnabled=true bamJavaArgsBase=-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m bamClr=BamCluster bamSvr1=BamServer1 bamSvr1Port=9001 bamSvr2Enabled=true bamSvr2=BamServer2 bamSvr2Port=9002 # AdminUser adminUser=weblogic adminPwd=welcome1 # SoaRepository Settings soaRepositoryDbUrl=jdbc:oracle:thin:@darlin-vce-db.darwin-it.local:1521/pdborcl soaRepositoryDbUserPrefix=DEV soaRepositoryStbPwd=DEV_STB # Logs logsHome=/u01/app/work/logs fileCount=10 fileMinSize=5000 fileTimeSpan=24 rotationType=byTime # # Settings webtierEnabled=false jsseEnabled=false
Save it with a name like darlin-vce-db.properties, but adapted for each particular environment.
The script
(And of course I don't mean the band that my daughter likes...)############################################################################# # Create a SOA/BPM/OSB domain # # @author Martien van den Akker, Darwin-IT Professionals # @version 1.0, 2016-04-09 # ############################################################################# # Modify these values as necessary import sys, traceback scriptName = 'createSoaBpmDomain.py' # #Home Folders wlsHome = fmwHome+'/wlserver' soaDomainHome = domainsHome+'/'+soaDomainName soaApplicationsHome = applicationsHome+'/'+soaDomainName # # Templates for 12.1.3 #wlsjar =fmwHome+'/wlserver/common/templates/wls/wls.jar' #oracleCommonTplHome=fmwHome+'/oracle_common/common/templates' #wlservicetpl=oracleCommonTplHome+'/oracle.wls-webservice-template_12.1.3.jar' #osbtpl=fmwHome+'/osb/common/templates/wls/oracle.osb_template_12.1.3.jar' #applCoreTpl=oracleCommonTplHome+'/wls/oracle.applcore.model.stub.1.0.0_template.jar' #soatpl=fmwHome+'/soa/common/templates/wls/oracle.soa_template_12.1.3.jar' #bamtpl=fmwHome+'/soa/common/templates/wls/oracle.bam.server_template_12.1.3.jar' #bpmtpl=fmwHome+'/soa/common/templates/wls/oracle.bpm_template_12.1.3.jar' #essBasicTpl=oracleCommonTplHome+'/wls/oracle.ess.basic_template_12.1.3.jar' #essEmTpl=fmwHome+'/em/common/templates/wls/oracle.em_ess_template_12.1.3.jar' #ohsTpl=fmwHome+'/ohs/common/templates/wls/ohs_managed_template_12.1.3.jar' #b2bTpl=fmwHome+'/soa/common/templates/wls/oracle.soa.b2b_template_12.1.3.jar' # # Templates for 12.2.1 wlsjar =fmwHome+'/wlserver/common/templates/wls/wls.jar' oracleCommonTplHome=fmwHome+'/oracle_common/common/templates' wlservicetpl=oracleCommonTplHome+'/wls/oracle.wls-webservice-template.jar' osbtpl=fmwHome+'/osb/common/templates/wls/oracle.osb_template.jar' applCoreTpl=oracleCommonTplHome+'/wls/oracle.applcore.model.stub_template.jar' soatpl=fmwHome+'/soa/common/templates/wls/oracle.soa_template.jar' bamtpl=fmwHome+'/soa/common/templates/wls/oracle.bam.server_template.jar' bpmtpl=fmwHome+'/soa/common/templates/wls/oracle.bpm_template.jar' essBasicTpl=oracleCommonTplHome+'/wls/oracle.ess.basic_template.jar' essEmTpl=fmwHome+'/em/common/templates/wls/oracle.em_ess_template.jar' ohsTpl=fmwHome+'/ohs/common/templates/wls/ohs_managed_template.jar' # need to be validated! b2bTpl=fmwHome+'/soa/common/templates/wls/oracle.soa.b2b_template.jar' # need to be validated! # # ServerGroup definitions adminSvrGrpDesc='WSM-CACHE-SVR WSMPM-MAN-SVR JRF-MAN-SVR' adminSvrGrp=["WSM-CACHE-SVR" , "WSMPM-MAN-SVR" , "JRF-MAN-SVR"] essSvrGrpDesc="ESS-MGD-SVRS" essSvrGrp=["ESS-MGD-SVRS"] soaSvrGrpDesc="SOA-MGD-SVRS" soaSvrGrp=["SOA-MGD-SVRS"] bamSvrGrpDesc="BAM12-MGD-SVRS" bamSvrGrp=["BAM12-MGD-SVRS"] osbSvrGrpDesc="OSB-MGD-SVRS-COMBINED" osbSvrGrp=["OSB-MGD-SVRS-COMBINED"] # # lineSeperator='__________________________________________________________________________________' # # def usage(): print 'Call script as: ' print 'Windows: wlst.cmd '+scriptName+' -loadProperties localhost.properties' print 'Linux: wlst.sh '+scriptName+' -loadProperties environment.properties' print 'Property file should contain the following properties: ' print "adminUrl='localhost:7101'" print "adminUser='weblogic'" print "adminPwd='welcome1'" # # Create a boot properties file. def createBootPropertiesFile(directoryPath,fileName, username, password): print ('Create Boot Properties File for folder: '+directoryPath) print (lineSeperator) 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() # # Create Startup Properties File def createAdminStartupPropertiesFile(directoryPath, args): print 'Create AdminServer Boot Properties File for folder: '+directoryPath print (lineSeperator) 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() # # Set Log properties def setLogProperties(logMBeanPath, logFile, fileCount, fileMinSize, rotationType, fileTimeSpan): print '\nSet Log Properties for: '+logMBeanPath print (lineSeperator) cd(logMBeanPath) print ('Server log path: '+pwd()) print '. set FileName to '+logFile set('FileName' ,logFile) print '. set FileCount to '+str(fileCount) set('FileCount' ,int(fileCount)) print '. set FileMinSize to '+str(fileMinSize) set('FileMinSize' ,int(fileMinSize)) print '. set RotationType to '+rotationType set('RotationType',rotationType) print '. set FileTimeSpan to '+str(fileTimeSpan) set('FileTimeSpan',int(fileTimeSpan)) # # def createServerLog(serverName, logFile, fileCount, fileMinSize, rotationType, fileTimeSpan): print ('\nCreate Log for '+serverName) print (lineSeperator) cd('/Server/'+serverName) create(serverName,'Log') setLogProperties('/Server/'+serverName+'/Log/'+serverName, logFile, fileCount, fileMinSize, rotationType, fileTimeSpan) # # Change DataSource to XA def changeDatasourceToXA(datasource): print 'Change datasource '+datasource print (lineSeperator) cd('/') cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDriverParams/NO_NAME_0') set('DriverName','oracle.jdbc.xa.client.OracleXADataSource') print '. Set UseXADataSourceInterface='+'True' set('UseXADataSourceInterface','True') cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDataSourceParams/NO_NAME_0') print '. Set GlobalTransactionsProtocol='+'TwoPhaseCommit' set('GlobalTransactionsProtocol','TwoPhaseCommit') cd('/') # # def createCluster(cluster): print ('\nCreate '+cluster) print (lineSeperator) cd('/') create(cluster, 'Cluster') # # Create a Unix Machine def createUnixMachine(serverMachine,serverAddress): print('\nCreate machine '+serverMachine+' with type UnixMachine') print (lineSeperator) cd('/') create(serverMachine,'UnixMachine') cd('UnixMachine/'+serverMachine) create(serverMachine,'NodeManager') cd('NodeManager/'+serverMachine) set('ListenAddress',serverAddress) # # Add server to Unix Machine def addServerToMachine(serverName, serverMachine): print('\nAdd server '+serverName+' to '+serverMachine) print (lineSeperator) cd('/Servers/'+serverName) set('Machine',serverMachine) # # Determine the Server Java Args def getServerJavaArgs(serverName,javaArgsBase,logsHome): javaArgs = javaArgsBase+' -Dweblogic.Stdout='+logsHome+'/'+serverName+'.out -Dweblogic.Stderr='+logsHome+'/'+serverName+'_err.out' return javaArgs # # Change Managed Server def changeManagedServer(server,listenAddress,listenPort,javaArgs): print '\nChange ManagedServer '+server print (lineSeperator) cd('/Servers/'+server) print '. Set listen address and port to: '+listenAddress+':'+str(listenPort) set('ListenAddress',listenAddress) set('ListenPort' ,int(listenPort)) # ServerStart print ('. Create ServerStart') create(server,'ServerStart') #cd('ServerStart/'+server) #print ('. Set Arguments to: '+javaArgs) #set('Arguments' , javaArgs) # SSL cd('/Server/'+server) print ('. Create server SSL') create(server,'SSL') cd('SSL/'+server) print ('. Set SSL Enabled to: '+'False') set('Enabled' , 'False') print ('. Set SSL HostNameVerificationIgnored to: '+'True') set('HostNameVerificationIgnored', 'True') # if jsseEnabled == 'true': print ('. Set JSSEEnabled to: '+ 'True') set('JSSEEnabled','True') else: print ('. Set JSSEEnabled to: '+ 'False') set('JSSEEnabled','False') # # Create a Managed Server def createManagedServer(server,listenAddress,listenPort,cluster,machine, javaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan): print('\nCreate '+server) print (lineSeperator) cd('/') create(server, 'Server') cd('/Servers/'+server) javaArgs=getServerJavaArgs(server,javaArgsBase,logsHome) changeManagedServer(server,listenAddress,listenPort,javaArgs) createServerLog(server, logsHome+'/'+server+'.log', fileCount, fileMinSize, rotationType, fileTimeSpan) print('Add '+server+' to cluster '+cluster) cd('/') assign('Server',server,'Cluster',cluster) addServerToMachine(server, machine) # # Adapt a Managed Server def adaptManagedServer(server,newSrvName,listenAddress,listenPort,cluster,machine, javaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan): print('\nAdapt '+server) print (lineSeperator) cd('/') cd('/Servers/'+server) # name of adminserver print '. Rename '+server+' to '+ newSrvName set('Name',newSrvName ) cd('/Servers/'+newSrvName) javaArgs=getServerJavaArgs(newSrvName,javaArgsBase,logsHome) changeManagedServer(newSrvName,listenAddress,listenPort,javaArgs) createServerLog(newSrvName, logsHome+'/'+newSrvName+'.log', fileCount, fileMinSize, rotationType, fileTimeSpan) print('Add '+newSrvName+' to cluster '+cluster) cd('/') assign('Server',newSrvName,'Cluster',cluster) addServerToMachine(newSrvName, machine) # # Change Admin Server def changeAdminServer(adminServerName,listenAddress,listenPort,javaArguments): print '\nChange AdminServer' print (lineSeperator) cd('/Servers/AdminServer') # name of adminserver print '. Set Name to '+ adminServerName set('Name',adminServerName ) cd('/Servers/'+adminServerName) # address and port print '. Set ListenAddress to '+ server1Address set('ListenAddress',server1Address) print '. Set ListenPort to '+ str(listenPort) set('ListenPort' ,int(listenPort)) # # ServerStart print 'Create ServerStart' create(adminServerName,'ServerStart') #cd('ServerStart/'+adminServerName) #print '. Set Arguments to: '+javaArguments #set('Arguments' , javaArguments) # SSL cd('/Server/'+adminServerName) print 'Create SSL' create(adminServerName,'SSL') cd('SSL/'+adminServerName) set('Enabled' , 'False') set('HostNameVerificationIgnored', 'True') # if jsseEnabled == 'true': print ('. Set JSSEEnabled to: '+ 'True') set('JSSEEnabled','True') else: print ('. Set JSSEEnabled to: '+ 'False') set('JSSEEnabled','False') # # def main(): try: # # Section 1: Base Domain + Admin Server print (lineSeperator) print ('1. Create Base domain '+soaDomainName) print('\nCreate base wls domain with template '+wlsjar) print (lineSeperator) readTemplate(wlsjar) # cd('/') # Domain Log print('Set base_domain log') create('base_domain','Log') setLogProperties('/Log/base_domain', logsHome+soaDomainName+'.log', fileCount, fileMinSize, rotationType, fileTimeSpan) # # Admin Server adminJavaArgs = getServerJavaArgs(adminServerName,adminJavaArgsBase,logsHome) changeAdminServer(adminServerName,adminListenAddress,adminListenPort,adminJavaArgs) createServerLog(adminServerName, logsHome+adminServerName+'.log', fileCount, fileMinSize, rotationType, fileTimeSpan) # print('\nSet password in '+'/Security/base_domain/User/weblogic') cd('/') cd('Security/base_domain/User/weblogic') # weblogic user name + password print('. Set Name to: ' +adminUser) set('Name',adminUser) cmo.setPassword(adminPwd) # if productionMode == 'true': print('. Set ServerStartMode to: ' +'prod') setOption('ServerStartMode', 'prod') else: print('. Set ServerStartMode to: ' +'dev') setOption('ServerStartMode', 'dev') # print('write Domain...') # write path + domain name writeDomain(soaDomainHome) closeTemplate() # createAdminStartupPropertiesFile(soaDomainHome+'/servers/'+adminServerName+'/data/nodemanager',adminJavaArgs) createBootPropertiesFile(soaDomainHome+'/servers/'+adminServerName+'/security','boot.properties',adminUser,adminPwd) createBootPropertiesFile(soaDomainHome+'/config/nodemanager','nm_password.properties',adminUser,adminPwd) # es = encrypt(adminPwd,soaDomainHome) # readDomain(soaDomainHome) # print('set Domain password for '+soaDomainName) cd('/SecurityConfiguration/'+soaDomainName) set('CredentialEncrypted',es) # print('Set nodemanager password') set('NodeManagerUsername' ,adminUser ) set('NodeManagerPasswordEncrypted',es ) # cd('/') setOption( "AppDir", soaApplicationsHome ) # print('Finished base domain.') # # Section 2: Templates print('\n2. Extend Base domain with templates.') print (lineSeperator) print ('Adding Webservice template '+wlservicetpl) addTemplate(wlservicetpl) # SOA Suite if soaEnabled == 'true': print ('Adding SOA Template '+soatpl) addTemplate(soatpl) else: print('SOA is disabled') # BPM if bpmEnabled == 'true': print ('Adding BPM Template '+bpmtpl) addTemplate(bpmtpl) else: print('BPM is disabled') # OSB if osbEnabled == 'true': print ('Adding OSB template '+osbtpl) addTemplate(osbtpl) else: print('OSB is disabled') # print ('Adding ApplCore Template '+applCoreTpl) addTemplate(applCoreTpl) # if bamEnabled == 'true': print ('Adding BAM Template '+bamtpl) addTemplate(bamtpl) else: print ('BAM is disabled') # if webtierEnabled == 'true' == true: print ('Adding OHS Template '+ohsTpl) addTemplate(ohsTpl) else: print('OHS is disabled') # if b2bEnabled == 'true': print 'Adding B2B Template '+b2bTpl addTemplate(b2bTpl) else: print('B2B is disabled') # if essEnabled == 'true': print ('Adding ESS Template'+essBasicTpl) addTemplate(essBasicTpl) print ('Adding ESS Em Template'+essEmTpl) addTemplate(essEmTpl) else: print('ESS is disabled') # dumpStack() print ('Finished templates') # # Section 3: Change Datasources print ('\n3. Change datasources') print 'Change datasource LocalScvTblDataSource' cd('/JDBCSystemResource/LocalSvcTblDataSource/JdbcResource/LocalSvcTblDataSource/JDBCDriverParams/NO_NAME_0') set('URL',soaRepositoryDbUrl) set('PasswordEncrypted',soaRepositoryStbPwd) cd('Properties/NO_NAME_0/Property/user') set('Value',soaRepositoryDbUserPrefix+'_STB') # print ('Call getDatabaseDefaults which reads the service table') getDatabaseDefaults() # if soaEnabled == 'true': changeDatasourceToXA('EDNDataSource') if osbEnabled == 'true': changeDatasourceToXA('wlsbjmsrpDataSource') changeDatasourceToXA('OraSDPMDataSource') changeDatasourceToXA('SOADataSource') # if bamEnabled == 'true': changeDatasourceToXA('BamDataSource') # print 'Finshed DataSources' # # Section 4: Create UnixMachines, Clusters and Managed Servers print ('\n4. Create UnixMachines, Clusters and Managed Servers') print (lineSeperator) cd('/') # createUnixMachine(server1Machine,server1Address) if server2Enabled == 'true': createUnixMachine(server2Machine,server2Address) # addServerToMachine(adminServerName,server1Machine) # cd('/') # SOA Suite if soaEnabled == 'true': createCluster(soaClr) adaptManagedServer('soa_server1',soaSvr1,server1Address, soaSvr1Port,soaClr,server1Machine, soaJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) if soaSvr2Enabled == 'true': createManagedServer(soaSvr2,server2Address,soaSvr2Port,soaClr,server2Machine, soaJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) else: print('Do not create SOA Server2') # # OSB if osbEnabled == 'true': createCluster(osbClr) adaptManagedServer('osb_server1',osbSvr1,server1Address,osbSvr1Port,osbClr,server1Machine, osbJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) if osbSvr2Enabled == 'true': createManagedServer(osbSvr2,server2Address,osbSvr2Port,osbClr,server2Machine, osbJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) else: print('Do not create OSB Server2') # # BAM if bamEnabled == 'true': createCluster(bamClr) adaptManagedServer('bam_server1',bamSvr1,server1Address,bamSvr1Port,bamClr,server1Machine, bamJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) if bamSvr2Enabled == 'true': createManagedServer(bamSvr2,server2Address,bamSvr2Port,bamClr,server2Machine, bamJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) else: print('Do not create BAM Server2') # # ESS if essEnabled == 'true': createCluster(essClr) adaptManagedServer('ess_server1',essSvr1,server1Address,essSvr1Port,essClr,server1Machine, essJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) if essSvr2Enabled == 'true': createManagedServer(essSvr2,server2Address,essSvr2Port,essClr,server2Machine, essJavaArgsBase,fileCount,fileMinSize,rotationType,fileTimeSpan) else: print('Do not create ESS Server2') # print ('Finshed creating Machines, Clusters and ManagedServers') # # Section 5: Add Servers to ServerGroups. print ('\n5. Add Servers to ServerGroups') print (lineSeperator) cd('/') print 'Add server groups '+adminSvrGrpDesc+ ' to '+adminServerName setServerGroups(adminServerName, adminSvrGrp) # SOA if soaEnabled == 'true': print 'Add server group '+soaSvrGrpDesc+' to '+soaSvr1+' and possibly '+soaSvr2 setServerGroups(soaSvr1, soaSvrGrp) if soaSvr2Enabled == 'true': setServerGroups(soaSvr2, soaSvrGrp) # # OSB if osbEnabled == 'true': print 'Add server group '+osbSvrGrpDesc+' to '+osbSvr1+' and possibly '+osbSvr2 setServerGroups(osbSvr1, osbSvrGrp) if osbSvr2Enabled == 'true': setServerGroups(osbSvr2, osbSvrGrp) # if bamEnabled == 'true': print 'Add server group '+bamSvrGrpDesc+' to '+bamSvr1+' and possibly '+bamSvr2 setServerGroups(bamSvr1, bamSvrGrp) if bamSvr2Enabled == 'true': setServerGroups(bamSvr2, bamSvrGrp) # if essEnabled == 'true': print 'Add server group '+essSvrGrpDesc+' to '+essSvr1+' and possibly '+essSvr2 setServerGroups(essSvr1, essSvrGrp) if essSvr2Enabled == 'true': setServerGroups(essSvr2, essSvrGrp) # print ('Finshed ServerGroups.') # updateDomain() closeDomain(); # # Section 6: Create boot properties files. print ('\n6. Create boot properties files') print (lineSeperator) # SOA if soaEnabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+soaSvr1+'/security','boot.properties',adminUser,adminPwd) if soaSvr2Enabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+soaSvr2+'/security','boot.properties',adminUser,adminPwd) # # OSB if osbEnabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+osbSvr1+'/security','boot.properties',adminUser,adminPwd) if osbSvr2Enabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+osbSvr2+'/security','boot.properties',adminUser,adminPwd) # if bamEnabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+bamSvr1+'/security','boot.properties',adminUser,adminPwd) if bamSvr2Enabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+bamSvr1+'/security','boot.properties',adminUser,adminPwd) # if essEnabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+essSvr1+'/security','boot.properties',adminUser,adminPwd) if essSvr2Enabled == 'true': createBootPropertiesFile(soaDomainHome+'/servers/'+essSvr2+'/security','boot.properties',adminUser,adminPwd) # print ('\nFinished') # print('\nExiting...') exit() except NameError, e: print 'Apparently properties not set.' print "Please check the property: ", sys.exc_info()[0], sys.exc_info()[1] usage() except: apply(traceback.print_exception, sys.exc_info()) stopEdit('y') exit(exitcode=1) #call main() main() exit()
Conclusion
As said, although I think this script is already quite adaptable using the property file, of course there are many improvements thinkable for your particular situation. It creates a 'skeleton' SOA or Service Bus domain, but you might need to adapt for network topologies, security settings.And although it creates a 'per domain' nodemanager configuration, you would need to adapt it for your particular needs to get the domain started. I only tested this by starting the Admin server using the startWeblogic.sh script.
Having such a script is such a valuable asset: it allows you to (re-)create your domains repeatably in a standard way, ensuring that different environments (dev, test, acc, prod) are created similarly.
One, last thing though, the script somehow registers the creation of the domain and thus the use of the datasources in the repository. So you can't just throw away the domain and recreate it to the current Repository. You'll need to rereate the Repository as well.
Because of earlier findings and triggered by this question: https://community.oracle.com/thread/4038472, I hashed the lines to set the java arguments.
ReplyDeleteSee also the last section in: http://blog.darwin-it.nl/2016/06/a-couple-of-notes-of-automatic.html
ReplyDelete