domain.xml.erb 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. WLHOME='<%= @wlHome %>'
  2. DOMAIN_PATH='<%= @domainPath %>/<%= @domain %>'
  3. DOMAIN='<%= @domain %>'
  4. APP_PATH='<%= @appPath %>/<%= @domain %>'
  5. DEVELOPMENT_MODE=<%= @developmentMode %>
  6. WEBLOGIC_VERSION='<%= @version %>'
  7. ADMIN_SERVER='<%= @adminServerName %>'
  8. ADMIN_USER='<%= @wlsUser %>'
  9. ADMIN_PASSWORD='<%= @password %>'
  10. JAVA_HOME='<%= @JAVA_HOME %>'
  11. <% if @java_arguments["ADM"] %>
  12. ADM_JAVA_ARGUMENTS='<%= @java_arguments["ADM"] %>'
  13. <% else %>
  14. ADM_JAVA_ARGUMENTS='-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m -Dweblogic.Stdout=<%= @adminNodeMgrLogDir %>/<%= @adminServerName %>.out -Dweblogic.Stderr=<%= @adminNodeMgrLogDir %>/<%= @adminServerName %>_err.out'
  15. <% end %>
  16. def createBootPropertiesFile(directoryPath,fileName, username, password):
  17. adminserverDir = File(directoryPath)
  18. bool = adminserverDir.mkdirs()
  19. fileNew=open(directoryPath + '/'+fileName, 'w')
  20. fileNew.write('username=%s\n' % username)
  21. fileNew.write('password=%s\n' % password)
  22. fileNew.flush()
  23. fileNew.close()
  24. def createAdminStartupPropertiesFile(directoryPath, args):
  25. adminserverDir = File(directoryPath)
  26. bool = adminserverDir.mkdirs()
  27. fileNew=open(directoryPath + '/startup.properties', 'w')
  28. args=args.replace(':','\\:')
  29. args=args.replace('=','\\=')
  30. fileNew.write('Arguments=%s\n' % args)
  31. fileNew.flush()
  32. fileNew.close()
  33. print('Start normal domain... with template <%= @template %>')
  34. readTemplate('<%= @template %>')
  35. print('Set crossdomain')
  36. create('base_domain','SecurityConfiguration')
  37. cd('/SecurityConfiguration/base_domain')
  38. set('CrossDomainSecurityEnabled',true)
  39. cd('/')
  40. print('Set domain log')
  41. create('base_domain','Log')
  42. cd('/Log/base_domain')
  43. set('FileName','<%= @adminNodeMgrLogDir %>/'+DOMAIN+'.log')
  44. set('FileCount',10)
  45. set('FileMinSize',5000)
  46. set('RotationType','byTime')
  47. set('FileTimeSpan',24)
  48. print('Create machine LocalMachine with type <%= @nodeMgrMachine %>')
  49. cd('/')
  50. create('LocalMachine','<%= @nodeMgrMachine %>')
  51. cd('<%= @nodeMgrMachine %>/LocalMachine')
  52. create('LocalMachine','NodeManager')
  53. cd('NodeManager/LocalMachine')
  54. set('ListenAddress','<%= @adminListenAdr %>')
  55. cd('/Servers/AdminServer')
  56. # name of adminserver
  57. set('Name',ADMIN_SERVER )
  58. cd('/Servers/'+ADMIN_SERVER)
  59. set('Machine','LocalMachine')
  60. # address and port
  61. set('ListenAddress','<%= @adminListenAdr %>')
  62. set('ListenPort',<%= @adminListenPort %>)
  63. create(ADMIN_SERVER,'ServerStart')
  64. cd('ServerStart/'+ADMIN_SERVER)
  65. set('Arguments', ADM_JAVA_ARGUMENTS)
  66. set('JavaVendor','Sun')
  67. set('JavaHome', JAVA_HOME)
  68. cd('/Server/'+ADMIN_SERVER)
  69. create(ADMIN_SERVER,'SSL')
  70. cd('SSL/'+ADMIN_SERVER)
  71. set('Enabled', 'False')
  72. set('HostNameVerificationIgnored', 'True')
  73. print('Set adminserver log')
  74. cd('/Server/'+ADMIN_SERVER)
  75. create(ADMIN_SERVER,'Log')
  76. cd('/Server/'+ADMIN_SERVER+'/Log/'+ADMIN_SERVER)
  77. set('FileName','<%= @adminNodeMgrLogDir %>/'+ADMIN_SERVER+'.log')
  78. set('FileCount',10)
  79. set('FileMinSize',5000)
  80. set('RotationType','byTime')
  81. set('FileTimeSpan',24)
  82. print('Set password...')
  83. cd('/')
  84. cd('Security/base_domain/User/weblogic')
  85. # weblogic user name + password
  86. set('Name',ADMIN_USER)
  87. cmo.setPassword(ADMIN_PASSWORD)
  88. # Set domain save options:
  89. # - ServerStartMode: Set mode to development.
  90. # - JavaHome: Sets home directory for the JVM used when starting the server.
  91. if DEVELOPMENT_MODE == true:
  92. setOption('ServerStartMode', 'dev')
  93. else:
  94. setOption('ServerStartMode', 'prod')
  95. setOption('JavaHome', JAVA_HOME)
  96. print('write domain...')
  97. # write path + domain name
  98. writeDomain(DOMAIN_PATH)
  99. closeTemplate()
  100. readDomain(DOMAIN_PATH)
  101. if WEBLOGIC_VERSION == "1212":
  102. print 'Adding WLS Coherence Template'
  103. addTemplate('<%= @templateCoherence %>')
  104. updateDomain()
  105. closeDomain();
  106. es = encrypt(ADMIN_PASSWORD,DOMAIN_PATH)
  107. readDomain(DOMAIN_PATH)
  108. print('set domain password...')
  109. cd('/SecurityConfiguration/'+DOMAIN)
  110. set('CredentialEncrypted',es)
  111. print('Set nodemanager password')
  112. set('NodeManagerUsername',ADMIN_USER )
  113. set('NodeManagerPasswordEncrypted',es )
  114. updateDomain()
  115. closeDomain()
  116. createAdminStartupPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/data/nodemanager',ADM_JAVA_ARGUMENTS)
  117. createBootPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
  118. createBootPropertiesFile(DOMAIN_PATH+'/config/nodemanager','nm_password.properties',ADMIN_USER,ADMIN_PASSWORD)
  119. print('Exiting...')
  120. exit()