Create OHS Domain standalone mode using WLST script |
The magical WLST script looks like this...
#!/usr/bin/python # Create OHS Domain standalone mode with 'ohs1' as system Component # Created date : 12-02-2020 import os, sys def read_ohsdomain_template(): """ Select and load the template To create ohs domain """ setTopologyProfile('Compact') selectTemplate('Oracle HTTP Server (Standalone)') loadTemplates() showTemplates() def set_ohsdomain(): """ Create OHS System Component by the name ohs1, Configure OHS Listen Port and SSL Port """ cd('/') cd('SystemComponent/' + ohs_comp_name) set('ComponentType','OHS') cd('/') cd('OHS/' + ohs_comp_name) set('ListenAddress','') set('ListenPort', ohs_http_port) set('SSLListenPort', ohs_ssl_port) def set_ohs_nm(): """ Set NodeManager user name and password """ cd('/') create('sc', 'SecurityConfiguration') cd('SecurityConfiguration/sc') set('NodeManagerUsername', username) set('NodeManagerPasswordEncrypted', password) setOption('NodeManagerType','PerDomainNodeManager') setOption('OverwriteDomain', 'true') # Main program Write Domain, close template and exit if __name__== "main": read_ohsdomain_template() set_ohsdomain() set_ohs_nm() writeDomain(domain_path) dumpStack() closeTemplate() exit()Sample properties file use your favourite editor and create it
nano ohssa_domain.properties
ohs_http_port = 7777 ohs_ssl_port = 7733 ohs_comp_name = ohs1 domain_name = ohsDomain domain_path = /u01/app/oracle/fmw/domains username = weblogic password = welcome1
Executing this WLST Script is one more trick you need to play!! Navigate to the OHS installed location and then, use the oracle_common/common/bin/wlst.sh to run the above WLST script 'create_ohsdomain.py'.
OHS_HOME-/u01/app/oracle/fmw/ohs $OHS_HOME/oracle_common/common/bin/wlst.sh -loadProperties ohssa_domain.properties create_ohsdomain.py
ohsDomain directory structure |
Add a line to your export lines in your .bash_profile script
export OHS_DOMAIN=/u01/app/oracle/fmw/domains/ohsDomain
and run the .bash_profile script. Now all set to start the OHS NodeManager and then start the ohs1 component from the $OHS_DOMAIN/bin path.
startComponent ohs1 |
Now open a browser, access the OHS url: http://192.168.33.120:7777
Acessing OHS Console |
Hope this wonderful experiment gives you fun and enjoy!! Write your valuable feedback and keep encouraging to see more automation scripts...
Keep sharing with your friends and technical enthusiasts