Last active
August 28, 2016 16:39
-
-
Save mtcoffee/468614945b56c586d8a4642d2e9d1932 to your computer and use it in GitHub Desktop.
CreatePIAServerDomain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script will quickly create a new Linux/Unix PeopleSoft webserver domain and perform some checks | |
#IMPORT INFORMATION | |
#1. YOU MUST SET THE PS_HOME PS_CFG_HOME PS_APP_HOME and PS_CUST_HOME VARIABLES BEFORE RUNNING THIS SCRIPT | |
#2. THE SECTION AFTER "POST DOMAIN CREATION CHECKS AND CONFIGURATION" IS OPTIONAL AND CAN BE EASILY CUSTOMIZED OR EXCLUDED. | |
# IT INCLUDES SOME TEXT FILE MANIPULATION TO CONFIGURE YOUR IBGATEWAY SETTINGS AND IMPORTS ANY CERTIFICATES NEED BY YOUR WEBLOGIC KEYSTORE | |
#Known to work with PeopleTools 8.54 and 8.55. | |
############################ | |
##variables required for silent install of PIA domain | |
BEA_HOME=/apps/psoft/tools_homes/pt85509/pt/bea/ | |
SILENT_INSTALL_FILE=$PS_HOME/tmp/install.properties | |
NEW_DOMAIN=mydomain | |
WLPASS=Welcome1 | |
APPSERVER=server1 | |
JOLT_PORT=9000 | |
PIA_HTTP_PORT=8080 | |
PIA_HTTPS_PORT=4443 | |
AUTHENTICATION_DOMAIN=mydomain.com | |
WEB_PROFILE=DEV | |
WEB_PROFILE_USER=PTWEBSERVER | |
WEB_PROFILE_PWD=Welcome1 | |
IB_PWD=Welcome1 | |
REPORTS_DIR=/apps/psoft | |
#Set Cert Path | |
CERT_DIR=/apps/psoft/certs | |
#Set variables for IB Gateway settings | |
IBGWLOCALNODE=PSFT_EP | |
IBGWUSER=PS | |
IBGWPWD=PS | |
IBGWKEY=newpskeypassword | |
#Check if variables are set and point to valid paths | |
PATHSTOCHECK=(PS_HOME PS_CFG_HOME PS_APP_HOME PS_CUST_HOME) | |
for i in ${PATHSTOCHECK[*]}; do | |
if [ -n "${!i}" ] && [ -d "${!i}" ]; then | |
echo "$i path ${!i} does exist" | |
else | |
echo "########################################" | |
echo "$i path ${!i} does not exist or variable is not set This needs to be corrected first." ; exit 1 | |
fi | |
done; | |
# Test Certicate import path. If your not importing certificates you can commment this portion out. | |
if [ -d $CERT_DIR ]; then | |
echo "Cert directory is good" | |
else | |
echo "Cert directory does not exist Check path." | |
echo "If your not importing certificates you can commment this portion out along with the POST DOMAIN CREATION CHECKS AND CONFIGURATION"; exit 1 | |
fi | |
echo "########################################" | |
echo "STARTING SILIENT PIA DOMAIN CREATION. LOG FILE WILL BE IN /tmp/" | |
if [ ! -d $PS_HOME/tmp ]; then | |
mkdir $PS_HOME/tmp | |
fi | |
# If there is a pre-existing silent response file we | |
# remove it | |
if [ -f $SILENT_INSTALL_FILE ]; then | |
rm -f $SILENT_INSTALL_FILE | |
fi | |
echo PS_CFG_HOME=$PS_CFG_HOME >> $SILENT_INSTALL_FILE | |
echo DOMAIN_NAME=$NEW_DOMAIN >> $SILENT_INSTALL_FILE | |
echo SERVER_TYPE=weblogic >> $SILENT_INSTALL_FILE | |
echo BEA_HOME=$BEA_HOME >> $SILENT_INSTALL_FILE | |
echo USER_ID=system >> $SILENT_INSTALL_FILE | |
echo USER_PWD=$WLPASS >> $SILENT_INSTALL_FILE | |
echo USER_PWD_RETYPE=$WLPASS >> $SILENT_INSTALL_FILE | |
echo INSTALL_ACTION=CREATE_NEW_DOMAIN >> $SILENT_INSTALL_FILE | |
echo DOMAIN_TYPE=NEW_DOMAIN >> $SILENT_INSTALL_FILE | |
echo INSTALL_TYPE=SINGLE_SERVER_INSTALLATION >> $SILENT_INSTALL_FILE | |
echo WEBSITE_NAME=$NEW_DOMAIN >> $SILENT_INSTALL_FILE | |
echo APPSERVER_NAME=$APPSERVER >> $SILENT_INSTALL_FILE | |
echo JSL_PORT=$JOLT_PORT >> $SILENT_INSTALL_FILE | |
echo HTTP_PORT=$PIA_HTTP_PORT >> $SILENT_INSTALL_FILE | |
echo HTTPS_PORT=$PIA_HTTPS_PORT >> $SILENT_INSTALL_FILE | |
echo AUTH_DOMAIN=$AUTHENTICATION_DOMAIN >> $SILENT_INSTALL_FILE | |
echo WEB_PROF_NAME=$WEB_PROFILE >> $SILENT_INSTALL_FILE | |
echo WEB_PROF_USERID=$WEB_PROFILE_USER >> $SILENT_INSTALL_FILE | |
echo WEB_PROF_PWD=$WEB_PROFILE_PWD >> $SILENT_INSTALL_FILE | |
echo WEB_PROF_PWD_RETYPE=$WEB_PROFILE_PWD >> $SILENT_INSTALL_FILE | |
echo IGW_USERID=administrator >> $SILENT_INSTALL_FILE | |
echo IGW_PWD=$IB_PWD >> $SILENT_INSTALL_FILE | |
echo IGW_PWD_RETYPE=$IB_PWD >> $SILENT_INSTALL_FILE | |
echo REPORTS_DIR=$REPORTS_DIR >> $SILENT_INSTALL_FILE | |
$PS_HOME/setup/PsMpPIAInstall/setup.sh -i silent -DRES_FILE_PATH=$SILENT_INSTALL_FILE -tempdir $PS_HOME/tmp | |
# Test for success | |
if [ -f $PS_CFG_HOME/webserv/$NEW_DOMAIN/fileRealm.properties ]; then | |
echo "" | |
echo "########################################################" | |
echo "New webserv domain $PS_CFG_HOME/webserv/$NEW_DOMAIN/fileRealm.properties exists, domain created successfully" | |
else | |
echo "" | |
echo "########################################################" | |
echo "New webserv domain $PS_CFG_HOME/webserv/$NEW_DOMAIN/fileRealm.properties does not exist, therefore domain createion failed. Check /tmp/piaInatallLog* for more detail." ; exit 1 | |
fi | |
#################POST DOMAIN CREATION CHECKS AND CONFIGURATION############ | |
#Change default java keystore pasword and import certificates into keystore | |
#For some reason the pskeymanager script shown below changes the password and then never lets you in, so we will use the java keytool directly | |
#$PS_CFG_HOME/webserv/$NEW_DOMAIN/piabin/pskeymanager.sh -changekeystorepassword -new '$IBGWKEY' -storepass 'password' | |
if type -P keytool &>/dev/null; then | |
echo "keytool found changing default keystore password" | |
#Change default java keystore pasword | |
keytool -storepasswd -v -new $IBGWKEY -keystore $PS_CFG_HOME/webserv/$NEW_DOMAIN/piaconfig/keystore/pskey -storepass 'password' | |
#Import Certificates | |
echo "" | |
echo "########################################################" | |
echo "Importing Certificates into weblogic keystore." | |
for CERT in "$CERT_DIR"/*; do | |
$PS_CFG_HOME/webserv/$NEW_DOMAIN/piabin/pskeymanager.sh -import -file $CERT -alias $CERT -trustcacerts -storepass $IBGWKEY | |
done; | |
else | |
echo "" | |
echo "#########KEYTOOL NOT FOUND. KEYSTORE NOT ALTERERD FROM DEFAULT SETTINGS############" | |
fi | |
###Add IB gatway settings to integrationGateway.properties file | |
cp $PS_CFG_HOME/webserv/$NEW_DOMAIN/applications/peoplesoft/PSIGW.war/WEB-INF/integrationGateway.properties $PS_CFG_HOME/webserv/$NEW_DOMAIN/applications/peoplesoft/PSIGW.war/WEB-INF/integrationGateway.org | |
#Replace block of lines with "lines" array | |
TOOLSVERSION=`cat "$PS_HOME/peopletools.properties" | sed -n 's/^productversion=//p'` | |
sed -i -n '1,/#NOTE: virtualServerNode is OPTIONAL/p;/# Default URL used by the ApplicationMessagingTargetConnector/,$p' $PS_CFG_HOME/webserv/$NEW_DOMAIN/applications/peoplesoft/PSIGW.war/WEB-INF/integrationGateway.properties | |
#Write lines to file | |
lines=( | |
"#ADDED BY CUSTOM SCRIPT" | |
ig.isc.serverURL=$APPSERVER:$JOLT_PORT | |
ig.isc.userid=$IBGWUSER | |
ig.isc.password=$IBGWPWD | |
ig.isc.toolsRel=$TOOLSVERSION | |
ig.isc.$IBGWLOCALNODE.serverURL=$APPSERVER:$JOLT_PORT | |
ig.isc.$IBGWLOCALNODE.userid=$IBGWUSER | |
ig.isc.$IBGWLOCALNODE.password=$IBGWPWD | |
ig.isc.$IBGWLOCALNODE.toolsRel=$TOOLSVERSION | |
) | |
echo "#######Writing lines to integrationGateway.properties file############" | |
for i in "${lines[@]}"; do | |
sed -i "s/.*# Default URL used by the ApplicationMessagingTargetConnector.*/$i\n&/" $PS_CFG_HOME/webserv/$NEW_DOMAIN/applications/peoplesoft/PSIGW.war/WEB-INF/integrationGateway.properties | |
echo $i | |
done; | |
##replace password line | |
sed -i -e 's#secureFileKeystorePasswd=.*#$IBGWKEY#g' $PS_CFG_HOME/webserv/$NEW_DOMAIN/applications/peoplesoft/PSIGW.war/WEB-INF/integrationGateway.properties | |
##POST DOMAIN CREATION INSTRUCTION### | |
echo "" | |
echo "########################################################" | |
echo "Weblogic domain creation is complete." | |
echo "Boot domain and test all IB Gateway Settings on the page PeopleTools->Integration Broker->Configuration->Gateways" | |
echo "IF YOU NEED REDUNDANT APPSERVERS CONFIGURE THE FILE..." | |
echo "$PS_CFG_HOME/webserv/$NEW_DOMAIN/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs/$NEW_DOMAIN/configuration.properties" | |
echo "manually with something like psserver=server1:9000,server2:9200{server1:9000}" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment