def create_boot_properties(configData, full_path): """ Create boot.properties files for instances """ if managed_key in configData: jsonDataArray = configData[managed_key] else: logging.error(managed_key + " config data missing from json. will not install") return if common_key in configData: commonData = configData[common_key] else: logging.error(common_key + " config data missing from json. will not install") return commonRequiredFields = ['middlewareHome', 'installOwner', 'installGroup', 'wl_domain'] commerce_setup_helper.check_required_fields(commonData, commonRequiredFields) INSTALL_DIR = commonData['middlewareHome'] INSTALL_OWNER = commonData['installOwner'] INSTALL_GROUP = commonData['installGroup'] WL_DOMAIN_NAME = commonData['wl_domain'] WL_ADMIN_USER = commonData['wl_adminUser'] WL_ADMIN_PW = commonData['wl_adminPassword'] SERVER_PATH = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME + '/servers/' logging.info("Checking boot.properties setup") for jsonData in jsonDataArray: requiredFields = ['managedServerName', 'managedServerHost'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) WL_SERVER_NAME = jsonData['managedServerName'] WL_SERVER_HOST = jsonData['managedServerHost'] # try to get the fqdn FQDN = socket.getfqdn() if (FQDN is not None): HOSTNAME = FQDN.split(".")[0] if (FQDN == WL_SERVER_HOST or HOSTNAME == WL_SERVER_HOST): # make sure the base servers path exists if(os.path.exists(SERVER_PATH)): # create the instance and security dir to write to boot file to outpath = SERVER_PATH + WL_SERVER_NAME + "/security/" commerce_setup_helper.mkdir_with_perms(outpath, INSTALL_OWNER, INSTALL_GROUP) outfile = outpath + 'boot.properties' outdata = open(outfile, 'w') outdata.write('username='******'password=' + WL_ADMIN_PW + "\n") outdata.close() # change the owner of boot.properties. should have been created by root commerce_setup_helper.change_file_owner(outfile, INSTALL_OWNER, INSTALL_GROUP) logging.info("Created boot.properties for " + WL_SERVER_NAME) else: logging.error("Cannot determine hostname. Cannot create boot.properties")
def install_mdex(configData, full_path): endecaData = configData[json_key] requiredFields = ['installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(endecaData, requiredFields) INSTALL_OWNER = endecaData['installOwner'] INSTALL_GROUP = endecaData['installGroup'] if 'mdex' in endecaData: jsonData = endecaData['mdex'] requiredFields = ['endecaRoot'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) else: logging.error(service_name + " config data missing from json. will not install") return logging.info("installing " + service_name) if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/endeca11.3/solaris" install_exec = "/MDEX_Install/OCmdex6.5.3-Solaris.bin" else: binary_path = full_path + "/binaries/endeca11.3" install_exec = "/MDEX_Install/OCmdex11.3.0-Linux64_1186050.bin" response_files_path = full_path + "/responseFiles/endeca11.3" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): logging.error("Binary " + full_exec_path + " does not exist - will not install") return False if jsonData is not None: ENDECA_ROOT = jsonData['endecaRoot'] # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER, INSTALL_GROUP) # data field to replace in our silent installer file field_replacements = {'INSTALLATION_DIR': ENDECA_ROOT} commerce_setup_helper.substitute_file_fields( response_files_path + '/mdex_response.rsp.master', response_files_path + '/mdex_response.rsp', field_replacements) installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + '/mdex_response.rsp' + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) # add bashrc entries commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Endeca Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "source " + ENDECA_ROOT + "/endeca/MDEX/11.3.0/mdex_setup_sh.ini \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export ENDECA_HOME=" + ENDECA_ROOT + "/endeca \n")
def install_java(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: print service_name + " config data missing from json. will not install" return if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/java1.8/solaris" else: binary_path = full_path + "/binaries/java1.8" requiredFields = ['javaHome', 'installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] JAVA_HOME = jsonData['javaHome'] commerce_setup_helper.mkdir_with_perms(JAVA_HOME, INSTALL_OWNER, INSTALL_GROUP) # solaris setup is different if (platform.system() == "SunOS"): install64bitCommand = "\"" + "cd " + JAVA_HOME + "; tar zxf " + binary_path + "/jdk-8u73-solaris-sparcv9.tar.gz " + "\"" else: installCommand = "\"" + "tar zxf " + binary_path + "/jdk-8u73-linux-x64.tar.gz -C " + JAVA_HOME + "\"" linkCommand = "\"" + "ln -sf " + JAVA_HOME + "/jdk1.8.0_73 " + JAVA_HOME + "/latest" + "\"" if (platform.system() == "SunOS"): commerce_setup_helper.exec_as_user(INSTALL_OWNER, install64bitCommand) else: commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) if (os.path.exists(JAVA_HOME + "/latest") or os.path.islink(JAVA_HOME + "/latest")): os.remove(JAVA_HOME + "/latest") os.symlink(JAVA_HOME + "/jdk1.8.0_73", JAVA_HOME + "/latest") # commerce_setup_helper.exec_as_user(INSTALL_OWNER, linkCommand) if (platform.system() != "SunOS"): if (os.path.exists('/usr/bin/java') or os.path.islink('/usr/bin/java')): os.remove('/usr/bin/java') os.symlink(JAVA_HOME + '/latest/bin/java', '/usr/bin/java') # add bashrc entries commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Java Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export JAVA_HOME=" + JAVA_HOME + "/latest \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export PATH=" + JAVA_HOME + "/latest/bin:$PATH \n\n") os.environ['JAVA_HOME'] = JAVA_HOME os.environ["PATH"] = JAVA_HOME + "/bin" + os.pathsep + os.environ["PATH"]
def install_mdex(configData, full_path): endecaData = configData[json_key] requiredFields = ['installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(endecaData, requiredFields) INSTALL_OWNER = endecaData['installOwner'] INSTALL_GROUP = endecaData['installGroup'] if 'mdex' in endecaData: jsonData = endecaData['mdex'] requiredFields = ['endecaRoot'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) else: print service_name + " config data missing from json. will not install" return print "installing " + service_name if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/endeca11.1/solaris" install_exec = "/MDEX_Install/OCmdex6.5.1-Solaris_829811.sh" else: binary_path = full_path + "/binaries/endeca11.1" install_exec = "/MDEX_Install/OCmdex6.5.1-Linux64_829811.sh" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): print "Binary " + full_exec_path + " does not exist - will not install" return False if jsonData is not None: ENDECA_ROOT = jsonData['endecaRoot'] # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER, INSTALL_GROUP) installCommand = "\"" + full_exec_path + " --target " + ENDECA_ROOT + "\"" # print "command is " + installCommand commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) # add bashrc entries commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Endeca Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "source " + ENDECA_ROOT + "/endeca/MDEX/6.5.1/mdex_setup_sh.ini \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export ENDECA_HOME=" + ENDECA_ROOT + "/endeca \n")
def install_cas(configData, full_path): endecaData = configData[json_key] requiredFields = ['installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(endecaData, requiredFields) INSTALL_OWNER = endecaData['installOwner'] INSTALL_GROUP = endecaData['installGroup'] if service_key in endecaData: jsonData = endecaData[service_key] requiredFields = [ 'endecaRoot', 'casPort', 'casShutdownPort', 'casHostname' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) else: print service_name + " config data missing from json. will not install" return print "installing " + service_name if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/endeca11.1/solaris" install_exec = "/CAS_Install/OCcas11.1.0-Solaris.sh" else: binary_path = full_path + "/binaries/endeca11.1" install_exec = "/CAS_Install/OCcas11.1.0-Linux64.sh" response_files_path = full_path + "/responseFiles/endeca11.1" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): print "Binary " + full_exec_path + " does not exist - will not install" return False if jsonData is not None: ENDECA_ROOT = jsonData['endecaRoot'] CAS_PORT = jsonData['casPort'] CAS_SHUTDOWN_PORT = jsonData['casShutdownPort'] CAS_HOSTNAME = jsonData['casHostname'] START_ON_BOOT = jsonData['start_onBoot'] # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER, INSTALL_GROUP) # data field to replace in our silent installer file field_replacements = { 'ENDECA_ROOT': ENDECA_ROOT, 'CAS_PORT': CAS_PORT, 'CAS_SHUTDOWN_PORT': CAS_SHUTDOWN_PORT, 'CAS_HOST': CAS_HOSTNAME } commerce_setup_helper.substitute_file_fields( response_files_path + '/cas_silent.txt.master', response_files_path + '/cas_silent.txt', field_replacements) installCommand = "\"" + full_exec_path + " --silent --target " + ENDECA_ROOT + \ " --endeca_tools_root " + ENDECA_ROOT + "/endeca/ToolsAndFrameworks/11.1.0 --endeca_tools_conf " + ENDECA_ROOT + "/endeca/ToolsAndFrameworks/11.1.0/server/workspace < " + \ response_files_path + "/cas_silent.txt \"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) if (platform.system() == 'SunOS'): startStopPath = "/startStopScripts/solaris/bootScripts/" else: startStopPath = "/startStopScripts/bootScripts/" # copy start/stop script ENDECA_HOME = ENDECA_ROOT + "/endeca" MDEX_SETUP = ENDECA_HOME + "/MDEX/6.5.1/mdex_setup_sh.ini" PLATFORM_SETUP = ENDECA_HOME + "/PlatformServices/workspace/setup/installer_sh.ini" script_replacements = { 'ENDECA_PROCESS_OWNER': INSTALL_OWNER, 'ENDECA_INSTALL_ROOT': ENDECA_HOME, "MDEX_SETUP": MDEX_SETUP, "PLATFORM_SETUP": PLATFORM_SETUP } commerce_setup_helper.copy_start_script( START_ON_BOOT, full_path + startStopPath + 'endecaCAS.master', script_replacements) # restart other services before cas platformCmd = "/etc/init.d/platformServices" toolsCmd = "/etc/init.d/toolsAndFramework" commerce_setup_helper.exec_cmd(toolsCmd + " stop") commerce_setup_helper.exec_cmd(platformCmd + " restart") commerce_setup_helper.exec_cmd(toolsCmd + " start") # start cas startCmd = "/etc/init.d/endecaCAS" commerce_setup_helper.exec_cmd(startCmd + " start") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "# echo Endeca " + service_name + " start/stop script: " + startCmd + "\n")
def install_weblogic(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: logging.error(json_key + " config data missing from json. will not install") return False logging.info("installing " + service_name) binary_path = full_path + "/binaries/wls-12.1.2" response_files_path = full_path + "/responseFiles/wls-12.1.2" install_exec = "wls_121200.jar" full_exec_path = binary_path + "/" + install_exec if not os.path.exists(full_exec_path): logging.error("Binary " + full_exec_path + " does not exist - will not install") return False requiredFields = ['middlewareHome', 'installOwner', 'installGroup', 'oraInventoryDir'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_DIR = jsonData['middlewareHome'] INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir'] ORA_INST = "/etc/oraInst.loc" oraInst_replacements = {'ORACLE_INVENTORY_DIR':ORACLE_INVENTORY_DIR, 'ORACLE_INVENTORY_GROUP':INSTALL_GROUP} # if oraInst.loc doesn't already exist, we need to make one if not os.path.isfile(ORA_INST): commerce_setup_helper.substitute_file_fields(response_files_path + '/oraInst.loc.master', response_files_path + '/oraInst.loc', oraInst_replacements) shutil.copyfile(response_files_path + "/oraInst.loc" , ORA_INST) commerce_setup_helper.change_file_owner(ORA_INST, INSTALL_OWNER, INSTALL_GROUP) os.chmod(ORA_INST, 0664) wl_replacements = {'INSTALL_DIR':INSTALL_DIR} commerce_setup_helper.substitute_file_fields(response_files_path + '/install.rsp.master', response_files_path + '/install.rsp', wl_replacements) # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER, INSTALL_GROUP) # install wl if (platform.system() == 'SunOS'): installCommand = "\"" + "java -d64 -jar " else: installCommand = "\"" + "java -jar " installCommand = installCommand + full_exec_path + " -silent -invPtrLoc " + ORA_INST + " -responseFile " + response_files_path + "/install.rsp -logfile wlinstall.log" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#WebLogic Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "export MW_HOME=" + INSTALL_DIR + "\n\n") JAVA_RAND = "" # if linux/Solaris, change random, This is faster in some implementations. if (platform.system() == "SunOS"): JAVA_RAND = "-Djava.security.egd=file:///dev/urandom" else: JAVA_RAND = "-Djava.security.egd=file:/dev/./urandom" commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, 'export CONFIG_JVM_ARGS=\"' + JAVA_RAND + ' \" \n') commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, 'export JAVA_OPTIONS=\"' + JAVA_RAND + ' \" \n') # install patches if any were listed patch_weblogic(configData, full_path)
def install_oracle(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: print json_key + " config data missing from json. will not install" return print "installing " + service_name if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/oracleDB12c/solaris" else: binary_path = full_path + "/binaries/oracleDB12c" response_files_path = full_path + "/responseFiles/oracle12c" install_exec = "/database/runInstaller" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): print "Binary " + full_exec_path + " does not exist - will not install" return False requiredFields = [ 'oracleBase', 'installOwner', 'installGroup', 'installHost', 'oraInventoryDir', 'oracleHome', 'oracleSID', 'pdbName', 'adminPW', 'dbStorageLoc' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) ORACLE_BASE = jsonData['oracleBase'] INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] INSTALL_HOST = jsonData['installHost'] ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir'] ORACLE_HOME = jsonData['oracleHome'] ORACLE_SID = jsonData['oracleSID'] PDB_NAME = jsonData['pdbName'] ORACLE_PW = jsonData['adminPW'] DB_FILE_DIR = jsonData['dbStorageLoc'] ORACLE_BOOT = jsonData['db_onBoot'] oracle_replacements = { 'BASE_DIR': ORACLE_BASE, 'IGROUP': INSTALL_GROUP, 'INSTALL_HOST': INSTALL_HOST, 'INVENTORY_DIR': ORACLE_INVENTORY_DIR, 'PRODUCT_HOME': ORACLE_HOME, 'GLOBAL_DBNAME': ORACLE_SID, 'PDB_NAME': PDB_NAME, 'ORA_PW': ORACLE_PW, 'DB_FILE_DIR': DB_FILE_DIR, } commerce_setup_helper.substitute_file_fields( response_files_path + '/db.rsp.master', response_files_path + '/db.rsp', oracle_replacements) commerce_setup_helper.substitute_file_fields( response_files_path + '/dbca.rsp.master', response_files_path + '/dbca.rsp', oracle_replacements) # make the install trees with correct owner if needed commerce_setup_helper.mkdir_with_perms(ORACLE_BASE, INSTALL_OWNER, INSTALL_GROUP) commerce_setup_helper.mkdir_with_perms(ORACLE_INVENTORY_DIR, INSTALL_OWNER, INSTALL_GROUP) commerce_setup_helper.mkdir_with_perms(ORACLE_HOME, INSTALL_OWNER, INSTALL_GROUP) commerce_setup_helper.mkdir_with_perms(DB_FILE_DIR, INSTALL_OWNER, INSTALL_GROUP) # install db installCommand = "\"" + full_exec_path + " -silent -waitforcompletion -responseFile " + response_files_path + "/db.rsp" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) invCmd = ORACLE_INVENTORY_DIR + "/orainstRoot.sh" commerce_setup_helper.exec_cmd(invCmd) rootCmd = ORACLE_HOME + "/root.sh" commerce_setup_helper.exec_cmd(rootCmd) postInstallCmd = "\"" + ORACLE_HOME + "/cfgtoollogs/configToolAllCommands RESPONSE_FILE=" + response_files_path + "/db.rsp" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, postInstallCmd) commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Oracle Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export ORACLE_HOME=" + ORACLE_HOME + "\n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export ORACLE_SID=" + ORACLE_SID + "\n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export PATH=$PATH:" + ORACLE_HOME + "/bin \n") # copy start/stop script script_replacements = { 'ORACLE_HOME': ORACLE_HOME, 'ORACLE_PROCESS_OWNER': INSTALL_OWNER } commerce_setup_helper.copy_start_script( ORACLE_BOOT, full_path + '/startStopScripts/bootScripts/oracleDatabase.master', script_replacements) # commerce_setup_helper.copy_start_script(ORACLE_BOOT, full_path + '/startStopScripts/bootScripts/oracleDBconsole.master', script_replacements) commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "# echo " + service_name + " start/stop script: /etc/init.d/oracleDatabase \n") # not used for 12c install - using em express instead # commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "# echo database console start/stop script: /etc/init.d/oracleDBconsole \n\n") install_listener(INSTALL_OWNER, ORACLE_HOME, response_files_path) install_sampledb(INSTALL_OWNER, ORACLE_HOME, response_files_path) if (platform.system() == "SunOS"): oratab_file = "/var/opt/oracle/oratab" else: oratab_file = "/etc/oratab" # set our DB to autostart in the future line_to_replace = ORACLE_SID + ":" + ORACLE_HOME + ":" "N" replace_with = ORACLE_SID + ":" + ORACLE_HOME + ":" "Y" for line in fileinput.input(oratab_file, inplace=True): print line.rstrip().replace(line_to_replace, replace_with)
def install_atg(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: logging.error(json_key + " config data missing from json. will not install") return False logging.info("installing " + service_name) binary_path = full_path + "/binaries/atg11.3" response_files_path = full_path + "/responseFiles/atg11.3" install_exec = "/linux/OCPlatform11.3.bin" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): logging.error("Binary " + full_exec_path + " does not exist - will not install") return False requiredFields = [ 'dynamoRoot', 'installOwner', 'installGroup', 'rmiPort', 'javaHome', 'wl_home', 'wl_domain', 'wl_adminPort', 'install_crs', 'install_csa' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_DIR = jsonData['dynamoRoot'] INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] RMI_PORT = jsonData['rmiPort'] JAVA_DIR = jsonData['javaHome'] WL_HOME = jsonData['wl_home'] WL_DOMAIN = jsonData['wl_domain'] WL_ADMIN_PORT = jsonData['wl_adminPort'] INSTALL_CRS = jsonData['install_crs'] INSTALL_CSA = jsonData['install_csa'] INSTALL_SERVICE = jsonData['install_service'] field_replacements = { 'INSTALL_HOME': INSTALL_DIR, 'WEBLOGIC_HOME': WL_HOME, 'WEBLOGIC_DOMAIN': WL_DOMAIN, 'WEBLOGIC_ADMIN_PORT': WL_ADMIN_PORT, 'ATGRMI_PORT': RMI_PORT, 'JDK_PATH': JAVA_DIR } commerce_setup_helper.substitute_file_fields( response_files_path + '/linux/installer.properties.master', response_files_path + '/linux/installer.properties', field_replacements) # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER, INSTALL_GROUP) installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + "/linux/installer.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#ATG Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export DYNAMO_ROOT=" + INSTALL_DIR + "\n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export DYNAMO_HOME=$DYNAMO_ROOT/home \n\n") if (INSTALL_CRS == "true"): logging.info("installing CRS") crs_exec_path = binary_path + "/crs/OCReferenceStore11.3.bin" if not os.path.exists(crs_exec_path): logging.error("Binary " + crs_exec_path + " does not exist - will not install") return False field_replacements = {'INSTALL_HOME': INSTALL_DIR} commerce_setup_helper.substitute_file_fields( response_files_path + '/crs/crsinstaller.properties.master', response_files_path + '/crs/crsinstaller.properties', field_replacements) installCommand = "\"" + crs_exec_path + " -i silent -f " + response_files_path + "/crs/crsinstaller.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) if (INSTALL_CSA == "true"): logging.info("installing CSA") csa_exec_path = binary_path + "/csa/OCStoreAccelerator11.3.bin" if not os.path.exists(csa_exec_path): logging.error("Binary " + csa_exec_path + " does not exist - will not install") return False field_replacements = {'INSTALL_HOME': INSTALL_DIR} commerce_setup_helper.substitute_file_fields( response_files_path + '/csa/csainstaller.properties.master', response_files_path + '/csa/csainstaller.properties', field_replacements) installCommand = "\"" + csa_exec_path + " -i silent -f " + response_files_path + "/csa/csainstaller.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) if (INSTALL_SERVICE == "true"): logging.info("installing Service") service_exec_path = binary_path + "/service/OCServiceCenter11.3.bin" if not os.path.exists(service_exec_path): logging.error("Binary " + service_exec_path + " does not exist - will not install") return field_replacements = {'INSTALL_HOME': INSTALL_DIR} commerce_setup_helper.substitute_file_fields( response_files_path + '/service/serviceinstaller.properties.master', response_files_path + '/service/serviceinstaller.properties', field_replacements) installCommand = "\"" + service_exec_path + " -i silent -f " + response_files_path + "/service/serviceinstaller.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)
def install_atg(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: print json_key + " config data missing from json. will not install" return False print "installing " + service_name binary_path = full_path + "/binaries/atg11.1" response_files_path = full_path + "/responseFiles/atg11.1" install_exec = "/linux/OCPlatform11.1.bin" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): print "Binary " + full_exec_path + " does not exist - will not install" return False requiredFields = [ 'dynamoRoot', 'installOwner', 'installGroup', 'rmiPort', 'javaHome', 'wl_home', 'wl_domain', 'wl_adminPort', 'install_crs' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_DIR = jsonData['dynamoRoot'] INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] RMI_PORT = jsonData['rmiPort'] JAVA_DIR = jsonData['javaHome'] WL_HOME = jsonData['wl_home'] WL_DOMAIN = jsonData['wl_domain'] WL_ADMIN_PORT = jsonData['wl_adminPort'] INSTALL_CRS = jsonData['install_crs'] INSTALL_SERVICE = jsonData['install_service'] field_replacements = { 'INSTALL_HOME': INSTALL_DIR, 'WEBLOGIC_HOME': WL_HOME, 'WEBLOGIC_DOMAIN': WL_DOMAIN, 'WEBLOGIC_ADMIN_PORT': WL_ADMIN_PORT, 'ATGRMI_PORT': RMI_PORT, 'JDK_PATH': JAVA_DIR } commerce_setup_helper.substitute_file_fields( response_files_path + '/linux/installer.properties.master', response_files_path + '/linux/installer.properties', field_replacements) # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER, INSTALL_GROUP) installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + "/linux/installer.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#ATG Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export DYNAMO_ROOT=" + INSTALL_DIR + "\n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export DYNAMO_HOME=$DYNAMO_ROOT/home \n\n") if (INSTALL_CRS == "true"): print "installing CRS" crs_exec_path = binary_path + "/crs/OCReferenceStore11.1.bin" if not os.path.exists(crs_exec_path): print "Binary " + crs_exec_path + " does not exist - will not install" return field_replacements = {'INSTALL_HOME': INSTALL_DIR} commerce_setup_helper.substitute_file_fields( response_files_path + '/crs/crsinstaller.properties.master', response_files_path + '/crs/crsinstaller.properties', field_replacements) installCommand = "\"" + crs_exec_path + " -i silent -f " + response_files_path + "/crs/crsinstaller.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) # If patch1 is installed, these are not updated. fix it. cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/Storefront/j2ee-apps/Storefront/store.war/WEB-INF/lib" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd) cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/Storefront/j2ee-apps/Storefront/storedocroot.war/WEB-INF/lib" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd) cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/Fluoroscope/j2ee-apps/Fluoroscope/fluoroscope.war/WEB-INF/lib" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd) cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/DCS-CSR/j2ee-apps/DCS-CSR/CSRHelper.war/WEB-INF/lib" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd) cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/EStore/Versioned/j2ee-apps/Versioned/store-merchandising.war/WEB-INF/lib" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd) if (INSTALL_SERVICE == "true"): print "installing Service" service_exec_path = binary_path + "/service/OCServiceCenter11.1.bin" if not os.path.exists(service_exec_path): print "Binary " + service_exec_path + " does not exist - will not install" return field_replacements = {'INSTALL_HOME': INSTALL_DIR} commerce_setup_helper.substitute_file_fields( response_files_path + '/service/serviceinstaller.properties.master', response_files_path + '/service/serviceinstaller.properties', field_replacements) installCommand = "\"" + service_exec_path + " -i silent -f " + response_files_path + "/service/serviceinstaller.properties" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)
def install_toolsAndFramework(configData, full_path): endecaData = configData[json_key] requiredFields = ['installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(endecaData, requiredFields) INSTALL_OWNER = endecaData['installOwner'] INSTALL_GROUP = endecaData['installGroup'] if 'toolsAndFramework' in endecaData: jsonData = endecaData['toolsAndFramework'] requiredFields = ['endecaRoot'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) else: logging.error(service_name + " config data missing from json. will not install") return logging.info("installing " + service_name) if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/endeca11.3/solaris" else: binary_path = full_path + "/binaries/endeca11.3" install_exec = "/ToolsAndFrameworkInstall/Disk1/install/silent_install.sh" response_files_path = full_path + "/responseFiles/endeca11.3" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): logging.error("Binary " + full_exec_path + " does not exist - will not install") return False if jsonData is not None: ENDECA_ROOT = jsonData['endecaRoot'] START_ON_BOOT = jsonData['start_onBoot'] # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER, INSTALL_GROUP) # data field to replace in our silent installer file field_replacements = { 'ENDECA_ROOT': ENDECA_ROOT, 'ENDECA_GROUP': INSTALL_GROUP } commerce_setup_helper.substitute_file_fields( response_files_path + '/tools_response.rsp.master', response_files_path + '/tools_response.rsp', field_replacements) installCommand = "\"" + full_exec_path + " " + \ response_files_path + "/tools_response.rsp ToolsAndFrameworks " + \ ENDECA_ROOT + "/endeca/ToolsAndFrameworks " if 'oraInventoryDir' in jsonData: installCommand = installCommand + jsonData['oraInventoryDir'] commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand + "\"") # copy start/stop script ENDECA_HOME = ENDECA_ROOT + "/endeca" MDEX_SETUP = ENDECA_HOME + "/MDEX/11.3.0/mdex_setup_sh.ini" PLATFORM_SETUP = ENDECA_HOME + "/PlatformServices/workspace/setup/installer_sh.ini" script_replacements = { 'ENDECA_PROCESS_OWNER': INSTALL_OWNER, 'ENDECA_INSTALL_ROOT': ENDECA_HOME, "MDEX_SETUP": MDEX_SETUP, "PLATFORM_SETUP": PLATFORM_SETUP, "INSTALL_VERSION": endeca_version } commerce_setup_helper.copy_start_script( START_ON_BOOT, full_path + '/startStopScripts/bootScripts/toolsAndFramework.master', script_replacements) # fire up the server startCmd = "/etc/init.d/toolsAndFramework" commerce_setup_helper.exec_cmd(startCmd + " start") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "# echo Endeca " + service_name + " start/stop script: " + startCmd + "\n")
def install_platformServices(configData, full_path): endecaData = configData[json_key] requiredFields = ['installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(endecaData, requiredFields) INSTALL_OWNER = endecaData['installOwner'] INSTALL_GROUP = endecaData['installGroup'] if 'platformServices' in endecaData: jsonData = endecaData['platformServices'] requiredFields = [ 'endecaRoot', 'eacPort', 'eacShutdownPort', 'mdexRoot' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) else: logging.error(service_name + " config data missing from json. will not install") return logging.info("installing " + service_name) if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/endeca11.3/solaris" install_exec = "/Platform_Install/OCplatformservices11.3.0-Solaris.bin" else: binary_path = full_path + "/binaries/endeca11.3" install_exec = "/Platform_Install/OCplatformservices11.3.0-Linux64.bin" response_files_path = full_path + "/responseFiles/endeca11.3" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): logging.error("Binary " + full_exec_path + " does not exist - will not install") return False if jsonData is not None: ENDECA_ROOT = jsonData['endecaRoot'] MDEX_ROOT = jsonData['mdexRoot'] EAC_PORT = jsonData['eacPort'] EAC_SHUTDOWN_PORT = jsonData['eacShutdownPort'] START_ON_BOOT = jsonData['start_onBoot'] # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER, INSTALL_GROUP) # data field to replace in our silent installer file field_replacements = { 'INSTALLATION_DIR': ENDECA_ROOT, 'MDEX_INST_ROOT': MDEX_ROOT, 'EAC_PORT': EAC_PORT, 'EAC_SHUTDOWN_PORT': EAC_SHUTDOWN_PORT } commerce_setup_helper.substitute_file_fields( response_files_path + '/platform_response.rsp.master', response_files_path + '/platform_response.rsp', field_replacements) installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + '/platform_response.rsp' + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) # add bashrc entries commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "source " + ENDECA_ROOT + "/endeca/PlatformServices/workspace/setup/installer_sh.ini \n") # copy start/stop script ENDECA_HOME = ENDECA_ROOT + "/endeca" MDEX_SETUP = MDEX_ROOT + "/mdex_setup_sh.ini" PLATFORM_SETUP = ENDECA_HOME + "/PlatformServices/workspace/setup/installer_sh.ini" script_replacements = { 'ENDECA_PROCESS_OWNER': INSTALL_OWNER, 'ENDECA_INSTALL_ROOT': ENDECA_HOME, "MDEX_SETUP": MDEX_SETUP, "PLATFORM_SETUP": PLATFORM_SETUP, "INSTALL_VERSION": endeca_version } commerce_setup_helper.copy_start_script( START_ON_BOOT, full_path + '/startStopScripts/bootScripts/platformServices.master', script_replacements) # fire up the server startCmd = "/etc/init.d/platformServices" commerce_setup_helper.exec_cmd(startCmd + " start") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "# echo Endeca " + service_name + " start/stop script: " + startCmd + "\n")
def install_otd(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: print json_key + " config data missing from json. will not install" return False print "installing " + service_name if (platform.system() == "SunOS"): binary_path = full_path + "/binaries/OTD11.1.1.9/solaris" else: binary_path = full_path + "/binaries/OTD11.1.1.9" install_exec = "/Disk1/runInstaller" response_files_path = full_path + "/responseFiles/OTD11" full_exec_path = binary_path + install_exec if not os.path.exists(full_exec_path): print "Binary " + full_exec_path + " does not exist - will not install" return False requiredFields = [ 'instanceHome', 'installDir', 'adminUser', 'installOwner', 'adminPassword', 'oraInventoryDir' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_OWNER = jsonData['installOwner'] INSTANCE_HOME = jsonData['instanceHome'] INSTALL_DIR = jsonData['installDir'] ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir'] ORACLE_INVENTORY_GROUP = jsonData['oraInventoryGroup'] ADMIN_USER = jsonData['adminUser'] ADMIN_PASSWORD = jsonData['adminPassword'] OTD_ADMIN_BOOT = jsonData['otd_startAdmin_onBoot'] ORA_INST = "/etc/oraInst.loc" OTD_INSTANCE_NAME = "admin-server" oraInst_replacements = { 'ORACLE_INVENTORY_DIR': ORACLE_INVENTORY_DIR, 'ORACLE_INVENTORY_GROUP': ORACLE_INVENTORY_GROUP } otdPassword_replacements = {'TADM_ADMINPASSWORD': ADMIN_PASSWORD} # if oraInst.loc doesn't already exist, we need to make one if not os.path.isfile(ORA_INST): commerce_setup_helper.substitute_file_fields( response_files_path + '/oraInst.loc.master', response_files_path + '/oraInst.loc', oraInst_replacements) shutil.copyfile(response_files_path + "/oraInst.loc", ORA_INST) commerce_setup_helper.change_file_owner(ORA_INST, INSTALL_OWNER, ORACLE_INVENTORY_GROUP) os.chmod(ORA_INST, 0664) # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER, ORACLE_INVENTORY_GROUP) # exec the install command installCommand = "\"" + binary_path + "/Disk1/runInstaller -silent -waitforcompletion -invPtrLoc /etc/oraInst.loc ORACLE_HOME=" + INSTALL_DIR + " SKIP_SOFTWARE_UPDATES=true\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) # setup password file commerce_setup_helper.substitute_file_fields( response_files_path + '/otdPassword.pwd.master', response_files_path + '/otdPassword.pwd', otdPassword_replacements) # exec base admin server creation configCommand = "\"" + INSTALL_DIR + "/bin/tadm configure-server --user="******" --instance-home=" + INSTANCE_HOME + " --password-file=" + response_files_path + "/otdPassword.pwd\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, configCommand) if (platform.system() == 'SunOS'): startStopPath = "/startStopScripts/solaris/bootScripts/" else: startStopPath = "/startStopScripts/bootScripts/" # copy start/stop script otdScript_replacements = { 'OTD_PROCESS_OWNER': INSTALL_OWNER, 'OTD_INSTANCE_HOME': INSTANCE_HOME, 'OTD_INSTANCE_NAME': OTD_INSTANCE_NAME } commerce_setup_helper.copy_start_script( OTD_ADMIN_BOOT, full_path + startStopPath + 'OTDAdmin.master', otdScript_replacements) # fire up the otd admin server startCmd = "/etc/init.d/OTDAdmin" commerce_setup_helper.exec_cmd(startCmd + " start") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "# echo " + service_name + " start/stop script: " + startCmd + "\n\n")
def install_weblogic(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: print json_key + " config data missing from json. will not install" return print "installing " + service_name binary_path = full_path + "/binaries/wls-12.1.3" response_files_path = full_path + "/responseFiles/wls-12.1.3" install_exec = "fmw_12.1.3.0.0_wls.jar" full_exec_path = binary_path + "/" + install_exec if not os.path.exists(full_exec_path): print "Binary " + full_exec_path + " does not exist - will not install" return False requiredFields = [ 'middlewareHome', 'installOwner', 'installGroup', 'oraInventoryDir' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_DIR = jsonData['middlewareHome'] INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir'] ORA_INST = "/etc/oraInst.loc" oraInst_replacements = { 'ORACLE_INVENTORY_DIR': ORACLE_INVENTORY_DIR, 'ORACLE_INVENTORY_GROUP': INSTALL_GROUP } # if oraInst.loc doesn't already exist, we need to make one if not os.path.isfile(ORA_INST): commerce_setup_helper.substitute_file_fields( response_files_path + '/oraInst.loc.master', response_files_path + '/oraInst.loc', oraInst_replacements) shutil.copyfile(response_files_path + "/oraInst.loc", ORA_INST) commerce_setup_helper.change_file_owner(ORA_INST, INSTALL_OWNER, INSTALL_GROUP) os.chmod(ORA_INST, 0664) wl_replacements = {'INSTALL_DIR': INSTALL_DIR} commerce_setup_helper.substitute_file_fields( response_files_path + '/install.rsp.master', response_files_path + '/install.rsp', wl_replacements) # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER, INSTALL_GROUP) # install wl if (platform.system() == 'SunOS'): installCommand = "\"" + "java -d64 -jar " else: installCommand = "\"" + "java -jar " installCommand = installCommand + full_exec_path + " -silent -invPtrLoc " + ORA_INST + " -responseFile " + response_files_path + "/install.rsp -logfile wlinstall.log" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#WebLogic Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export MW_HOME=" + INSTALL_DIR + "\n\n") # install patches if any were listed patch_weblogic(configData, full_path)
def unpack_domain(configData, full_path): """ Get domain template and unpack it for a new managed server setup """ if json_key in configData: jsonData = configData[json_key] else: print json_key + " config data missing from json. will not install" return if common_key in configData: commonData = configData[common_key] else: print common_key + " config data missing from json. will not install" return print "Unpacking... " + service_name commonRequiredFields = [ 'middlewareHome', 'installOwner', 'installGroup', 'wl_domain', 'wl_adminHost' ] commerce_setup_helper.check_required_fields(commonData, commonRequiredFields) requiredFields = ['wl_startNodemgr_onBoot'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_DIR = commonData['middlewareHome'] INSTALL_OWNER = commonData['installOwner'] INSTALL_GROUP = commonData['installGroup'] WL_DOMAIN_NAME = commonData['wl_domain'] WL_ADMIN_HOST = commonData['wl_adminHost'] WL_NODE_BOOT = jsonData['wl_startNodemgr_onBoot'] WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME DOMAIN_TEMPLATE_NAME = WL_DOMAIN_NAME + '-template.jar' DOMAIN_TEMPLATE_PATH = INSTALL_DIR + '/user_projects/domains/' + DOMAIN_TEMPLATE_NAME if not os.path.isfile(DOMAIN_TEMPLATE_PATH): print "domain template not found. Try to get it" # make the install tree with correct owner if needed commerce_setup_helper.mkdir_with_perms(WL_DOMAIN_HOME, INSTALL_OWNER, INSTALL_GROUP) retrieve_domain_template(DOMAIN_TEMPLATE_NAME, DOMAIN_TEMPLATE_PATH, WL_ADMIN_HOST) unpackCmd = "\"" + INSTALL_DIR + "/wlserver/common/bin/unpack.sh -domain=" + WL_DOMAIN_HOME + " -template=" + WL_DOMAIN_HOME + "-template.jar\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, unpackCmd) # copy start/stop script WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME if (platform.system() == 'SunOS'): startStopPath = "/startStopScripts/solaris/bootScripts/" else: startStopPath = "/startStopScripts/bootScripts/" # copy start/stop script WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME wlScript_replacements = { 'WL_DOMAIN_HOME': WL_DOMAIN_HOME, "WL_PROCESS_OWNER": INSTALL_OWNER } commerce_setup_helper.copy_start_script( WL_NODE_BOOT, full_path + startStopPath + 'weblogicNodemgr.master', wlScript_replacements) # fire up the nodemgr startNodeCmd = "/etc/init.d/weblogicNodemgr" commerce_setup_helper.exec_cmd(startNodeCmd + " start")
def install_java(configData, full_path): if json_key in configData: jsonData = configData[json_key] else: logging.error(service_name + " config data missing from json. will not install") return if installer_key in configData: installerData = configData[installer_key] else: logging.error("installer data missing. Cannot continue") return logging.info("installing " + service_name) config = ConfigParser.ConfigParser() installer_props = installerData['installer_properties'] config_file = full_path + '/' + installer_props if (not os.path.exists(config_file)): logging.error("Cannot load installer config data. Halting") logging.info("config file is " + config_file) config.read(config_file) rel_path = config.get(service_name, 'java_binary') java_version = config.get(service_name, 'java_version') binary_path = full_path + '/' + rel_path requiredFields = ['javaHome', 'installOwner', 'installGroup'] commerce_setup_helper.check_required_fields(jsonData, requiredFields) INSTALL_OWNER = jsonData['installOwner'] INSTALL_GROUP = jsonData['installGroup'] JAVA_HOME = jsonData['javaHome'] commerce_setup_helper.mkdir_with_perms(JAVA_HOME, INSTALL_OWNER, INSTALL_GROUP) # solaris setup is different if (platform.system() == "SunOS"): installCommand = "\"" + "cd " + JAVA_HOME + "; tar zxf " + binary_path + "\"" else: installCommand = "\"" + "tar zxf " + binary_path + " -C " + JAVA_HOME + "\"" linkCommand = "\"" + "ln -sf " + JAVA_HOME + "/" + java_version + " " + JAVA_HOME + "/latest" + "\"" commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand) if (os.path.exists(JAVA_HOME + "/latest") or os.path.islink(JAVA_HOME + "/latest")): os.remove(JAVA_HOME + "/latest") os.symlink(JAVA_HOME + "/" + java_version, JAVA_HOME + "/latest") # commerce_setup_helper.exec_as_user(INSTALL_OWNER, linkCommand) if (platform.system() != "SunOS"): if (os.path.exists('/usr/bin/java') or os.path.islink('/usr/bin/java')): os.remove('/usr/bin/java') os.symlink(JAVA_HOME + '/latest/bin/java', '/usr/bin/java') # add bashrc entries commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Java Settings \n") commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export JAVA_HOME=" + JAVA_HOME + "/latest \n") commerce_setup_helper.add_to_bashrc( INSTALL_OWNER, "export PATH=" + JAVA_HOME + "/latest/bin:$PATH \n\n") os.environ['JAVA_HOME'] = JAVA_HOME os.environ["PATH"] = JAVA_HOME + "/bin" + os.pathsep + os.environ["PATH"]
def create_managed_scripts(configData, full_path): """ Create start/stop scripts for managed servers """ if json_key in configData: jsonDataArray = configData[json_key] else: logging.error(json_key + " config data missing from json. will not install") return if common_key in configData: commonData = configData[common_key] else: logging.error(common_key + " config data missing from json. will not install") return logging.info("Updating... " + service_name) commonRequiredFields = [ 'middlewareHome', 'installOwner', 'installGroup', 'wl_domain', 'wl_adminHost', 'wl_adminHttpPort' ] commerce_setup_helper.check_required_fields(commonData, commonRequiredFields) INSTALL_DIR = commonData['middlewareHome'] INSTALL_OWNER = commonData['installOwner'] INSTALL_GROUP = commonData['installGroup'] WL_DOMAIN_NAME = commonData['wl_domain'] WL_ADMIN_HOST = commonData['wl_adminHost'] WL_ADMIN_HTTP_PORT = commonData['wl_adminHttpPort'] WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME ADMIN_URL = WL_ADMIN_HOST + ":" + WL_ADMIN_HTTP_PORT if (platform.system() == 'SunOS'): startStopPath = "/startStopScripts/solaris/bootScripts/" else: startStopPath = "/startStopScripts/bootScripts/" for jsonData in jsonDataArray: requiredFields = [ 'managedServerName', 'managedServerHost', 'wl_startManaged_onBoot' ] commerce_setup_helper.check_required_fields(jsonData, requiredFields) WL_SERVER_NAME = jsonData['managedServerName'] WL_SERVER_HOST = jsonData['managedServerHost'] WL_SERVER_BOOT = jsonData['wl_startManaged_onBoot'] # copy start/stop script WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME wlScript_replacements = { 'WL_DOMAIN_HOME': WL_DOMAIN_HOME, "WL_PROCESS_OWNER": INSTALL_OWNER, "INSTANCE_NAME": WL_SERVER_NAME, "ADMIN_URL": ADMIN_URL } # try to get the fqdn FQDN = socket.getfqdn() if (FQDN is not None): HOSTNAME = FQDN.split(".")[0] if (FQDN == WL_SERVER_HOST or HOSTNAME == WL_SERVER_HOST): SCRIPT_NAME = 'weblogicManaged-' + WL_SERVER_NAME logging.info('Generating startup script for server ' + WL_SERVER_NAME) commerce_setup_helper.copy_start_script( WL_SERVER_BOOT, full_path + startStopPath + 'weblogicManaged.master', wlScript_replacements, SCRIPT_NAME) # make the path to the log dir, or first server start will fail with scripts logging.info('Generating log dir for server ' + WL_SERVER_NAME) SERVER_LOG_PATH = WL_DOMAIN_HOME + '/servers/' + WL_SERVER_NAME + '/logs' commerce_setup_helper.mkdir_with_perms(SERVER_LOG_PATH, INSTALL_OWNER, INSTALL_GROUP) # fire up the instance logging.info('Starting up instance ' + WL_SERVER_NAME) startCmd = "/etc/init.d/" + SCRIPT_NAME commerce_setup_helper.exec_cmd(startCmd + " start") else: logging.error( "Cannot determine hostname. Cannot create startup script")