From: Andy Witter Date: Tue, 16 Apr 2013 11:56:19 +0000 (-0400) Subject: Move maintenance page to lvs install apache2 ssl and copy keys to lvs, change fallbac... X-Git-Tag: GenaSYS-2.3.6~50 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=74e6bbce37e49b9de1ec1dc18be1b9f93f42101f;p=contrib%2Fpines%2Fgenasys.git Move maintenance page to lvs install apache2 ssl and copy keys to lvs, change fallback to gate. Remove shared IP from internal DNS and set resolvconf on lvs server to localhost. Fixed sed password ampersand bug. Sip init scripts don't work for stopping - Fixed. Sip servers dont have their default crontabs. - Fixed. Terminate(reset) color prompt on brick heads. - Fixed. Reports nfs share on db01 and it didn't have nfs-kernel-server installed - Fixed. Add deb for version of ldirector that does not veryify ssl due to bugs in libs used by ldirector. Add syndetics support Add UMS support. Update logging config. Update to Evergreen 2.3.5 update to OpenSRF 2.1.2 Add nrpe-server to all hosts. Update support for hostname prefix support. Add support to display sip connections on sip servers. display_sip_connections.sh --- diff --git a/.gitignore b/.gitignore index 8a0d564..c7cfabd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ next.gapines.org_genasys.conf custom/ ssl_cert/ config/ +conf_files/ TODO .GenaSYS.sh-old .GenaSYS.sh.swp diff --git a/GenaSYS.sh b/GenaSYS.sh index 3252403..ca068d1 100755 --- a/GenaSYS.sh +++ b/GenaSYS.sh @@ -1,7 +1,7 @@ #!/bin/bash ############################################################################## -# Copyright (c) 2010-2012 Georgia Public Library Service." +# Copyright (c) 2010-2013 Georgia Public Library Service." # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,8 +25,8 @@ PURPOSE_="Generate config files needed for Evergreen-ILS Cluster" SYNOPSIS_="$NAME_" REQUIRES_="standard GNU commands, apt, dpkg" - VERSION_="0.98" - DATE_="2010-09-18; last update: 2012-12-17" + VERSION_="1.01" + DATE_="2010-09-18; last update: 2013-04-16" AUTHOR_="Andy Witter " URL_="http://evergreen-ils.org" CATEGORY_="devel" @@ -53,7 +53,7 @@ done WD=$(dirname $(readlink -f $0)) CUSTOMDIR="$WD/custom" -EG_VERSION="2.3.1" +EG_VERSION="2.3.5" LICENSE="$WD/License.txt" TEMPLATEDIR="$WD/templates" DEFAULT_PRIVATE_NET="10.0.1" @@ -71,6 +71,8 @@ PSQL_VERSION="9.1" [ -z $CONFIG_FILE ] && CONFIG_FILE="$WD/genasys.conf" NEW_CONFIG_FILE="$OUTDIR/genasys.conf" CERT_DIR="${OUTDIR}/ssl_cert" +MIN_CONFIG_VERSION="1" +export TERM=xterm-256color if [ -e ${TMPFOLDER} ] then @@ -101,6 +103,8 @@ COL_BR_BLUE=$ESC_SEQ"1;34m" COL_BR_MAGENTA=$ESC_SEQ"1;35m" COL_BR_CYAN=$ESC_SEQ"1;36m" +SHADE_BLUE_20="\e[48;5;20m \e[0m" + CHAR="\033%@\033(0" TEXT="\033(B" @@ -108,13 +112,53 @@ DRAW(){ echo -en "\033%@";echo -en "\033(0";} # switch to 'character' mod WRITE(){ echo -en "\033(B";} # return to normal mode from 'character' mode +BoxTitleBar () { # Display the title bar for a box with title as $@ +for SHADE in {1..21} +do + echo -en "$SHADE_BLUE_20" +done + +for COLOR in {21..16} +do + echo -en "\e[48;5;${COLOR}m \e[0m" +done + +echo -en $COL_BR_BLUE"$@"$COL_RESET + +for COLOR in {16..21} +do + echo -en "\e[48;5;${COLOR}m \e[0m" +done + +for SHADE in {1..21} +do + echo -en "$SHADE_BLUE_20" +done +} + + +TitleBar () { # Display the title bar with title as $@ +for COLOR in {16..21} +do + echo -en "\e[48;5;${COLOR}m \e[0m" +done + +echo -en $COL_BR_BLUE" $@ "$COL_RESET + +for COLOR in {21..16} +do + echo -en "\e[48;5;${COLOR}m \e[0m" +done;echo +} + + ShowLicense () { ### Display license info. clear echo -e $COL_GREEN cat .egsplash echo -e $COL_RESET echo -e $COL_BR_GREEN" GenaSYS™"$COL_RESET $COL_BR_CYAN"for Evergreen $EG_VERSION" -echo -e " Copyright © 2010-2012" +echo -e " Copyright © 2010-2013" echo -e " Georgia Public Library Service"$COL_RESET echo echo " Version: $VERSION_" @@ -139,23 +183,37 @@ done clear echo echo -echo -e ${COL_BR_BLUE}${CHAR}"laaaaaaaaaaaaaaaaaaaaaaaaq"${COL_BR_GREEN}${TEXT}"GenaSYS"${CHAR}${COL_BR_BLUE}"qaaaaaaaaaaaaaaaaaaaaaaaaak"${COL_RESET}${TEXT} -echo -e $COL_BR_BLUE"${CHAR}x${TEXT} ${CHAR}x${TEXT}" -echo -e "${CHAR}x${TEXT}$COL_RESET Georgia PINES Evergreen $EG_VERSION Cluster configuration. $COL_BR_BLUE${CHAR}x${TEXT}" -echo -e "${CHAR}x${TEXT} ${CHAR}x${TEXT}" -echo -e $COL_BR_BLUE"${CHAR}x${TEXT}$COL_RESET Welcome to GenaSYS for Evergreen $EG_VERSION $COL_BR_BLUE${CHAR}x${TEXT}" -echo -e ${CHAR}x${TEXT}"$COL_RESET This program will ask you a few questions then generate $COL_BR_BLUE${CHAR}x${TEXT}" -echo -e ${CHAR}x${TEXT}"$COL_RESET all the system config files needed for a standard $COL_BR_BLUE${CHAR}x${TEXT}" -echo -e ${CHAR}x${TEXT}"$COL_RESET distributed installation of Evergreen $EG_VERSION $COL_BR_BLUE${CHAR}x${TEXT}" -echo -e ${CHAR}x${TEXT}" ${CHAR}x${TEXT}" -echo -e ${COL_BR_BLUE}${CHAR}"maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaj"${COL_RESET}${TEXT} +#echo -e ${COL_BR_BLUE}${CHAR}"laaaaaaaaaaaaaaaaaaaaaaaaq"${COL_BR_GREEN}${TEXT}"GenaSYS"${CHAR}${COL_BR_BLUE}"qaaaaaaaaaaaaaaaaaaaaaaaaak"${COL_RESET}${TEXT} +#echo -e $COL_BR_BLUE"${CHAR}x${TEXT} ${CHAR}x${TEXT}" +#echo -e "${CHAR}x${TEXT}$COL_RESET Georgia PINES Evergreen $EG_VERSION Cluster configuration. $COL_BR_BLUE${CHAR}x${TEXT}" +#echo -e "${CHAR}x${TEXT} ${CHAR}x${TEXT}" +#echo -e $COL_BR_BLUE"${CHAR}x${TEXT}$COL_RESET Welcome to GenaSYS for Evergreen $EG_VERSION $COL_BR_BLUE${CHAR}x${TEXT}" +#echo -e ${CHAR}x${TEXT}"$COL_RESET This program will ask you a few questions then generate $COL_BR_BLUE${CHAR}x${TEXT}" +#echo -e ${CHAR}x${TEXT}"$COL_RESET all the system config files needed for a standard $COL_BR_BLUE${CHAR}x${TEXT}" +#echo -e ${CHAR}x${TEXT}"$COL_RESET distributed installation of Evergreen $EG_VERSION $COL_BR_BLUE${CHAR}x${TEXT}" +#echo -e ${CHAR}x${TEXT}" ${CHAR}x${TEXT}" +#echo -e ${COL_BR_BLUE}${CHAR}"maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaj"${COL_RESET}${TEXT} +BoxTitleBar GenaSYS +echo +echo -en "$SHADE_BLUE_20 $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 Georgia PINES Evergreen $EG_VERSION Cluster configuration. $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 Welcome to GenaSYS for Evergreen $EG_VERSION $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 This program will ask you a few questions then generate $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 all the system config files needed for a standard $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 distributed installation of Evergreen $EG_VERSION $SHADE_BLUE_20";echo +echo -en "$SHADE_BLUE_20 $SHADE_BLUE_20";echo +for SHADE in {1..61} +do + echo -en "$SHADE_BLUE_20" +done;echo echo sleep 4 echo echo "Installation Notes:" echo "===================" echo -echo -e $COL_YELLOW"Library IP based redirction:"$COL_RESET +echo -e $COL_YELLOW"Library IP based redirection:"$COL_RESET echo "If you are going be using Library based redirection then" echo -e "copy a preconfigured"$COL_BR_GREEN lib_ips.txt $COL_RESET echo -e "file to the" $COL_YELLOW "${CUSTOMDIR}" $COL_RESET folder @@ -185,8 +243,9 @@ echo "before continuing." sleep 3 Choose_Detected_Domain_Name () { ### Prompt to use detected domain name. -echo;echo;echo -echo -e $COL_BR_BLUE"________Global Configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________Global Configuration________"$COL_RESET +TitleBar "Global Configuration" echo echo -e "The domain for this cluster appears to be :"$COL_BR_YELLOW" $(hostname -d)"$COL_RESET while true; do @@ -201,7 +260,7 @@ echo } Get_Domain_Name () { ### Get the domain name for the cluster. -echo +#echo;echo;echo echo -e $COL_BR_CYAN read -p "What is the DNS domain name for this cluster? eg. gapines.org : " CLUSTERDOMAINNAME echo -e $COL_RESET @@ -211,8 +270,10 @@ echo } Get_Hostname_Prefix () { ### Get the prefix to for the hostname if there is one -echo;echo;echo -echo -e $COL_BR_BLUE"________Hostname Prefix Configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________Hostname Prefix Configuration________"$COL_RESET +TitleBar "Hostname Prefix Configuration" +echo echo "There are times when a hostname prefix is desirable for differentiating" echo "between multiple clusters. For example by default the hostname for the logger" echo "server is logger01 however in a test cluster you may want to have your hostnames" @@ -241,10 +302,9 @@ fi } Choose_SSL_Cert () { ### Prompt for CA or self signed certificate. -echo -echo -echo -echo -e $COL_BR_BLUE"_____SSL_Certificate_Configuration_____"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"_____SSL_Certificate_Configuration_____"$COL_RESET +TitleBar "SSL Certificate Configuration" echo echo "An SSL Certificate is required for Evergreen to function correctly." echo "If you have purchased a certificate from a CA then please copy " @@ -316,8 +376,9 @@ Use_CA_Cert () { ### Configure with CA Certificate } Get_Brick_Layout () { ### Prompt for brick layout. -echo;echo;echo -echo -e $COL_BR_BLUE"_____________Evergreen_Brick Configuration_____________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"_____________Evergreen Brick Configuration_____________"$COL_RESET +TitleBar "Evergreen Brick Configuration" echo echo "The standard configuration for a brick is 2 separate drone servers per head." while true; do @@ -364,8 +425,9 @@ done EG_Reporter () { ### Prompt for host that shares reporter output over NFS -echo;echo;echo -echo -e $COL_BR_BLUE"___________Evergreen Reporter Configuration___________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"___________Evergreen Reporter Configuration___________"$COL_RESET +TitleBar "Evergreen Reporter Configuration" echo echo "The reporter must be configured for this cluster." echo "First we'll configure the reporter output directory." @@ -406,8 +468,9 @@ sleep 2 Get_OSRF_Cred () { ### Prompt for OpenSRF Credentials. -echo;echo;echo -echo -e $COL_BR_BLUE"________Evergreen OpenSRF configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________Evergreen OpenSRF configuration________"$COL_RESET +TitleBar "Evergreen OpenSRF configuration" echo echo "Open Service Request Framework requires" echo "credentials configured for authentication" @@ -431,8 +494,9 @@ done } Get_DB_Cred () { ### Prompt for Database Credentials. -echo;echo;echo -echo -e $COL_BR_BLUE"________Evergreen database configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________Evergreen database configuration________"$COL_RESET +TitleBar "Evergreen database configuration" echo read -sp "Enter the database password: " DATABASE_PASSWORD while [ "$DATABASE_PASSWORD" = "" ] @@ -467,8 +531,9 @@ done } Get_EG_Admin_User () { ### Prompt for Evergreen admin username. -echo;echo;echo -echo -e $COL_BR_BLUE"________Evergreen Admin User Configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________Evergreen Admin User Configuration________"$COL_RESET +TitleBar "Evergreen Admin User Configuration" echo read -p "Enter the Evergreen Administrator Username: " EG_ADMIN_USER } @@ -545,9 +610,9 @@ unset IFS } Choose_Private_Net () { ### Default Private Network Configuration. -echo -echo -echo -e $COL_BR_BLUE"________Private network configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________Private network configuration________"$COL_RESET +TitleBar "Private network configuration" echo echo -e "The default private network is IP is" $COL_BR_YELLOW "${PRIVATENET}.0/24" $COL_RESET while true; do @@ -575,10 +640,9 @@ fi } Get_Cluster_Public_IP () { ### Get public IP for the cluster -echo -echo -echo -echo -e $COL_BR_BLUE"________LVS Director Configuration________"$COL_RESET +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________LVS Director Configuration________"$COL_RESET +TitleBar "LVS Director Configuration" echo echo "The public IP address for the cluster" echo "will be used for LVS Director and Heartbeat." @@ -623,8 +687,10 @@ echo } Get_Lvs01_Physical_Public_IP () { ### Get the public IP for the physical interface of lvs01 +echo;echo;echo;echo +#echo -e $COL_BR_BLUE"________LVS Director Configuration continued..________" +TitleBar "LVS Director Configuration continued.." echo -echo -e $COL_BR_BLUE"________LVS Director Configuration continued..________" echo -e "==== LVS Physical Ethernet Interface configuration ====" echo echo -e "The LVS servers must have a physical public addresses assigned to" @@ -658,6 +724,34 @@ echo "of lvs02.${CLUSTERDOMAINNAME}" echo } + +Get_Use_Syndetics () { ### Choose Syndetics for added content. +while true; do + echo;echo;echo;echo + #echo -e $COL_BR_BLUE"____________________Added Content____________________"$COL_RESET + TitleBar "Added Content" + echo + read -n 1 -p "Do you want to use Syndetics for added content? [y/n]: " USE_SYNDETICS + case $USE_SYNDETICS in + [Yy]* ) echo ; break;; + [Nn]* ) echo ; break;; + * ) echo " Please answer yes or no.";; + esac +done +} + +Get_Syndetics_Userid () { ### Prompt for Evergreen admin password. +echo +read -p "Enter your Syndetics user id: " SYNDETICS_USER_ID +while [ "$SYNDETICS_USER_ID" = "" ] + do + echo + echo -e $COL_BR_RED"Cannot be blank you must enter a user id"$COL_RESET + read -p "Enter your Syndetics user id: " SYNDETICS_USER_ID +done +echo +} + Confirm_Input () { ### Confirm input. Correct? [y/n] while true; do read -n 1 -p "Is this correct? [y/n] : " RETRY @@ -700,15 +794,28 @@ Run_Functions_For_Input () { ################### Run functions to get info (input) ###################### ### If config file exist then use it. -if [ -e "$CONFIG_FILE" ] ; then - . "$CONFIG_FILE" - USE_CONFIG_FILE="1" - echo - echo -e $COL_BR_BLUE"Using config file:"$COL_RESET $COL_BR_GREEN"$CONFIG_FILE"$COL_RESET - echo - sleep 3 - else - USE_CONFIG_FILE="0" +if [ -e "$CONFIG_FILE" ] +then + CONFIG_VERSION="$(cat "$CONFIG_FILE" | grep "CONFIG_VERSION" | awk -F"=" '{ print $2 }')" + if [ ! -z "$CONFIG_VERSION" ] && [ "$CONFIG_VERSION" -ge "$MIN_CONFIG_VERSION" ] + then + . "$CONFIG_FILE" + + USE_CONFIG_FILE="1" + echo + echo -e $COL_BR_BLUE"Using config file:"$COL_RESET $COL_BR_GREEN"$CONFIG_FILE"$COL_RESET + echo + sleep 3 + else + echo;echo;echo;echo + echo "*** Config version is incompatible." + echo "Running without the config switch will" + echo "create a new compatible configuration file." + USE_CONFIG_FILE="0" + read -p "Press [Enter] to start." + fi +else + USE_CONFIG_FILE="0" fi ### Prompt to use detected domain name. @@ -742,87 +849,89 @@ NEW_CONFIG_FILE="$OUTDIR/genasys.conf" CERT_DIR="${OUTDIR}/ssl_cert" # Create New config file -echo "## GenaSYS $VERSION_ Configuration" > $NEW_CONFIG_FILE +echo "CONFIG_VERSION=1" > $NEW_CONFIG_FILE +echo "## GenaSYS $VERSION_ Configuration" >> $NEW_CONFIG_FILE echo "## Created $(date)" >> $NEW_CONFIG_FILE echo >> $NEW_CONFIG_FILE Write_Config_File CLUSTERDOMAINNAME + ### Prompt to get hostname prefix if [ -z "$HOSTNAME_PREFIX" ] || [ "$USE_CONFIG_FILE" == "0" ] then - Get_Hostname_Prefix + Get_Hostname_Prefix fi Write_Config_File USE_HOSTNAME_PREFIX Write_Config_File HOSTNAME_PREFIX if [ -z $USE_CA_CERT ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Choose_SSL_Cert fi #echo "USE_CA_CERT=\"$USE_CA_CERT\"" >> $NEW_CONFIG_FILE Write_Config_File USE_CA_CERT if [ "$USE_CA_CERT" == "N" ] || [ "$USE_CA_CERT" == "n" ] - then +then Generate_SSL_Cert - else - Use_CA_Cert +else + Use_CA_Cert fi if [ -z $USE_STANDARD_HEAD_CONFIG ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Brick_Layout fi Write_Config_File USE_STANDARD_HEAD_CONFIG ### Prompt for # of drones per brick. - if [ "$USE_STANDARD_HEAD_CONFIG" = "n" ] || [ "$USE_STANDARD_HEAD_CONFIG" = "N" ] - then - if [ -z $USEDRONES ] || [ "$USE_CONFIG_FILE" == "0" ] - then - Get_Drone_Config - fi +if [ "$USE_STANDARD_HEAD_CONFIG" = "n" ] || [ "$USE_STANDARD_HEAD_CONFIG" = "N" ] +then + if [ -z $USEDRONES ] || [ "$USE_CONFIG_FILE" == "0" ] + then + Get_Drone_Config + fi - if [ "$USEDRONES" == "Y" ] || [ "$USEDRONES" == "y" ] - then - if [ -z $DRONECOUNT ] || [ "$USE_CONFIG_FILE" == "0" ] - then - Get_Drone_Count - fi - else - echo - echo "The cluster will be configured without separate drones" - DRONELESS="1" - fi + if [ "$USEDRONES" == "Y" ] || [ "$USEDRONES" == "y" ] + then + if [ -z $DRONECOUNT ] || [ "$USE_CONFIG_FILE" == "0" ] + then + Get_Drone_Count + fi + else + echo + echo "The cluster will be configured without separate drones" + DRONELESS="1" + fi - fi +fi Write_Config_File USEDRONES Write_Config_File DRONECOUNT if [ -z $BRICKCOUNT ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Brick_Count fi Write_Config_File BRICKCOUNT if [ -z $CHOSEN_REPORTS_NFS_HOSTNAME ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then EG_Reporter fi if [ "$USE_HOSTNAME_PREFIX" = "y" ] || [ "$USE_HOSTNAME_PREFIX" = "Y" ] - then +then REPORTS_NFS_HOSTNAME="${HOSTNAME_PREFIX}-${CHOSEN_REPORTS_NFS_HOSTNAME}" - else +else REPORTS_NFS_HOSTNAME="${CHOSEN_REPORTS_NFS_HOSTNAME}" fi [ -z "${CHOSEN_REPORTS_NFS_HOSTNAME}" ] && CHOSEN_REPORTS_NFS_HOSTNAME="$REPORTS_NFS_HOSTNAME" Write_Config_File CHOSEN_REPORTS_NFS_HOSTNAME if [ -z $OPENSRF_PASSWORD ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_OSRF_Cred Confirm_Password '$OPENSRF_PASSWORD' '$OPENSRF_PASSWORD_CONFIRM' Get_OSRF_Cred #while [ "$OPENSRF_PASSWORD" != "$OPENSRF_PASSWORD_CONFIRM" ] @@ -833,7 +942,7 @@ fi Write_Config_File OPENSRF_PASSWORD if [ -z $DATABASE_PASSWORD ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_DB_Cred Confirm_Password '$DATABASE_PASSWORD' '$DATABASE_PASSWORD_CONFIRM' Get_DB_Cred @@ -841,33 +950,33 @@ fi Write_Config_File DATABASE_PASSWORD if [ -z $EG_ADMIN_USER ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_EG_Admin_User fi Write_Config_File EG_ADMIN_USER if [ -z $EG_ADMIN_PASSWORD ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_EG_Admin_Password Confirm_Password '$EG_ADMIN_PASSWORD' '$EG_ADMIN_PASSWORD_CONFIRM' Get_EG_Admin_Password fi Write_Config_File EG_ADMIN_PASSWORD if [ -z $USE_STANDARD_PRIVATE_NETWORK ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Choose_Private_Net fi Write_Config_File USE_STANDARD_PRIVATE_NETWORK if [ "$USE_STANDARD_PRIVATE_NETWORK" = "n" ] || [ "$USE_STANDARD_PRIVATE_NETWORK" = "N" ] - then +then if [ "$USE_CONFIG_FILE" == "0" ] - then + then Get_Private_Net Confirm_Input Get_Private_Net fi if [ -z $PRIVATENET ] - then + then Get_Private_Net Confirm_Input Get_Private_Net fi @@ -875,40 +984,62 @@ fi Write_Config_File PRIVATENET if [ -z $CLUSTERIPADDRESS ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Cluster_Public_IP Confirm_Input Get_Cluster_Public_IP fi Write_Config_File CLUSTERIPADDRESS if [ -z $CLUSTERNETMASK ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Cluster_Public_Netmask Confirm_Input Get_Cluster_Public_Netmask fi Write_Config_File CLUSTERNETMASK if [ -z $CLUSTERGATEWAY ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Cluster_Public_Gateway Confirm_Input Get_Cluster_Public_Gateway fi Write_Config_File CLUSTERGATEWAY if [ -z $LVS01_PHYSICAL_PUBLIC_IP ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Lvs01_Physical_Public_IP Confirm_Input Get_Lvs01_Physical_Public_IP fi Write_Config_File LVS01_PHYSICAL_PUBLIC_IP if [ -z $LVS02_PHYSICAL_PUBLIC_IP ] || [ "$USE_CONFIG_FILE" == "0" ] - then +then Get_Lvs02_Physical_Public_IP Confirm_Input Get_Lvs02_Physical_Public_IP fi Write_Config_File LVS02_PHYSICAL_PUBLIC_IP +if [ -z $USE_SYNDETICS ] || [ "$USE_SYNDETICS" == "0" ] +then + Get_Use_Syndetics +fi +Write_Config_File USE_SYNDETICS + +if [[ "$USE_SYNDETICS" == "y" || "$USE_SYNDETICS" == "Y" ]] +then + if [ -z "$SYNDETICS_USER_ID" ] || [ "$SYNDETICS_USER_ID" == "0" ] + then + Get_Syndetics_Userid + fi +fi +Write_Config_File SYNDETICS_USER_ID + +#if [ -z $SYNDETICS_USER_ID ] || [ "$SYNDETICS_USER_ID" == "0" ] +# then +# Get_Syndetics_Userid +#fi +#Write_Config_File SYNDETICS_USER_ID + + # The new config file contains sensitive information. chmod 600 $NEW_CONFIG_FILE @@ -919,7 +1050,7 @@ echo;echo -e $COL_RESET } Run_Functions_For_Input if [ "$USE_CONFIG_FILE" == "0" ] - then +then Confirm_Input_Continue Run_Functions_For_Input fi @@ -1011,35 +1142,55 @@ BACKUP01_IP="${PRIVATENET}.171" MONITOR01_IP="${PRIVATENET}.201" ADMIN01_IP="${PRIVATENET}.211" +MASTER_DB="$(echo $MACHINES_DB_ONLY | awk '{ print $1 }')" -cp -f "$TEMPLATEDIR/ntp.conf" /tmp -cp -f "$TEMPLATEDIR/resolv.conf" /tmp -sed -i "s^CLUSTER_DOMAIN_NAME^$CLUSTERDOMAINNAME^g" "/tmp/resolv.conf" +cp -f "$TEMPLATEDIR/ntp.conf" $TMPFOLDER +cp -f "$TEMPLATEDIR/resolv.conf" $TMPFOLDER +sed -i "s^CLUSTER_DOMAIN_NAME^$CLUSTERDOMAINNAME^g" "$TMPFOLDER/resolv.conf" ### Begin setup exports -[ -e /tmp/exports ] && rm -f /tmp/exports -[ -e /tmp/exports_reporter ] && rm -f /tmp/exports_reporter -[ -e /tmp/exports_backup ] && rm -f /tmp/exports_backup +[ -e $TMPFOLDER/exports ] && rm -f $TMPFOLDER/exports +[ -e $TMPFOLDER/exports_reporter ] && rm -f $TMPFOLDER/exports_reporter +[ -e $TMPFOLDER/exports_backup ] && rm -f $TMPFOLDER/exports_backup ### Begin lvs setup. -LVSCONFIGFILE="/tmp/ldirectord.cf" +LVSCONFIGFILE="$TMPFOLDER/ldirectord.cf" echo "virtual=${CLUSTERIPADDRESS}:80" > "$LVSCONFIGFILE" + +## Configure ha.cf file. +cp -f "$TEMPLATEDIR/lvs/ha.cf" "$TMPFOLDER/ha.cf" +cp -f "$TEMPLATEDIR/lvs/haresources" "$TMPFOLDER/haresources" +for LVS_NODE in $MACHINES_LVS_ONLY +do + if echo $LVS_NODE | grep -q lvs01 + then + sed -i "s^FIRST_LVS_SERVER^$LVS_NODE^g" "$TMPFOLDER/ha.cf" + sed -i "s^FIRST_LVS^$LVS_NODE^g" "$TMPFOLDER/haresources" + fi + if echo $LVS_NODE | grep -q lvs02 + then + sed -i "s^SECOND_LVS_SERVER^$LVS_NODE^g" "$TMPFOLDER/ha.cf" + fi +done + for LVS in $MACHINES_LVS_ONLY do LVSDIR="$LVS/etc/ha.d" mkdir -p "$OUTDIR/$LVSDIR" mkdir -p "$OUTDIR/$LVS/etc/network" mkdir -p "$OUTDIR/$LVS/etc/postfix" - cp -f "$TEMPLATEDIR/lvs/ha.cf" "$OUTDIR/$LVSDIR" - cp -f "$TEMPLATEDIR/lvs/haresources" "$OUTDIR/$LVSDIR" + cp -f "$TMPFOLDER/ha.cf" "$OUTDIR/$LVSDIR" + cp -f "$TMPFOLDER/haresources" "$OUTDIR/$LVSDIR" cp -f "$TEMPLATEDIR/lvs/authkeys" "$OUTDIR/$LVSDIR" cp -f "$TEMPLATEDIR/lvs/iptables-rules.fw" "$OUTDIR/$LVS/etc/network" cp -f "$TEMPLATEDIR/lvs/rc.local" "$OUTDIR/$LVS/etc" cp -f "$TEMPLATEDIR/lvs/ntp.conf" "$OUTDIR/$LVS/etc" cp -f "$TEMPLATEDIR/lvs/resolv.conf" "$OUTDIR/$LVS/etc" cp -f "$TEMPLATEDIR/lvs/main.cf" "$OUTDIR/$LVS/etc/postfix" - sed -i "s^CLUSTER_DOMAIN_NAME^$CLUSTERDOMAINNAME^g" "$OUTDIR/$LVS/etc/resolv.conf" + + + sed -i "s^CLUSTER_DOMAIN_NAME^$CLUSTERDOMAINNAME^g" "$OUTDIR/$LVS/etc/resolv.conf" if [ -n "$HOSTNAME_PREFIX" ]; then #sed -i "s^\(myhostname = \)\([A-Za-z0-9-]*\.ClusterDomainName\)^\1$HOSTNAME_PREFIX-\2^g" "$OUTDIR/$LVS/etc/postfix/main.cf" #sed -i "s^\(mydestination = \)\([A-Za-z0-9-]*\.ClusterDomainName\)^\1$HOSTNAME_PREFIX-\2^g" "$OUTDIR/$LVS/etc/postfix/main.cf" @@ -1055,27 +1206,48 @@ for LVS in $MACHINES_LVS_ONLY sed -i "s^ClusterPublic_Bcast^${PUB_BCAST}^g" "$OUTDIR/$LVS/etc/ha.d/haresources" sed -i "s^Lvs01Private_Shared_IP^${LVS01_PRIVATE_SHARED_IP}^g" "$OUTDIR/$LVS/etc/ha.d/haresources" sed -i "s^lvs01Private_Net^${PRIVATENET}^g" "$OUTDIR/$LVS/etc/ha.d/haresources" + + ### Configure the maintenance page on LVS servers + if $(ls $CUSTOMDIR |grep -q "index.html") + then + echo;echo "Using custom maintenance page..." + mkdir -p "$OUTDIR/$LVS/var/www" + MAINT_PAGE_INDEX="$CUSTOMDIR/index.html" + CUSTOM_MAINT_PAGE_INDEX="y" + elif $(ls $CUSTOMDIR |grep -q "index.php") + then + MAINT_PAGE_INDEX="$CUSTOMDIR/index.php" + CUSTOM_MAINT_PAGE_INDEX="y" + else + MAINT_PAGE_INDEX="$TEMPLATEDIR/SIP/index.html" + fi + CUSTOM_MAINT_PAGE_INDEX="y" && cp -f $CUSTOMDIR/*.jpg $CUSTOMDIR/*.png "$OUTDIR/$LVS/var/www/" >/dev/null 2>&1 + cp -f $TEMPLATEDIR/SIP/index.html "$OUTDIR/$LVS/var/www" + ### configure apache2 ssl for maint. page. + mkdir -p "$OUTDIR/$LVS/etc/apache2/ssl" && cp -f "${CERT_DIR}/server.key" "$OUTDIR/$LVS/etc/apache2/ssl" + [ -e "${CERT_DIR}/ca.crt" ] && cp -f "${CERT_DIR}/ca.crt" "$OUTDIR/$LVS/etc/apache2/ssl" + cp -f "${CERT_DIR}/server.crt" "$OUTDIR/$LVS/etc/apache2/ssl" done ### Start hosts and DNS zone file configuration. if [ "$USE_HOSTNAME_PREFIX" = "y" ] || [ "$USE_HOSTNAME_PREFIX" = "Y" ] then - cp $TEMPLATEDIR/hosts-footer-prefixed /tmp/hosts-footer - cp "$TEMPLATEDIR/lvs/bind/zonefile-footer-prefixed" /tmp/zonefile-footer - cp "$TEMPLATEDIR/lvs/bind/revzonefile-footer-prefixed" /tmp/revzonefile-footer - sed -i "s^PREFIX^$HOSTNAME_PREFIX^g" /tmp/hosts-footer - sed -i "s^PREFIX^$HOSTNAME_PREFIX^g" /tmp/zonefile-footer - sed -i "s^PREFIX^$HOSTNAME_PREFIX^g" /tmp/revzonefile-footer + cp $TEMPLATEDIR/hosts-footer-prefixed $TMPFOLDER/hosts-footer + cp "$TEMPLATEDIR/lvs/bind/zonefile-footer-prefixed" $TMPFOLDER/zonefile-footer + cp "$TEMPLATEDIR/lvs/bind/revzonefile-footer-prefixed" $TMPFOLDER/revzonefile-footer + sed -i "s^PREFIX^$HOSTNAME_PREFIX^g" $TMPFOLDER/hosts-footer + sed -i "s^PREFIX^$HOSTNAME_PREFIX^g" $TMPFOLDER/zonefile-footer + sed -i "s^PREFIX^$HOSTNAME_PREFIX^g" $TMPFOLDER/revzonefile-footer else - cp $TEMPLATEDIR/hosts-footer /tmp - cp "$TEMPLATEDIR/lvs/bind/zonefile-footer" /tmp - cp "$TEMPLATEDIR/lvs/bind/revzonefile-footer" /tmp + cp $TEMPLATEDIR/hosts-footer $TMPFOLDER + cp "$TEMPLATEDIR/lvs/bind/zonefile-footer" $TMPFOLDER + cp "$TEMPLATEDIR/lvs/bind/revzonefile-footer" $TMPFOLDER fi -sed -i "s^Priv_NET^${PRIVATENET}^g" /tmp/hosts-footer -sed -i "s^ClusterDomainName^${CLUSTERDOMAINNAME}^g" /tmp/hosts-footer -sed -i "s^Priv_NET^${PRIVATENET}^g" /tmp/zonefile-footer -sed -i "s^domain.org^${CLUSTERDOMAINNAME}^g" /tmp/revzonefile-footer +sed -i "s^Priv_NET^${PRIVATENET}^g" $TMPFOLDER/hosts-footer +sed -i "s^ClusterDomainName^${CLUSTERDOMAINNAME}^g" $TMPFOLDER/hosts-footer +sed -i "s^Priv_NET^${PRIVATENET}^g" $TMPFOLDER/zonefile-footer +sed -i "s^domain.org^${CLUSTERDOMAINNAME}^g" $TMPFOLDER/revzonefile-footer ### Start reports output configuration. echo @@ -1097,16 +1269,16 @@ fi if [ ! -z "$REPORTS_NFS_HOSTNAME" ] then - if ! grep -q "$REPORTS_NFS_HOSTNAME" /tmp/hosts-footer + if ! grep -q "$REPORTS_NFS_HOSTNAME" $TMPFOLDER/hosts-footer then ADD_REPORTS_SHARE="1" REPORTS_NFS_HOSTNAME_IP="${PRIVATENET}.161" #sed -i "9a\\${PRIVATENET}.161\t${REPORTS_NFS_HOSTNAME}.${CLUSTERDOMAINNAME} ${REPORTS_NFS_HOSTNAME}" /tmp/hosts-footer - sed -i "/.171/i\\${PRIVATENET}.161\t${REPORTS_NFS_HOSTNAME}.${CLUSTERDOMAINNAME}\t${REPORTS_NFS_HOSTNAME}" /tmp/hosts-footer + sed -i "/.171/i\\${PRIVATENET}.161\t${REPORTS_NFS_HOSTNAME}.${CLUSTERDOMAINNAME}\t${REPORTS_NFS_HOSTNAME}" $TMPFOLDER/hosts-footer #sed -i "17a\\${REPORTS_NFS_HOSTNAME}\tA\t${PRIVATENET}.161" /tmp/zonefile-footer - sed -i "/.171/i\\${REPORTS_NFS_HOSTNAME}\tA\t${PRIVATENET}.161" /tmp/zonefile-footer + sed -i "/.171/i\\${REPORTS_NFS_HOSTNAME}\tA\t${PRIVATENET}.161" $TMPFOLDER/zonefile-footer #sed -i "15a\\161\tIN\tPTR\t${REPORTS_NFS_HOSTNAME}.${CLUSTERDOMAINNAME}." /tmp/revzonefile-footer - sed -i "/171/i\161\tIN\tPTR\t${REPORTS_NFS_HOSTNAME}.${CLUSTERDOMAINNAME}." /tmp/revzonefile-footer + sed -i "/171/i\161\tIN\tPTR\t${REPORTS_NFS_HOSTNAME}.${CLUSTERDOMAINNAME}." $TMPFOLDER/revzonefile-footer fi fi @@ -1119,19 +1291,23 @@ echo End Reports Output Confiugration. ### Set LVS IP for ntp. -sed -i "s^Cluster_Priv_IP^$LVS01_PRIVATE_SHARED_IP^g" "/tmp/ntp.conf" -sed -i "s^LVS01_Priv_IP^$LVS01_PRIVATE_IP^g" "/tmp/ntp.conf" -sed -i "s^LVS02_Priv_IP^$LVS02_PRIVATE_IP^g" "/tmp/ntp.conf" +sed -i "s^Cluster_Priv_IP^$LVS01_PRIVATE_SHARED_IP^g" "$TMPFOLDER/ntp.conf" +sed -i "s^LVS01_Priv_IP^$LVS01_PRIVATE_IP^g" "$TMPFOLDER/ntp.conf" +sed -i "s^LVS02_Priv_IP^$LVS02_PRIVATE_IP^g" "$TMPFOLDER/ntp.conf" ### Set DNS Server ip in resolv.conf. -sed -i "s^Cluster_Priv_IP^$LVS01_PRIVATE_SHARED_IP^g" "/tmp/resolv.conf" -sed -i "s^LVS01_Priv_IP^$LVS01_PRIVATE_IP^g" "/tmp/resolv.conf" -sed -i "s^LVS02_Priv_IP^$LVS02_PRIVATE_IP^g" "/tmp/resolv.conf" +sed -i "s^Cluster_Priv_IP^$LVS01_PRIVATE_SHARED_IP^g" "$TMPFOLDER/resolv.conf" +sed -i "s^LVS01_Priv_IP^$LVS01_PRIVATE_IP^g" "$TMPFOLDER/resolv.conf" +sed -i "s^LVS02_Priv_IP^$LVS02_PRIVATE_IP^g" "$TMPFOLDER/resolv.conf" ### Start Logger setup. -cp $TEMPLATEDIR/rsyslog.conf /tmp -sed -i "s^ClusterDomainName^$CLUSTERDOMAINNAME^g" /tmp/rsyslog.conf - +if grep -q 'Debian GNU/Linux 6' /etc/issue +then + OSDISTRO="Debian6" +fi +cp $TEMPLATEDIR/rsyslog/60-evergreen-ils.conf $TMPFOLDER/60-evergreen-ils.conf +sed -i "s^CLUSTER_DOMAINNAME^$CLUSTERDOMAINNAME^g" $TMPFOLDER/60-evergreen-ils.conf +sed -i "s^LoggerHostName^${MACHINES_LOGGER}^g" $TMPFOLDER/60-evergreen-ils.conf ### Split domain name. CLUSTER_DOMAIN_PREFIX="$(echo $CLUSTERDOMAINNAME |awk -F"." 'sub(FS $NF,x)')" @@ -1184,7 +1360,8 @@ NETCFGFILE="$OUTDIR/${CLUSTERDOMAINNAME}_network_config.txt" ## begin preparation of opensrf.xml cp $TEMPLATEDIR/opensrf.xml/opensrf.xml-header $TMPOPENSRF_XML -sed -i "s^DatabasePassword^$DATABASE_PASSWORD^g" $TMPOPENSRF_XML +#sed -i "s^DatabasePassword^$DATABASE_PASSWORD^g" $TMPOPENSRF_XML +sed -i "s^DatabasePassword^$(echo $DATABASE_PASSWORD | sed -e 's^&^\\\&^g' -e 's/\^/\\\^/g')^g" $TMPOPENSRF_XML # the below line appears to not be doing anything # sed -i "s^DatabaseHostName^db01^g" $TMPOPENSRF_XML if [ -n "$HOSTNAME_PREFIX" ]; then @@ -1199,6 +1376,14 @@ if [ -e "${CUSTOMDIR}/zips.txt" ] sed -i 's^-->^^g' $TMPOPENSRF_XML fi +if [ "$USE_SYNDETICS" == "y" ]|| [ "$USE_SYNDETICS" == "Y" ] + then + sed -i 's^::OpenLibrary^::Syndetic^g' $TMPOPENSRF_XML + sed -i 's^OpenLibrary added content^Syndetics added content^g' $TMPOPENSRF_XML + sed -i "s^MODULE_USER_ID^$SYNDETICS_USER_ID^g" $TMPOPENSRF_XML + sed -i 's^^http://syndetics.com/index.aspx^g' $TMPOPENSRF_XML +fi + ### Set the hostnames and IPs of heads and drones. ### And create the configuration files as needed. @@ -1223,6 +1408,7 @@ for BRICK in $(seq $BRICKCOUNT) eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/network + eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/rsyslog.d eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-available eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-enabled eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/ssl @@ -1240,10 +1426,11 @@ for BRICK in $(seq $BRICKCOUNT) eval sed -i "s^UTILITY01_IP^$UTILITY01_IP^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/eg_fstab_head eval sed -i "s^REPORTER_OUTPUT_NFS_HOST_IP^$REPORTS_NFS_HOSTNAME_IP^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/eg_fstab_head eval sed -i "s^Brick_head_Fqdn^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD).$CLUSTERDOMAINNAME^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml - eval sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml - cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-full /tmp/opensrf.xml-head - eval sed -i "s^NODE_HOST_NAME^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)^g" /tmp/opensrf.xml-head - cat /tmp/opensrf.xml-head >> $TMPOPENSRF_XML + #eval sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml + sed -i "s^OpenSRF_Password^$(echo $OPENSRF_PASSWORD | sed -e 's^&^\\\&^g' -e 's/\^/\\\^/g')^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml + cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-full $TMPFOLDER/opensrf.xml-head + eval sed -i "s^NODE_HOST_NAME^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)^g" $TMPFOLDER/opensrf.xml-head + cat $TMPFOLDER/opensrf.xml-head >> $TMPOPENSRF_XML eval cp -f $TEMPLATEDIR/oils_web.xml ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf eval cp -f $TEMPLATEDIR/oils_brick.cfg-header ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf/.oils_brick.cfg @@ -1256,8 +1443,8 @@ for BRICK in $(seq $BRICKCOUNT) eval cd ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-enabled && ln -s ../sites-available/eg.conf . && \ cd $WD eval cp -f $TEMPLATEDIR/interfaces ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/network - eval cp -f /tmp/ntp.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ - eval cp -f /tmp/resolv.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ + eval cp -f $TMPFOLDER/ntp.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ + eval cp -f $TMPFOLDER/resolv.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ sed -i "s^# OSRFTranslatorCacheServer 127.0.0.1:11211^OSRFTranslatorCacheServer $MEMCACHE01_IP:11211^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf sed -i "s^_CLUSTER_DOMAIN_PREFIX^$CLUSTER_DOMAIN_PREFIX^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf sed -i "s^_CLUSTER_TLD^$CLUSTER_TLD^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf @@ -1281,7 +1468,10 @@ for BRICK in $(seq $BRICKCOUNT) eval sed -i "s^Brick01_Head_IP^$BRICK01_HEAD_IP^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh eval sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh eval cp -f $TEMPLATEDIR/apt/head_apt.list ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/\$BRICKHOSTNAME${BRICK}-head_apt.list - eval cp -f /tmp/rsyslog.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ + eval cp -f $TMPFOLDER/60-evergreen-ils.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/rsyslog.d + eval cp -f $TEMPLATEDIR/rsyslog/50-default.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/rsyslog.d + #eval sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/60-evergreen-ils.conf + eval echo "\$BRICKHOSTNAME${BRICK}-head" > ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hostname eval echo "\$BRICKHOSTNAME${BRICK}-head" >> $TMPOSRFNODES eval echo "\$BRICKHOSTNAME${BRICK}_HEAD_IP \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME} public.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME} private.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME} \$BRICKHOSTNAME${BRICK}-head" >> $TMPHOSTS @@ -1291,16 +1481,19 @@ for BRICK in $(seq $BRICKCOUNT) eval printf "${BRICK}0\\\tIN\\\tPTR\\\t\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}.\\\n" >> $TMPREVZONEFILE eval printf "${BRICK}0\\\tIN\\\tPTR\\\tpublic.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}.\\\n" >> $TMPREVZONEFILE eval printf "${BRICK}0\\\tIN\\\tPTR\\\tprivate.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}.\\\n" >> $TMPREVZONEFILE - eval echo "/openils/var/data/offline \$BRICKHOSTNAME${BRICK}_HEAD_IP\(rw,sync,no_subtree_check\)" >> /tmp/exports - eval echo "/storage/reports-output \$BRICKHOSTNAME${BRICK}_HEAD_IP\(ro,sync,no_subtree_check\)" >> /tmp/exports_reporter + eval echo "/openils/var/data/offline \$BRICKHOSTNAME${BRICK}_HEAD_IP\(rw,sync,no_subtree_check\)" >> $TMPFOLDER/exports + eval echo "/storage/reports-output \$BRICKHOSTNAME${BRICK}_HEAD_IP\(ro,sync,no_subtree_check\)" >> $TMPFOLDER/exports_reporter printf ")\n" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg sed -i 's^ )^)^g' ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg eval cat $TEMPLATEDIR/oils_brick.cfg-footer >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg + BRICK_HEAD_LIST="$BRICK_HEAD_LIST$(eval printf "\$BRICKHOSTNAME${BRICK}-head\ ")" done +echo $BRICK_HEAD_LIST + ### Setup hosts file for bricks. -cat /tmp/hosts-footer >> "$TMPHOSTS" +cat $TMPFOLDER/hosts-footer >> "$TMPHOSTS" sed -i "s^sampledomain.org^$CLUSTERDOMAINNAME^g" "$TMPHOSTS" # sed -i "s^Pub_IP^$CLUSTERIPADDRESS^g" "$TMPHOSTS" for BRICK in $(seq $BRICKCOUNT) @@ -1332,6 +1525,7 @@ for BRICK in $(seq $BRICKCOUNT) eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/network + eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/rsyslog.d eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-available eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-enabled eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/ssl @@ -1348,10 +1542,11 @@ for BRICK in $(seq $BRICKCOUNT) eval sed -i "s^REPORTER_OUTPUT_NFS_HOST_IP^$REPORTS_NFS_HOSTNAME_IP^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/eg_fstab_head eval cp -f $TEMPLATEDIR/opensrf_core.xml ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf eval sed -i "s^Brick_head_Fqdn^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD).$CLUSTERDOMAINNAME^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml - eval sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml - cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-head /tmp/opensrf.xml-head - eval sed -i "s^NODE_HOST_NAME^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)^g" /tmp/opensrf.xml-head - cat /tmp/opensrf.xml-head >> $TMPOPENSRF_XML + #eval sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml + sed -i "s^OpenSRF_Password^$(echo $OPENSRF_PASSWORD | sed -e 's^&^\\\&^g' -e 's/\^/\\\^/g')^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/opensrf_core.xml + cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-head $TMPFOLDER/opensrf.xml-head + eval sed -i "s^NODE_HOST_NAME^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)^g" $TMPFOLDER/opensrf.xml-head + cat $TMPFOLDER/opensrf.xml-head >> $TMPOPENSRF_XML #;eval cp -f $TEMPLATEDIR/opensrf.xml ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf eval cp -f $TEMPLATEDIR/oils_web.xml ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf @@ -1365,8 +1560,8 @@ for BRICK in $(seq $BRICKCOUNT) eval cd ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-enabled && ln -s ../sites-available/eg.conf . && \ cd $WD eval cp -f $TEMPLATEDIR/interfaces ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/network - eval cp -f /tmp/ntp.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ - eval cp -f /tmp/resolv.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ + eval cp -f $TMPFOLDER/ntp.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ + eval cp -f $TMPFOLDER/resolv.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ sed -i "s^# OSRFTranslatorCacheServer 127.0.0.1:11211^OSRFTranslatorCacheServer $MEMCACHE01_IP:11211^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf sed -i "s^_CLUSTER_DOMAIN_PREFIX^$CLUSTER_DOMAIN_PREFIX^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf sed -i "s^_CLUSTER_TLD^$CLUSTER_TLD^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf @@ -1378,8 +1573,8 @@ for BRICK in $(seq $BRICKCOUNT) eval sed -i "s^Cluster_Private_IP^$LVS01_PRIVATE_SHARED_IP^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/network/interfaces eval sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/network/interfaces eval cp -f $TEMPLATEDIR/exports ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ - eval echo "/openils/var/data/offline \$BRICKHOSTNAME${BRICK}_HEAD_IP\(rw,sync,no_subtree_check\)" >> /tmp/exports - eval echo "/storage/reports-output \$BRICKHOSTNAME${BRICK}_HEAD_IP\(ro,sync,no_subtree_check\)" >> /tmp/exports_reporter + eval echo "/openils/var/data/offline \$BRICKHOSTNAME${BRICK}_HEAD_IP\(rw,sync,no_subtree_check\)" >> $TMPFOLDER/exports + eval echo "/storage/reports-output \$BRICKHOSTNAME${BRICK}_HEAD_IP\(ro,sync,no_subtree_check\)" >> $TMPFOLDER/exports_reporter # eval cp -f $TEMPLATEDIR/init/eg_opensrf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/init.d/opensrf eval cp -f $TEMPLATEDIR/setup-head.sh ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head eval cp -f $TEMPLATEDIR/setup-vars ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-vars @@ -1391,7 +1586,9 @@ for BRICK in $(seq $BRICKCOUNT) eval sed -i "s^Brick01_Head_IP^$BRICK01_HEAD_IP^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh eval sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh eval cp -f $TEMPLATEDIR/apt/head_apt.list ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/\$BRICKHOSTNAME${BRICK}-head_apt.list - eval cp -f /tmp/rsyslog.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ + eval cp -f $TMPFOLDER/60-evergreen-ils.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/rsyslog.d + eval cp -f $TEMPLATEDIR/rsyslog/50-default.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/rsyslog.d + #eval cp -f /tmp/rsyslog.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/ eval echo "\$BRICKHOSTNAME${BRICK}-head" > ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hostname eval echo "\$BRICKHOSTNAME${BRICK}-head" >> $TMPOSRFNODES eval echo "\$BRICKHOSTNAME${BRICK}_HEAD_IP \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME} public.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME} private.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME} \$BRICKHOSTNAME${BRICK}-head" >> $TMPHOSTS @@ -1401,6 +1598,8 @@ for BRICK in $(seq $BRICKCOUNT) eval printf "${BRICK}0\\\tIN\\\tPTR\\\t\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}.\\\n" >> $TMPREVZONEFILE eval printf "${BRICK}0\\\tIN\\\tPTR\\\tpublic.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}.\\\n" >> $TMPREVZONEFILE eval printf "${BRICK}0\\\tIN\\\tPTR\\\tprivate.\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}.\\\n" >> $TMPREVZONEFILE + BRICK_HEAD_LIST="$BRICK_HEAD_LIST $(eval printf "\$BRICKHOSTNAME${BRICK}-head\ ")" + echo $BRICK_HEAD_LIST for DRONE in $(seq $DRONECOUNT) do typeset TMPBRICKDRONES="$(eval echo \$BRICKHOSTNAME${BRICK}-head)_drones.txt" @@ -1419,22 +1618,26 @@ for BRICK in $(seq $BRICKCOUNT) eval mkdir -p "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/openils/conf" eval mkdir -p "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" eval mkdir -p "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/network" + eval mkdir -p "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/rsyslog.d" eval mkdir -p "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/init.d" eval mkdir -p "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/var/run/evergreen" eval cp -f $TEMPLATEDIR/opensrf_core.xml "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/openils/conf" eval sed -i "s^Brick_head_Fqdn^$(eval echo \$BRICKHOSTNAME${BRICK}-drone0${DRONE}).$CLUSTERDOMAINNAME^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/openils/conf/opensrf_core.xml" - eval sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/openils/conf/opensrf_core.xml" + #eval sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/openils/conf/opensrf_core.xml" + sed -i "s^OpenSRF_Password^$(echo $OPENSRF_PASSWORD | sed -e 's^&^\\\&^g' -e 's/\^/\\\^/g')^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/openils/conf/opensrf_core.xml" ### drone gets fstab eval cp -f $TEMPLATEDIR/interfaces "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/network" - eval cp -f /tmp/ntp.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" - eval cp -f /tmp/resolv.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" + eval cp -f $TMPFOLDER/ntp.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" + eval cp -f $TMPFOLDER/resolv.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" eval cp -f $TEMPLATEDIR/eg_fstab_drone "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" #eval cp -f $TEMPLATEDIR/init/eg_opensrf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/init.d/opensrf" eval cp -f $TEMPLATEDIR/setup-drone.sh "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}" eval cp -f $TEMPLATEDIR/setup-vars "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/setup-vars" eval cp -f "$TEMPLATEDIR/setup-functions" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/setup-functions" eval cp -f $TEMPLATEDIR/apt/drone_apt.list "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}_apt.list" - eval cp -f /tmp/rsyslog.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" + eval cp -f $TMPFOLDER/60-evergreen-ils.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/rsyslog.d" + eval cp -f $TEMPLATEDIR/rsyslog/50-default.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/rsyslog.d" + #eval cp -f /tmp/rsyslog.conf "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc" eval sed -i "s^drone_file^$(eval echo \$BRICKHOSTNAME${BRICK}-drone0${DRONE})^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/setup-drone.sh" eval sed -i "s^_EGVER^${EG_VERSION}^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/setup-drone.sh" eval sed -i "s^_GENVER^${VERSION_}^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/setup-vars" @@ -1453,14 +1656,14 @@ for BRICK in $(seq $BRICKCOUNT) printf '\"' >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg eval printf \"\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP\" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg printf '\" ' >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg - eval echo "/openils/var/data/offline \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP\(rw,sync,no_subtree_check\)" >> /tmp/exports + eval echo "/openils/var/data/offline \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP\(rw,sync,no_subtree_check\)" >> $TMPFOLDER/exports eval echo "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}" > ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK}-drone0${DRONE})/etc/hostname eval echo "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/$TMPBRICKDRONES eval echo "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}" >> $TMPOSRFNODES - cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-drone /tmp/opensrf.xml-drone - eval sed -i "s^NODE_HOST_NAME^$(eval echo \$BRICKHOSTNAME${BRICK}_DRONE${DRONE})^g" /tmp/opensrf.xml-drone - cat /tmp/opensrf.xml-drone >> $TMPOPENSRF_XML + cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-drone $TMPFOLDER/opensrf.xml-drone + eval sed -i "s^NODE_HOST_NAME^$(eval echo \$BRICKHOSTNAME${BRICK}_DRONE${DRONE})^g" $TMPFOLDER/opensrf.xml-drone + cat $TMPFOLDER/opensrf.xml-drone >> $TMPOPENSRF_XML ### eval echo "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}" >> $TMPBRICKDRONES eval echo -e "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}.${CLUSTERDOMAINNAME} \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}" \ >> $TMPHOSTS @@ -1475,7 +1678,7 @@ for BRICK in $(seq $BRICKCOUNT) done ### Setup hosts file for bricks. -cat /tmp/hosts-footer >> "$TMPHOSTS" +cat $TMPFOLDER/hosts-footer >> "$TMPHOSTS" sed -i "s^sampledomain.org^$CLUSTERDOMAINNAME^g" "$TMPHOSTS" sed -i "s^Pub_IP^$CLUSTERIPADDRESS^g" "$TMPHOSTS" for BRICK in $(seq $BRICKCOUNT) @@ -1496,6 +1699,8 @@ for BRICK in $(seq $BRICKCOUNT) done } + + ### Run fuctions to create bricks. if [ "$DRONELESS" == "1" ] then @@ -1512,9 +1717,11 @@ if [ "$DRONELESS" == "1" ] echo "done!" fi +BRICKHEADLIST="$(echo "$BRICK_HEAD_LIST" | sed -e 's/^ *//g' -e 's/ *$//g')" + ### Complete DNS zonefile configuration -cat /tmp/zonefile-footer >> "$TMPZONEFILE" -cat /tmp/revzonefile-footer >> "$TMPREVZONEFILE" +cat $TMPFOLDER/zonefile-footer >> "$TMPZONEFILE" +cat $TMPFOLDER/revzonefile-footer >> "$TMPREVZONEFILE" sed -i "s^domain.org^$CLUSTERDOMAINNAME^g" "$TMPZONEFILE" sed -i "s^domain.org^$CLUSTERDOMAINNAME^g" "$TMPREVZONEFILE" sed -i "s^Priv_NET^$PRIVATENET^g" "$TMPZONEFILE" @@ -1525,9 +1732,10 @@ sed -i "s^Priv_NET^$PRIVATENET^g" "$TMPZONEFILE" ### if it is not the one exporting reports output ### to the network. (heads) -if [ "${REPORTS_NFS_HOSTNAME}" != "reporter01" ] +if ! echo "${REPORTS_NFS_HOSTNAME}" | grep -q reporter01 then - echo "/storage/reports-output ${REPORTER01_IP}(rw,sync,no_subtree_check)" >> /tmp/exports_reporter + echo "/storage/reports-output ${REPORTER01_IP}(rw,sync,no_subtree_check)" >> $TMPFOLDER/exports_reporter + REPORTER_IS_HOST="NO" fi @@ -1538,11 +1746,11 @@ sed -i "s^ClusterDomainName^$CLUSTERDOMAINNAME^g" $TMPOPENSRF_XML ### Continue LVS config. cat "$TEMPLATEDIR/lvs/ldirectord.cf-footer" >> "$LVSCONFIGFILE" -cp -f "$LVSCONFIGFILE" /tmp/ldirectord.conf -sed -i "s^:80^:443^g" /tmp/ldirectord.conf -sed -i "s^http^https^" /tmp/ldirectord.conf +cp -f "$LVSCONFIGFILE" $TMPFOLDER/ldirectord.conf +sed -i "s^:80^:443^g" $TMPFOLDER/ldirectord.conf +sed -i "s^http^https^" $TMPFOLDER/ldirectord.conf echo >> "$LVSCONFIGFILE" -cat /tmp/ldirectord.conf >> "$LVSCONFIGFILE" +cat $TMPFOLDER/ldirectord.conf >> "$LVSCONFIGFILE" sed -i "s^Priv_NET^$PRIVATENET^g" "$LVSCONFIGFILE" ### Complete LVS Director config. @@ -1565,15 +1773,17 @@ for LVS_SERVER in $MACHINES_LVS_ONLY done ### setup named.conf for bind DNS server on LVS servers +echo +echo "Setting up DNS Services..." NUM=0 for LVS_SERVERS in $MACHINES_LVS_ONLY do ((NUM++)) - if ! echo "$LVS_SERVERS" | grep "lvs01" - then + if ! echo "$LVS_SERVERS" | grep -q "lvs01" + then cp -f "$TEMPLATEDIR/lvs/bind/named.conf.local-slave" "$OUTDIR/$LVS_SERVERS/etc/bind/named.conf.local" sed -i "s^_LVS01_PRIVATE_IP^$LVS01_PRIVATE_IP^g" "$OUTDIR/$LVS_SERVERS/etc/bind/named.conf.local" - else + else cp -f "$TEMPLATEDIR/lvs/bind/named.conf.local-master" "$OUTDIR/$LVS_SERVERS/etc/bind/named.conf.local" sed -i "s^_LVS02_PRIVATE_IP^$LVS02_PRIVATE_IP^g" "$OUTDIR/$LVS_SERVERS/etc/bind/named.conf.local" fi @@ -1583,7 +1793,7 @@ for LVS_SERVERS in $MACHINES_LVS_ONLY sed -i "s^_REV_PRIVATE_NET^$REV_PRIVATENET^g" "$OUTDIR/$LVS_SERVERS/etc/bind/named.conf.local" done - +echo "Done." # eval echo "\$LVS0${NUM}_PRIVATE_IP #cp -f "$TMPHOSTS" "$OUTDIR/lvs01/etc/hosts" && sed -i "s^thishost^lvs01^g" "$OUTDIR/lvs01/etc/hosts" @@ -1665,7 +1875,7 @@ SetupInterfaces ### setup exports for utility. for UTILITY in $MACHINES_UTILITY; do -cp -f "/tmp/exports" "$OUTDIR/$UTILITY/etc/" +cp -f "$TMPFOLDER/exports" "$OUTDIR/$UTILITY/etc/" ### action trigger filters for utility. mkdir -p "$OUTDIR/$UTILITY/openils/conf" @@ -1678,20 +1888,25 @@ if [ -e "$CUSTOMDIR/action_trigger_filters.json" ] cp -f "$TEMPLATEDIR/action_trigger_filters.json" "$OUTDIR/$UTILITY/openils/conf" fi ### copy pines scripts to utility -mkdir -p "$OUTDIR/$UTILITY/home/opensrf/eg" +mkdir -p "$OUTDIR/$UTILITY/home/opensrf/eg/ums" cp $TEMPLATEDIR/utility/*.sh "$OUTDIR/$UTILITY/home/opensrf/eg" +cp $TEMPLATEDIR/utility/ums/*.pl "$OUTDIR/$UTILITY/home/opensrf/eg/ums" +sed -i "s^Utility_Hostname^$UTILITY^g" "$OUTDIR/$UTILITY/home/opensrf/eg/gen_blocked_list.sh" +sed -i "s^Domain_Name^$CLUSTERDOMAINNAME^g" "$OUTDIR/$UTILITY/home/opensrf/eg/gen_blocked_list.sh" +sed -i "s^Brick_Head_List^$BRICKHEADLIST^g" "$OUTDIR/$UTILITY/home/opensrf/eg/gen_blocked_list.sh" done ### setup exports for reporter output -cp -f "/tmp/exports_reporter" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/exports" +cp -f "$TMPFOLDER/exports_reporter" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/exports" +echo "$(date)" > "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/eg_reports_output_host.txt" ### Setup DNS and NTP configs. Except LVS and bricks. #for DNSNODE in db01 db02 db03 logger01 utility01 sip01 sip02 reporter01 memcache01 memcache02 monitor01 backup01 admin01 for DNSNODE in $MACHINES_NO_LVS do - cp -f "/tmp/resolv.conf" "$OUTDIR/$DNSNODE/etc" - cp -f "/tmp/ntp.conf" "$OUTDIR/$DNSNODE/etc" + cp -f "$TMPFOLDER/resolv.conf" "$OUTDIR/$DNSNODE/etc" + cp -f "$TMPFOLDER/ntp.conf" "$OUTDIR/$DNSNODE/etc" done @@ -1702,7 +1917,9 @@ echo "Setting up hostname and logger config files for non-brick nodes.." for HOSTNODE in $MACHINES_NO_BRICKS do echo $HOSTNODE > "$OUTDIR/${HOSTNODE}/etc/hostname" - cp -f /tmp/rsyslog.conf "$OUTDIR/${HOSTNODE}/etc" + mkdir -p "$OUTDIR/${HOSTNODE}/etc/rsyslog.d" + cp -f $TEMPLATEDIR/rsyslog/50-default.conf "$OUTDIR/${HOSTNODE}/etc/rsyslog.d" + cp -f $TMPFOLDER/60-evergreen-ils.conf "$OUTDIR/${HOSTNODE}/etc/rsyslog.d" done echo "Done setting up hostname and logger config for non-bricks nodes." @@ -1722,12 +1939,21 @@ for OTHERNODE in $MACHINES_OSRF_NO_BRICKS #mkdir -p "$OUTDIR/$OTHERNODE/etc/init.d" && cp -f "$TEMPLATEDIR/init/eg_opensrf" "$OUTDIR/${OTHERNODE}/etc/init.d/opensrf" mkdir -p "$OUTDIR/$OTHERNODE/var/run/evergreen" sed -i "s^Brick_head_Fqdn^${OTHERNODE}.${CLUSTERDOMAINNAME}^g" "${OUTDIR}/${OTHERNODE}/openils/conf/opensrf_core.xml" - sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" "${OUTDIR}/${OTHERNODE}/openils/conf/opensrf_core.xml" - cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-full /tmp/opensrf.xml-full - sed -i "s^NODE_HOST_NAME.ClusterDomainName^${OTHERNODE}.${CLUSTERDOMAINNAME}^g" /tmp/opensrf.xml-full - cat /tmp/opensrf.xml-full >> $TMPOPENSRF_XML + #sed -i "s^OpenSRF_Password^$OPENSRF_PASSWORD^g" "${OUTDIR}/${OTHERNODE}/openils/conf/opensrf_core.xml" + sed -i "s^OpenSRF_Password^$(echo $OPENSRF_PASSWORD | sed -e 's^&^\\\&^g' -e 's/\^/\\\^/g')^g" "${OUTDIR}/${OTHERNODE}/openils/conf/opensrf_core.xml" + cp -f $TEMPLATEDIR/opensrf.xml/opensrf.xml-full $TMPFOLDER/opensrf.xml-full + sed -i "s^NODE_HOST_NAME.ClusterDomainName^${OTHERNODE}.${CLUSTERDOMAINNAME}^g" $TMPFOLDER/opensrf.xml-full + cat $TMPFOLDER/opensrf.xml-full >> $TMPOPENSRF_XML cp -f "$TEMPLATEDIR/oils_web.xml" "$OUTDIR/$OTHERNODE/openils/conf" echo ${OTHERNODE} >> $TMPOSRFNODES + if echo ${OTHERNODE} | grep -q reporter0 + then + if [ "$REPORTER_IS_HOST" = "NO" ] ### Make sure we mount nfs share on reporter if its not the host. + then + cp -f $TEMPLATEDIR/eg_fstab_reporter "$OUTDIR/${OTHERNODE}/etc" + sed -i "s^REPORTER_OUTPUT_NFS_HOST_IP^$REPORTS_NFS_HOSTNAME_IP^g" "$OUTDIR/${OTHERNODE}/etc/eg_fstab_reporter" + fi + fi done ### copy completed opensrf file to their respective locations. @@ -1749,22 +1975,24 @@ for SIPNODE in $MACHINES_SIP_ONLY mkdir -p "$OUTDIR/$SIPNODE/etc/init.d" mkdir -p "$OUTDIR/$SIPNODE/etc/cron.d" mkdir -p "$OUTDIR/$SIPNODE/var/www" + mkdir -p "$OUTDIR/$SIPNODE/root/eg" tar zxf $TEMPLATEDIR/SIP/SIPServer.tar.gz -C "$OUTDIR/$SIPNODE/opt" cp -f $TEMPLATEDIR/SIP/sip.init "$OUTDIR/$SIPNODE/etc/init.d/oils_sip" - cp $TEMPLATEDIR/SIP/eg_sip_root.crontab "$OUTDIR/$SIPNODE/etc/cron.d" - if $(ls $CUSTOMDIR |grep -q "index.html") - then - MAINT_PAGE_INDEX="$CUSTOMDIR/index.html" - CUSTOM_MAINT_PAGE_INDEX="y" - elif $(ls $CUSTOMDIR |grep -q "index.php") - then - MAINT_PAGE_INDEX="$CUSTOMDIR/index.php" - CUSTOM_MAINT_PAGE_INDEX="y" - else - MAINT_PAGE_INDEX="$TEMPLATEDIR/SIP/index.html" - fi - CUSTOM_MAINT_PAGE_INDEX="y" && cp -f $CUSTOMDIR/*.jpg $CUSTOMDIR/*.png "$OUTDIR/$SIPNODE/var/www/" >/dev/null 2>&1 - cp -f $TEMPLATEDIR/SIP/index.html "$OUTDIR/$SIPNODE/var/www" + cp -f $TEMPLATEDIR/SIP/eg_sip_root.crontab "$OUTDIR/$SIPNODE/root/eg" + cp -f $TEMPLATEDIR/SIP/display_sip_connections.sh "$OUTDIR/$SIPNODE/root/eg" + #if $(ls $CUSTOMDIR |grep -q "index.html") ### Moved to LVS + #then + #MAINT_PAGE_INDEX="$CUSTOMDIR/index.html" + #CUSTOM_MAINT_PAGE_INDEX="y" + # elif $(ls $CUSTOMDIR |grep -q "index.php") + # then + # MAINT_PAGE_INDEX="$CUSTOMDIR/index.php" + # CUSTOM_MAINT_PAGE_INDEX="y" + # else + # MAINT_PAGE_INDEX="$TEMPLATEDIR/SIP/index.html" + #fi + #CUSTOM_MAINT_PAGE_INDEX="y" && cp -f $CUSTOMDIR/*.jpg $CUSTOMDIR/*.png "$OUTDIR/$SIPNODE/var/www/" >/dev/null 2>&1 + #cp -f $TEMPLATEDIR/SIP/index.html "$OUTDIR/$SIPNODE/var/www" done echo "Done setting up SIP." @@ -1776,7 +2004,12 @@ echo "Setting up logger" for LOGGER in $MACHINES_LOGGER do mkdir -p "$OUTDIR/$LOGGER/etc/rsyslog.d" - cp -f "$TEMPLATEDIR/opensrf-rsyslog.conf" "$OUTDIR/$LOGGER/etc/rsyslog.d" + cp -f "$TEMPLATEDIR/rsyslog/opensrf-rsyslog.conf" "$OUTDIR/$LOGGER/etc/rsyslog.d" + cp -f "$TEMPLATEDIR/rsyslog/rsyslog.conf-logger" "$OUTDIR/$LOGGER/etc/rsyslog.conf" + if [ "$OSDISTRO" = "Debian6" ] + then + cp -f "$TEMPLATEDIR/rsyslog/rsyslog.conf-debian6" "$OUTDIR/$LOGGER/etc/rsyslog.conf" + fi done echo "Done setting up logger" @@ -1789,26 +2022,27 @@ for DB_SERVER in $MACHINES_DB_ONLY mkdir -p $OUTDIR/${DB_SERVER}/home/postgres/eg mkdir -p $OUTDIR/${DB_SERVER}/root/eg cp -f "$TEMPLATEDIR/init/eg_database" "$OUTDIR/${DB_SERVER}/etc/init.d" - cp -f "$TEMPLATEDIR/db/postgresql.conf" "$OUTDIR/${DB_SERVER}/etc/postgresql/$PSQL_VERSION/main" + # cp -f "$TEMPLATEDIR/db/postgresql.conf" "$OUTDIR/${DB_SERVER}/etc/postgresql/$PSQL_VERSION/main" #TODO removed temporarily. cp -f "$TEMPLATEDIR/db/pg_hba.conf" "$OUTDIR/${DB_SERVER}/etc/postgresql/$PSQL_VERSION/main" cp -f "$TEMPLATEDIR/db/eg_db_postgres.crontab" "$OUTDIR/${DB_SERVER}/home/postgres/eg" cp -f "$TEMPLATEDIR/db/eg_db_root.crontab" "$OUTDIR/${DB_SERVER}/root/eg" cp -f "$TEMPLATEDIR/db/eg-db-backup.sh" "$OUTDIR/${DB_SERVER}/home/postgres/eg" cp -f "$TEMPLATEDIR/db/eg-wal-archive.sh" "$OUTDIR/${DB_SERVER}/home/postgres/eg" cp -f "$TEMPLATEDIR/db/snapshot.sh" "$OUTDIR/${DB_SERVER}/root/eg" - cp -f "$TEMPLATEDIR/db/eg_fstab_db" "$OUTDIR/${DB_SERVER}/etc" - sed -i "s^_BACKUP01_IP^${BACKUP01_IP}^g" "$OUTDIR/${DB_SERVER}/etc/eg_fstab_db" + #cp -f "$TEMPLATEDIR/db/eg_fstab_db" "$OUTDIR/${DB_SERVER}/etc" + echo "${BACKUP01_IP}:/var/backup /var/backup/ nfs rw 0 0" > "$OUTDIR/${DB_SERVER}/etc/eg_fstab_db" + #sed -i "s^_BACKUP01_IP^${BACKUP01_IP}^g" "$OUTDIR/${DB_SERVER}/etc/eg_fstab_db" sed -i "s^_PSQL_VERSION^${PSQL_VERSION}^g" "$OUTDIR/${DB_SERVER}/home/postgres/eg/eg-db-backup.sh" sed -i "s^_CLUSTERDOMAINNAME^${CLUSTERDOMAINNAME}^g" "$OUTDIR/${DB_SERVER}/home/postgres/eg/eg-db-backup.sh" sed -i "s^Priv_NET^${PRIVATENET}^g" "$OUTDIR/${DB_SERVER}/etc/postgresql/$PSQL_VERSION/main/pg_hba.conf" - echo "/var/backup ${DB_SERVER}(rw,sync,no_root_squash,no_subtree_check)" >> /tmp/exports_backup + echo "/var/backup ${DB_SERVER}(rw,sync,no_root_squash,no_subtree_check)" >> $TMPFOLDER/exports_backup done ### setup exports for backup for BACKUP_SERVER in $MACHINES_BACKUP do - cp -f "/tmp/exports_backup" "$OUTDIR/$BACKUP_SERVER/etc/exports" + cp -f "$TMPFOLDER/exports_backup" "$OUTDIR/$BACKUP_SERVER/etc/exports" mkdir -p "$OUTDIR/$BACKUP_SERVER/var/backup" done @@ -1816,6 +2050,8 @@ done ### that hosts the reporter exports share Reports_NFS_Host () { +echo +echo "Setting up Reports NFS host. ${REPORTS_NFS_HOSTNAME}" ### Setup hosts file mkdir -p "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/network" && \ cp -f "$TMPHOSTS" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/hosts" && \ @@ -1832,19 +2068,26 @@ sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" "$OUTDIR/${REPORTS_NFS_HOST sed -i "s^Priv_NET^$PRIVATENET^g" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/network/interfaces" ### Configure DNS and NTP -cp -f "/tmp/resolv.conf" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc" -cp -f "/tmp/ntp.conf" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc" +cp -f "$TMPFOLDER/resolv.conf" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc" +cp -f "$TMPFOLDER/ntp.conf" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc" ### Configure hostname and logger config files echo ${REPORTS_NFS_HOSTNAME} > "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/hostname" -cp -f /tmp/rsyslog.conf "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc" +#cp -f $TEMPLATEDIR/rsyslog.conf "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc" +mkdir -p "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/rsyslog.d" +cp -f "$TEMPLATEDIR/rsyslog/50-default.conf" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/rsyslog.d" +cp -f "$TEMPLATEDIR/rsyslog/60-evergreen-ils.conf" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/rsyslog.d" +echo "Done." } -if ! grep -q "reporter0\|db0" ${REPORTS_NFS_HOSTNAME} 2>/dev/null +#echo "${REPORTS_NFS_HOSTNAME}" +if ! echo "${REPORTS_NFS_HOSTNAME}" | grep -q "reporter0\|db0" 2>/dev/null then Reports_NFS_Host fi + + ### Write config info file. echo >> "$NETCFGFILE" echo "Cluster Public (shared) IP Address set to : $CLUSTERIPADDRESS" >> "$NETCFGFILE" @@ -1916,12 +2159,12 @@ echo >> "$NETCFGFILE" ### Set passwords for nodes that get the debs installed. -cp $TEMPLATEDIR/debconf-settings /tmp -sed -i "s^OPENSRF_FQDN^$CLUSTERDOMAINNAME^g" /tmp/debconf-settings -sed -i "s^OPENSRF_USER_PASSWORD^$OPENSRF_PASSWORD^g" /tmp/debconf-settings -sed -i "s^EVERGREEN-ILS_DB_PASSWORD^$DATABASE_PASSWORD^g" /tmp/debconf-settings -sed -i "s^EVERGREEN-ILS_ADMIN_USER^$EG_ADMIN_USER^g" /tmp/debconf-settings -sed -i "s^EVERGREEN-ILS_ADMIN_PASSWORD^$EG_ADMIN_PASSWORD^g" /tmp/debconf-settings +cp $TEMPLATEDIR/debconf-settings $TMPFOLDER +sed -i "s^OPENSRF_FQDN^$CLUSTERDOMAINNAME^g" $TMPFOLDER/debconf-settings +sed -i "s^OPENSRF_USER_PASSWORD^$OPENSRF_PASSWORD^g" $TMPFOLDER/debconf-settings +sed -i "s^EVERGREEN-ILS_DB_PASSWORD^$DATABASE_PASSWORD^g" $TMPFOLDER/debconf-settings +sed -i "s^EVERGREEN-ILS_ADMIN_USER^$EG_ADMIN_USER^g" $TMPFOLDER/debconf-settings +sed -i "s^EVERGREEN-ILS_ADMIN_PASSWORD^$EG_ADMIN_PASSWORD^g" $TMPFOLDER/debconf-settings cat $TEMPLATEDIR/opensrf.xml/opensrf.xml-footer >> $TMPOPENSRF_XML @@ -1969,7 +2212,7 @@ sed -i "s^vandelay_MAX^50^g" openils/conf/opensrf.xml PkgFiles () { ### Package All files. for FOLDER in $(ls -d */) - do +do WORK_DIR="$(echo -e ${FOLDER%/*})" printf " |\r";sleep 0.05; printf " /\r";sleep 0.05; printf -- ' - \r';sleep 0.05; printf ' \\\r' cd $(echo -e ${FOLDER%/*}) @@ -1977,7 +2220,7 @@ for FOLDER in $(ls -d */) if echo $WORK_DIR |grep -q reporter0 || \ echo $WORK_DIR |grep -q utility0 || \ echo $WORK_DIR |grep -q sip0 - then + then cp $TMPOPENSRF_XML openils/conf/opensrf.xml Optimize_OpenSRF fi @@ -1997,35 +2240,36 @@ printf " " PkgBricks () { ### Create setup packages for the bricks. for FOLDER in $(ls -d *brick*) - do - cd $FOLDER - for SUBFOLDER in $(ls -d *) - do - printf " |\r";sleep 0.05; printf " /\r";sleep 0.05; printf -- ' - \r';sleep 0.05; printf ' \\\r' - cd $SUBFOLDER - cp $TMPOPENSRF_XML openils/conf/opensrf.xml - Optimize_Brick_OpenSRF - mkdir ../setup_${SUBFOLDER} - mv ${SUBFOLDER}_apt.list ../setup_${SUBFOLDER} - cp /tmp/debconf-settings ../setup_${SUBFOLDER} - touch ../setup_${SUBFOLDER}/.osrf_node - sed -i "s^HOSTNAME^${SUBFOLDER}^g" ../setup_${SUBFOLDER}/debconf-settings +do + cd $FOLDER + for SUBFOLDER in $(ls -d *) + do + printf " |\r";sleep 0.05; printf " /\r";sleep 0.05; printf -- ' - \r';sleep 0.05; printf ' \\\r' + cd $SUBFOLDER + cp $TMPOPENSRF_XML openils/conf/opensrf.xml + Optimize_Brick_OpenSRF + mkdir ../setup_${SUBFOLDER} + mv ${SUBFOLDER}_apt.list ../setup_${SUBFOLDER} + cp $TMPFOLDER/debconf-settings ../setup_${SUBFOLDER} + touch ../setup_${SUBFOLDER}/.osrf_node + sed -i "s^HOSTNAME^${SUBFOLDER}^g" ../setup_${SUBFOLDER}/debconf-settings - cp -R $TEMPLATEDIR/debs ../setup_${SUBFOLDER} - if [ -e "${SUBFOLDER}_drones.txt" ] - then - mv ${SUBFOLDER}_drones.txt ../setup_${SUBFOLDER} - fi - if echo ${SUBFOLDER} | grep -q head - then - cp -f $TEMPLATEDIR/setup_brick_to_drone_sshkeys.sh ../setup_${SUBFOLDER}/setup_${SUBFOLDER}_to_drone_sshkeys.sh - cp -f $TEMPLATEDIR/db/eg_db_config.pl ../setup_${SUBFOLDER} - [ -e "${CUSTOMDIR}/lib_ips.txt" ] && cp "${CUSTOMDIR}/lib_ips.txt" ../setup_${SUBFOLDER} - sed -i "s^brick_drones.txt^${SUBFOLDER}_drones.txt^g" ../setup_${SUBFOLDER}/setup_${SUBFOLDER}_to_drone_sshkeys.sh - sed -i "s^EG_DB_USER^$DB_USERNAME^g" setup-head.sh - sed -i "s^EG_DB_PASSWORD^$DATABASE_PASSWORD^g" setup-head.sh - sed -i "s^EG_ADMIN_USER^$EG_ADMIN_USER^g" setup-head.sh - sed -i "s^EG_ADMIN_PASS^$EG_ADMIN_PASSWORD^g" setup-head.sh + cp -R $TEMPLATEDIR/debs ../setup_${SUBFOLDER} + if [ -e "${SUBFOLDER}_drones.txt" ] + then + mv ${SUBFOLDER}_drones.txt ../setup_${SUBFOLDER} + fi + if echo ${SUBFOLDER} | grep -q head + then + cp -f $TEMPLATEDIR/setup_brick_to_drone_sshkeys.sh ../setup_${SUBFOLDER}/setup_${SUBFOLDER}_to_drone_sshkeys.sh + cp -f $TEMPLATEDIR/db/eg_db_config.pl ../setup_${SUBFOLDER} + [ -e "${CUSTOMDIR}/lib_ips.txt" ] && cp "${CUSTOMDIR}/lib_ips.txt" ../setup_${SUBFOLDER} + sed -i "s^brick_drones.txt^${SUBFOLDER}_drones.txt^g" ../setup_${SUBFOLDER}/setup_${SUBFOLDER}_to_drone_sshkeys.sh + sed -i "s^MASTER_DB^$MASTER_DB^g" setup-head.sh + sed -i "s^EG_DB_USER^$DB_USERNAME^g" setup-head.sh + sed -i "s^EG_DB_PASSWORD^$DATABASE_PASSWORD^g" setup-head.sh + sed -i "s^EG_ADMIN_USER^$EG_ADMIN_USER^g" setup-head.sh + sed -i "s^EG_ADMIN_PASS^$(echo $EG_ADMIN_PASSWORD | sed -e 's^&^\\\&^g' -e 's/\^/\\\^/g')^g" setup-head.sh fi #TODO check drone pkging. cp $TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz ../setup_${SUBFOLDER} @@ -2037,7 +2281,7 @@ for FOLDER in $(ls -d *brick*) cd .. tar zcf setup_${SUBFOLDER}.tar.gz setup_${SUBFOLDER} rm -rf setup_${SUBFOLDER} - done + done cd .. done printf " " @@ -2047,66 +2291,67 @@ PkgOthers () { ### Create setup packages for everything else except bricks. ((count++)) #printf "$count " printf " |\r";sleep 0.05; printf " /\r";sleep 0.05; printf -- ' - \r';sleep 0.05; printf ' \\\r' -#for NODE_FOLDER in lvs01 lvs02 db01 db02 db03 logger01 utility01 sip01 sip02 reporter01 memcache01 memcache02 ${REPORTS_NFS_HOSTNAME} backup01 admin01 -# do - cd $NODE_FOLDER - mkdir "setup_${NODE_FOLDER}" - cp "$TEMPLATEDIR/setup.sh" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" - cp "$TEMPLATEDIR/setup-vars" "setup_${NODE_FOLDER}/setup-vars" - cp "$TEMPLATEDIR/setup-functions" "setup_${NODE_FOLDER}/setup-functions" - if [[ "$USE_HOSTNAME_PREFIX" = "y" || "$USE_HOSTNAME_PREFIX" = "Y" ]] - then - NODE_FOLDER_NO_PREFIX=$(echo $NODE_FOLDER|awk -F"-" '{ print $2 }') - else - NODE_FOLDER_NO_PREFIX=$NODE_FOLDER - fi - if [ -e "$TEMPLATEDIR/apt/${NODE_FOLDER_NO_PREFIX}_apt.list" ] - then - cp "$TEMPLATEDIR/apt/${NODE_FOLDER_NO_PREFIX}_apt.list" "setup_${NODE_FOLDER}/${NODE_FOLDER}_apt.list" - else - cp "$TEMPLATEDIR/apt/apt.list" "setup_${NODE_FOLDER}/${NODE_FOLDER}_apt.list" - fi - grep -qx ${NODE_FOLDER} "$TMPOSRFNODES" && \ - cp "/tmp/debconf-settings" "setup_${NODE_FOLDER}" && \ - touch "setup_${NODE_FOLDER}/.osrf_node" && \ - sed -i "s^HOSTNAME^${NODE_FOLDER}^g" "setup_${NODE_FOLDER}/debconf-settings" && \ - cp -R "$TEMPLATEDIR/debs" "setup_${NODE_FOLDER}" - #cp $TMPOPENSRF_XML openils/conf/opensrf.xml - if echo ${NODE_FOLDER} | grep -q db0 - then - cp -f "$TMPOSRFNODES" "setup_${NODE_FOLDER}/opensrf_nodes.txt" - cp -f "$TEMPLATEDIR/setup_sshkeys.sh" "setup_${NODE_FOLDER}" - cp -f "$TEMPLATEDIR/db/create_database_${PSQL_VERSION}.sql" "setup_${NODE_FOLDER}/create_database.sql" - cp -f "$TEMPLATEDIR/db/eg_db_root.crontab" "setup_${NODE_FOLDER}" - cp -f "$TEMPLATEDIR/db/eg_db_postgres.crontab" "setup_${NODE_FOLDER}" - echo "CREATE ROLE evergreen PASSWORD" \'$DATABASE_PASSWORD\' "SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;" > "setup_${NODE_FOLDER}/create_db_user.sql" - fi - if echo ${NODE_FOLDER} | grep -q utility0 - then - cp -f "$TMPOSRFNODES" "setup_${NODE_FOLDER}/opensrf_nodes.txt" - cp -f "$TEMPLATEDIR/setup_sshkeys.sh" "setup_${NODE_FOLDER}" - cp -f "$TEMPLATEDIR/utility/opensrf-crontab" "setup_${NODE_FOLDER}" - cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}" - fi - if echo ${NODE_FOLDER} | grep -q sip0 - then - cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}" - fi - if echo ${NODE_FOLDER} | grep -q reporter0 - then - cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}" - fi - sed -i "s^tar_file^$NODE_FOLDER^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" - sed -i "s^_EGVER^$EG_VERSION^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" - sed -i "s^_GENVER^$VERSION_^g" "setup_${NODE_FOLDER}/setup-vars" - sed -i "s^_EGVER^$EG_VERSION^g" "setup_${NODE_FOLDER}/setup-vars" - sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" - mv "$NODE_FOLDER.tar.gz" "setup_${NODE_FOLDER}" - mv "${NODE_FOLDER}_etc-hosts.tar.gz" "setup_${NODE_FOLDER}" - tar zcf "setup_$NODE_FOLDER.tar.gz" "setup_${NODE_FOLDER}" - rm -rf "setup_${NODE_FOLDER}" - cd .. -#done +cd $NODE_FOLDER +mkdir "setup_${NODE_FOLDER}" +cp "$TEMPLATEDIR/setup.sh" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" +chmod 755 "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" +cp "$TEMPLATEDIR/setup-vars" "setup_${NODE_FOLDER}/setup-vars" +cp "$TEMPLATEDIR/setup-functions" "setup_${NODE_FOLDER}/setup-functions" +if [[ "$USE_HOSTNAME_PREFIX" = "y" || "$USE_HOSTNAME_PREFIX" = "Y" ]] +then + NODE_FOLDER_NO_PREFIX=$(echo $NODE_FOLDER|awk -F"-" '{ print $2 }') +else + NODE_FOLDER_NO_PREFIX=$NODE_FOLDER +fi +if [ -e "$TEMPLATEDIR/apt/${NODE_FOLDER_NO_PREFIX}_apt.list" ] +then + cp "$TEMPLATEDIR/apt/${NODE_FOLDER_NO_PREFIX}_apt.list" "setup_${NODE_FOLDER}/${NODE_FOLDER}_apt.list" +else + cp "$TEMPLATEDIR/apt/apt.list" "setup_${NODE_FOLDER}/${NODE_FOLDER}_apt.list" +fi +grep -qx ${NODE_FOLDER} "$TMPOSRFNODES" && \ +cp "$TMPFOLDER/debconf-settings" "setup_${NODE_FOLDER}" && \ +touch "setup_${NODE_FOLDER}/.osrf_node" && \ +sed -i "s^HOSTNAME^${NODE_FOLDER}^g" "setup_${NODE_FOLDER}/debconf-settings" && \ +cp -R "$TEMPLATEDIR/debs" "setup_${NODE_FOLDER}" +if echo ${NODE_FOLDER} | grep -q db0 +then + cp -f "$TMPOSRFNODES" "setup_${NODE_FOLDER}/opensrf_nodes.txt" + cp -f "$TEMPLATEDIR/setup_sshkeys.sh" "setup_${NODE_FOLDER}" + cp -f "$TEMPLATEDIR/db/create_database_${PSQL_VERSION}.sql" "setup_${NODE_FOLDER}/create_database.sql" + cp -f "$TEMPLATEDIR/db/eg_db_root.crontab" "setup_${NODE_FOLDER}" + cp -f "$TEMPLATEDIR/db/eg_db_postgres.crontab" "setup_${NODE_FOLDER}" + echo "CREATE ROLE evergreen PASSWORD" \'$DATABASE_PASSWORD\' "SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;" > "setup_${NODE_FOLDER}/create_db_user.sql" +fi +if echo ${NODE_FOLDER} | grep -q utility0 +then + cp -f "$TMPOSRFNODES" "setup_${NODE_FOLDER}/opensrf_nodes.txt" + cp -f "$TEMPLATEDIR/setup_sshkeys.sh" "setup_${NODE_FOLDER}" + cp -f "$TEMPLATEDIR/utility/opensrf-crontab" "setup_${NODE_FOLDER}" + cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}" +fi +if echo ${NODE_FOLDER} | grep -q sip0 +then + cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}" +fi +if echo ${NODE_FOLDER} | grep -q reporter0 +then + cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}" +fi +if echo ${NODE_FOLDER} | grep -q lvs0 +then + cp -f $TEMPLATEDIR/lvs/ldirector*.deb "setup_${NODE_FOLDER}" +fi +sed -i "s^tar_file^$NODE_FOLDER^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" +sed -i "s^_EGVER^$EG_VERSION^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" +sed -i "s^_GENVER^$VERSION_^g" "setup_${NODE_FOLDER}/setup-vars" +sed -i "s^_EGVER^$EG_VERSION^g" "setup_${NODE_FOLDER}/setup-vars" +sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh" +mv "$NODE_FOLDER.tar.gz" "setup_${NODE_FOLDER}" +mv "${NODE_FOLDER}_etc-hosts.tar.gz" "setup_${NODE_FOLDER}" +tar zcf "setup_$NODE_FOLDER.tar.gz" "setup_${NODE_FOLDER}" +rm -rf "setup_${NODE_FOLDER}" +cd .. } @@ -2134,7 +2379,7 @@ if [ "$ADD_REPORTS_SHARE" = "1" ] fi -rm -f /tmp/debconf-settings +rm -f $TMPFOLDER/debconf-settings echo -e $COL_BR_BLUE cat "$NETCFGFILE" echo -e $COL_RESET @@ -2175,3 +2420,5 @@ echo -e "saved in "${COL_BR_GREEN}"$OUTDIR"$COL_RESET echo echo -e $COL_BR_CYAN"A new config file for GenaSYS has been created and" echo -e "saved as $COL_YELLOW${NEW_CONFIG_FILE}"$COL_RESET + +rm -rf $TMPFOLDER diff --git a/README.txt b/README.txt index a12ef42..8241603 100644 --- a/README.txt +++ b/README.txt @@ -29,7 +29,7 @@ Hardware (actual or virtual): Software: -* base installation of Debian squeeze on each server +* base installation of Debian squeeze/Ubuntu LTS on each server === Usage diff --git a/genasys.conf-dist b/genasys.conf-dist index fa67b7a..7696f53 100644 --- a/genasys.conf-dist +++ b/genasys.conf-dist @@ -1,3 +1,5 @@ +CONFIG_VERSION=1 + ### The DNS domain name for this cluster? eg. gapines.org CLUSTERDOMAINNAME="example.org" @@ -74,3 +76,10 @@ CLUSTERGATEWAY="192.168.5.1" LVS01_PHYSICAL_PUBLIC_IP="192.168.5.56" #---Second LVS server--- LVS02_PHYSICAL_PUBLIC_IP="192.168.5.57" + +### If you want to use Syndetics for added content +### then enter a "y" here. +USE_SYNDETICS="n" + +### Enter your Syndetics user id here. +SYNDETICS_USER_ID="" diff --git a/templates/SIP/SIPServer.tar.gz b/templates/SIP/SIPServer.tar.gz index 1563f80..39d8407 100644 Binary files a/templates/SIP/SIPServer.tar.gz and b/templates/SIP/SIPServer.tar.gz differ diff --git a/templates/SIP/display_sip_connections.sh b/templates/SIP/display_sip_connections.sh new file mode 100644 index 0000000..2f7a93b --- /dev/null +++ b/templates/SIP/display_sip_connections.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ss -n|grep 6001 |awk '{ print $5 }' | awk -F":" '{ print $4 }' |sort|grep -v '^$'|uniq -c|sort -n -r diff --git a/templates/SIP/eg_sip_root.crontab b/templates/SIP/eg_sip_root.crontab index 9b61e29..8c6e7ce 100644 --- a/templates/SIP/eg_sip_root.crontab +++ b/templates/SIP/eg_sip_root.crontab @@ -1 +1,3 @@ +### The SIP server needs to be restarted every night. +### someone needs to fix the code so this is not needed. 0 0 * * * /etc/init.d/oils_sip restart diff --git a/templates/SIP/sip.init b/templates/SIP/sip.init index 32fa82e..5d47186 100755 --- a/templates/SIP/sip.init +++ b/templates/SIP/sip.init @@ -39,6 +39,12 @@ stop_sip() { #log_daemon_msg "Stopping SIP Services for Evergreen:" log_daemon_msg su - opensrf -c /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin oils_ctl.sh -d ${OPENILS_BASE}/var/run -s ${SIP_CONF} -a stop_sip" + if /bin/ps -ef | grep SIPServer.pm | grep -v grep | awk '{ print $2 }' + sleep 2 + then + kill $(/bin/ps -ef | /bin/grep SIPServer.pm | /bin/grep -v grep | /usr/bin/awk '{ print $2 }') 2> /dev/null + #TODO verify /openils/var/run/oils_sip.pid and remove. + fi } diff --git a/templates/apache2/eg.conf b/templates/apache2/eg.conf index c9e8df5..b3f2127 100644 --- a/templates/apache2/eg.conf +++ b/templates/apache2/eg.conf @@ -117,6 +117,7 @@ NameVirtualHost *:443 # openssl req -new -x509 -nodes -out server.crt -keyout server.key SSLCertificateFile ssl/server.crt SSLCertificateKeyFile ssl/server.key + #SSLCACertificateFile ssl/ca.crt # - absorb the shared virtual host settings Include eg_vhost.conf diff --git a/templates/apache2/eg_vhost.conf b/templates/apache2/eg_vhost.conf index ea8d662..3039438 100644 --- a/templates/apache2/eg_vhost.conf +++ b/templates/apache2/eg_vhost.conf @@ -6,33 +6,24 @@ # ---------------------------------------------------------------------------------- # Point / to the opac - if you have a custom skin or locale, point at it here # ---------------------------------------------------------------------------------- -RedirectMatch 301 ^/$ /opac/en-US/skin/default/xml/index.xml -RewriteEngine on -#if domain being accessed is not _CLUSTERDOMAINNAME -RewriteCond %{HTTP_HOST} !^_CLUSTER_DOMAIN_PREFIX\._CLUSTER_TLD [NC] -##and the request is not coming from the lvs machines -RewriteCond %{REMOTE_HOST} !^_PRIVATENET.[123] -##and the request is not directed at localhost -RewriteCond %{HTTP_HOST} !^127.0.0.1 -#change the domain name to _CLUSTERDOMAINNAME -RewriteRule ^/(.*) http://_CLUSTERDOMAINNAME/$1 [L,R] +RedirectMatch 301 ^/$ /eg/opac/home # ---------------------------------------------------------------------------------- # Point / to the IP address redirector # ---------------------------------------------------------------------------------- -# -# SetHandler perl-script -# PerlHandler OpenILS::WWW::Redirect -# Options +ExecCGI -# PerlSendHeader On + + SetHandler perl-script + PerlHandler OpenILS::WWW::Redirect + Options +ExecCGI + PerlSendHeader On # #PerlSetVar OILSRedirectSkin "default" # # OILSRedirectDepth defaults to the depth of the branch that the OPAC was directed to # #PerlSetVar OILSRedirectDepth "0" # #PerlSetVar OILSRedirectLocale "en-US" # # Use the template-toolkit opac -# #PerlSetVar OILSRedirectTpac "true" -# allow from all -# + PerlSetVar OILSRedirectTpac "true" + allow from all + # ---------------------------------------------------------------------------------- @@ -46,7 +37,7 @@ RedirectMatch 301 ^/opac/extras/slimpac/advanced.html$ /opac/en-US/extras/slimpa # ---------------------------------------------------------------------------------- OSRFGatewayConfig /openils/conf/opensrf_core.xml # Translator memcache server. Default is localhost -# OSRFTranslatorCacheServer 127.0.0.1:11211 +OSRFTranslatorCacheServer 10.30.30.151:11211 # ---------------------------------------------------------------------------------- @@ -96,6 +87,50 @@ RewriteCond %{REQUEST_URI} ^/opac/(.*?)/ RewriteRule . - [E=locale:%1] # ---------------------------------------------------------------------------------- +# Rewrite JSPac->TPac with redirects +# ---------------------------------------------------------------------------------- + +# First things first, extract useful data +# And we are going to start with a "this is the JSPac" check on each of these: +# RewriteCond %{REQUEST_URI} ^/?opac/ + +# Basic (overall) search type, if present +# I am cheating and grabbing RT or TP because I dunno the difference between them. +RewriteCond %{REQUEST_URI} ^/opac/ +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])(rt|tp)=([^;&]*) +RewriteRule . - [E=OILS_JSPAC_SEARCH_TYPE:qtype=%3;] + +# Basic (overall) search term(s), if present - NOTE: Not doing advanced search. +RewriteCond %{REQUEST_URI} ^/opac/ +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])t=([^;&]*) +RewriteRule . - [E=OILS_JSPAC_SEARCH_TERMS:query=%2;] + +# Search Location, if present +RewriteCond %{REQUEST_URI} ^/opac/ +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])l=([^;&]*) +RewriteRule . - [E=OILS_JSPAC_SEARCH_LOCATION:locg=%2;] + +# My Account +RewriteRule /opac/[^/]*/skin/default/xml/myopac.xml /eg/opac/myopac/main?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Record Pages +# /opac/en-US/skin/default/xml/rdetail.xml?r=32 -> /eg/opac/record/32 +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])r=([^;&]*) +RewriteRule /opac/.*/rdetail.xml /eg/opac/record/%2?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Bookbag Pages +# /opac/extras/feed/bookbag/html-full/1 -> /eg/opac/results?bookbag=1;page=0;locg=1;depth=0 +RewriteRule /opac/extras/feed/bookbag/html-full/(\d*) /eg/opac/results?bookbag=$1;%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Search Results Pages +RewriteRule /opac/[^/]*/skin/[^/]*/xml/rresult.xml /eg/opac/results?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Basic Search (STILL not doing advanced) +# Fallback! But only for things that end in xml, htm, or html +# Images, CSS, etc can stick around. +RewriteRule /opac/[^/]*/skin/.*(xml|htm|html|/)$ /eg/opac/home?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# ---------------------------------------------------------------------------------- # For sanity reasons, default indexes to Off # ---------------------------------------------------------------------------------- Options -Indexes @@ -149,7 +184,7 @@ Options -Indexes #SetEnv OILS_CHILIFRESH_HTTPS_URL https://secure.chilifresh.com/on-site/js/evergreen.js # Specify the initial script URL for Novelist (containing account credentials, etc.) - #SetEnv OILS_NOVELIST_URL + SetEnv OILS_NOVELIST_URL http://imageserver.ebscohost.com/eit/eitinit.js?auth=profile&profile=dou1.main.novsel&pwd=dGJyMOPY8Uy1r7EA&cfg=Y # # Uncomment to force SSL any time a patron is logged in. This protects @@ -225,19 +260,17 @@ RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ /opac/%1/extras/slimpa # ---------------------------------------------------------------------------------- # Run server-side XUL and XHTML through xmlent to load the correct XML entities # ---------------------------------------------------------------------------------- -RewriteCond %{HTTP:Accept-Language} ([a-z]{2}-[A-Z]{2}) -RewriteRule ^/xul/ - [E=locale:%1] -RewriteRule ^/reports/ - [E=locale:%1] - +RewriteCond %{HTTP:Accept-Language} ^([a-z]{2}-[A-Z]{2})$ # Default to en-US if we haven't matched a locale of the form xx-YY -RewriteCond %{HTTP:Accept-Language} !([a-z]{2}-[A-Z]{2}) -RewriteRule ^/xul/ - [E=locale:en-US] -RewriteRule ^/reports/ - [E=locale:en-US] - -# Default to en-US if we are just given en -RewriteCond %{ENV:locale} ^$ [OR] -RewriteCond %{ENV:locale} ^en$ -RewriteRule . - [E=locale:en-US] +RewriteRule .? - [S=4] +RewriteRule ^/xul/ - [E=locale:en-US] +RewriteRule ^/reports/ - [E=locale:en-US] +RewriteRule .? - [E=locale:en-US] +RewriteRule .? - [S=3] +# Otherwise, set our real locale +RewriteRule ^/xul/ - [E=locale:%{HTTP:Accept-Language}] +RewriteRule ^/reports/ - [E=locale:%{HTTP:Accept-Language}] +RewriteRule .? - [E=locale:%{HTTP:Accept-Language}] Options +Includes @@ -441,6 +474,20 @@ RewriteRule . - [E=locale:en-US] allow from all + + SetHandler perl-script + AuthType Basic + AuthName "Collections Login" + PerlOptions +GlobalRequest + PerlSetVar OILSProxyPermissions "money.collections_tracker.create" + PerlAuthenHandler OpenILS::WWW::Proxy::Authen + require valid-user + Options +ExecCGI + PerlSendHeader On + allow from all + + + # ---------------------------------------------------------------------------------- # Reporting output lives here # ---------------------------------------------------------------------------------- @@ -569,18 +616,47 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] #PerlSetVar OILSWebMediaPrefix "static.example.com/media" #PerlSetVar OILSWebMediaPrefix "http://static.example.com/media" - # Locale messages files + # Locale messages files: + # + # These appear in pairs; the first represents the user agent + # Accept-Language header locale, and the second represents + # the fully-qualified path for the corresponding PO file that + # contains the messages. + # + # If you enable two or more locales, then users will be able to + # select their preferred locale from a locale picker in the TPAC. + # #PerlAddVar OILSWebLocale "en" #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.en.po" #PerlAddVar OILSWebLocale "en_ca" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.en_ca.po" + #PerlAddVar OILSWebLocale "/openils/var/data/locale/en-CA.po" #PerlAddVar OILSWebLocale "fr_ca" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.fr_ca.po" + #PerlAddVar OILSWebLocale "/openils/var/data/locale/fr-CA.po" + # Set the default locale: defaults to en-US + #PerlAddVar OILSWebDefaultLocale "fr_ca" + # Templates will be loaded from the following paths in reverse order. PerlAddVar OILSWebTemplatePath "/openils/var/templates" #PerlAddVar OILSWebTemplatePath "/openils/var/templates_localskin" + #------------------------------------------------- + # Added Content Configuration + #------------------------------------------------- + # Content Cafe + #SetEnv OILS_CONTENT_CAFE_USER MYUSER + #SetEnv OILS_CONTENT_CAFE_PASS MYPASS + + # LibraryThing + #SetEnv OILS_LIBRARYTHING_URL http://ltfl.librarything.com/forlibraries/widget.js?id=MYID + #SetEnv OILS_LIBRARYTHING_HTTPS_URL https://ltfl.librarything.com/forlibraries/widget.js?id=MYID + + # ChiliFresh + #SetEnv OILS_CHILIFRESH_ACCOUNT + #SetEnv OILS_CHILIFRESH_URL http://chilifresh.com/on-site/js/evergreen.js + #SetEnv OILS_CHILIFRESH_HTTPS_URL https://secure.chilifresh.com/on-site/js/evergreen.js + #------------------------------------------------- + SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html @@ -612,22 +688,20 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] # Expire the HTML quickly since we're loading dynamic data for each page ExpiresActive On ExpiresByType text/html "access plus 5 seconds" - - # For use with embedded Content Cafe content - #SetEnv OILS_CONTENT_CAFE_USER 123 - #SetEnv OILS_CONTENT_CAFE_PASS 456 - # Consider copying/moving other added content configs - # (e.g. NOVELIST) into here or to an outer container shared by - # both /opac and /eg/opac since some are used in both places - + + PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGKPacLoader" + PerlSetVar KPacConfigFile "/openils/conf/kpac.xml" + ExpiresActive On + ExpiresByType text/html "access plus 5 seconds" + # Note: the template processor will decline handling anything it does not # have an explicit configuration for, which means it will fall back to # Apache to serve the file. However, in the interest of speed, go ahead # and tell Apache to avoid asking OpenILS::WWW::EGWeb for static content. # Add more exemptions as needed. - + SetHandler None diff --git a/templates/apache2/startup.pl b/templates/apache2/startup.pl index f7755b6..532e736 100755 --- a/templates/apache2/startup.pl +++ b/templates/apache2/startup.pl @@ -15,8 +15,8 @@ use OpenILS::WWW::PasswordReset ('/openils/conf/opensrf_core.xml'); use OpenILS::WWW::IDL2js ('/openils/conf/opensrf_core.xml'); use OpenILS::WWW::FlatFielder; -# - Uncoment the following 2 lines to make use of the IP redirection code -# - The IP file should to contain a map with the following format: +# - Uncomment the following 2 lines to make use of the IP redirection code +# - The IP file should contain a map with the following format: # - actor.org_unit.shortname # - e.g. LIB123 10.0.0.1 10.0.0.254 diff --git a/templates/apt/admin01_apt.list b/templates/apt/admin01_apt.list index bb6b11a..faf4f60 100644 --- a/templates/apt/admin01_apt.list +++ b/templates/apt/admin01_apt.list @@ -1 +1 @@ -ntp gdebi-core +ntp gdebi-core nagios-nrpe-server diff --git a/templates/apt/apt.list b/templates/apt/apt.list index 1260022..9de7941 100644 --- a/templates/apt/apt.list +++ b/templates/apt/apt.list @@ -1 +1 @@ -ntp gdebi-core ssh nfs-kernel-server +ntp gdebi-core ssh nfs-kernel-server nagios-nrpe-server diff --git a/templates/apt/backup01_apt.list b/templates/apt/backup01_apt.list index 2933bdc..4d4276a 100644 --- a/templates/apt/backup01_apt.list +++ b/templates/apt/backup01_apt.list @@ -1 +1 @@ -ntp nfs-kernel-server gdebi-core +ntp nfs-kernel-server gdebi-core nagios-nrpe-server diff --git a/templates/apt/db01_apt.list b/templates/apt/db01_apt.list index eb9f043..53a3eda 100644 --- a/templates/apt/db01_apt.list +++ b/templates/apt/db01_apt.list @@ -1 +1 @@ -ntp make gdebi-core +ntp make gdebi-core nfs-common postgresql-plperl-9.1 nagios-nrpe-server diff --git a/templates/apt/db02_apt.list b/templates/apt/db02_apt.list index eb9f043..53a3eda 100644 --- a/templates/apt/db02_apt.list +++ b/templates/apt/db02_apt.list @@ -1 +1 @@ -ntp make gdebi-core +ntp make gdebi-core nfs-common postgresql-plperl-9.1 nagios-nrpe-server diff --git a/templates/apt/db03_apt.list b/templates/apt/db03_apt.list index eb9f043..53a3eda 100644 --- a/templates/apt/db03_apt.list +++ b/templates/apt/db03_apt.list @@ -1 +1 @@ -ntp make gdebi-core +ntp make gdebi-core nfs-common postgresql-plperl-9.1 nagios-nrpe-server diff --git a/templates/apt/drone_apt.list b/templates/apt/drone_apt.list index bb6b11a..faf4f60 100644 --- a/templates/apt/drone_apt.list +++ b/templates/apt/drone_apt.list @@ -1 +1 @@ -ntp gdebi-core +ntp gdebi-core nagios-nrpe-server diff --git a/templates/apt/head_apt.list b/templates/apt/head_apt.list index de6f3c1..909752a 100644 --- a/templates/apt/head_apt.list +++ b/templates/apt/head_apt.list @@ -1 +1 @@ -ntp apache2 nfs-kernel-server gdebi-core +ntp apache2 nfs-kernel-server gdebi-core nagios-nrpe-server diff --git a/templates/apt/lvs01_apt.list b/templates/apt/lvs01_apt.list index 5e5d2cb..506bd15 100644 --- a/templates/apt/lvs01_apt.list +++ b/templates/apt/lvs01_apt.list @@ -1 +1 @@ -ldirectord bind9 ntp postfix gdebi-core heartbeat +bind9 ntp postfix gdebi-core heartbeat apache2 openssl nagios-nrpe-server diff --git a/templates/apt/lvs02_apt.list b/templates/apt/lvs02_apt.list index 5e5d2cb..506bd15 100644 --- a/templates/apt/lvs02_apt.list +++ b/templates/apt/lvs02_apt.list @@ -1 +1 @@ -ldirectord bind9 ntp postfix gdebi-core heartbeat +bind9 ntp postfix gdebi-core heartbeat apache2 openssl nagios-nrpe-server diff --git a/templates/apt/memcache01_apt.list b/templates/apt/memcache01_apt.list index 8b4f5a2..71fcb5b 100644 --- a/templates/apt/memcache01_apt.list +++ b/templates/apt/memcache01_apt.list @@ -1 +1 @@ -ntp memcached gdebi-core +ntp memcached gdebi-core nagios-nrpe-server diff --git a/templates/apt/memcache02_apt.list b/templates/apt/memcache02_apt.list index 8b4f5a2..71fcb5b 100644 --- a/templates/apt/memcache02_apt.list +++ b/templates/apt/memcache02_apt.list @@ -1 +1 @@ -ntp memcached gdebi-core +ntp memcached gdebi-core nagios-nrpe-server diff --git a/templates/apt/reporter01_apt.list b/templates/apt/reporter01_apt.list index 9300184..baff3a8 100644 --- a/templates/apt/reporter01_apt.list +++ b/templates/apt/reporter01_apt.list @@ -1 +1 @@ -ntp gdebi-core nfs-kernel-server +ntp gdebi-core nfs-kernel-server nagios-nrpe-server diff --git a/templates/apt/sip01_apt.list b/templates/apt/sip01_apt.list index de6f3c1..909752a 100644 --- a/templates/apt/sip01_apt.list +++ b/templates/apt/sip01_apt.list @@ -1 +1 @@ -ntp apache2 nfs-kernel-server gdebi-core +ntp apache2 nfs-kernel-server gdebi-core nagios-nrpe-server diff --git a/templates/apt/sip02_apt.list b/templates/apt/sip02_apt.list index de6f3c1..909752a 100644 --- a/templates/apt/sip02_apt.list +++ b/templates/apt/sip02_apt.list @@ -1 +1 @@ -ntp apache2 nfs-kernel-server gdebi-core +ntp apache2 nfs-kernel-server gdebi-core nagios-nrpe-server diff --git a/templates/apt/utility01_apt.list b/templates/apt/utility01_apt.list index de6f3c1..909752a 100644 --- a/templates/apt/utility01_apt.list +++ b/templates/apt/utility01_apt.list @@ -1 +1 @@ -ntp apache2 nfs-kernel-server gdebi-core +ntp apache2 nfs-kernel-server gdebi-core nagios-nrpe-server diff --git a/templates/debs/evergreen-ils_2.3.1_amd64.deb b/templates/debs/evergreen-ils_2.3.1_amd64.deb deleted file mode 100644 index 425b773..0000000 Binary files a/templates/debs/evergreen-ils_2.3.1_amd64.deb and /dev/null differ diff --git a/templates/debs/evergreen-ils_2.3.5_amd64.deb b/templates/debs/evergreen-ils_2.3.5_amd64.deb new file mode 100644 index 0000000..bf7d1af Binary files /dev/null and b/templates/debs/evergreen-ils_2.3.5_amd64.deb differ diff --git a/templates/debs/opensrf_2.1.1_amd64.deb b/templates/debs/opensrf_2.1.1_amd64.deb deleted file mode 100644 index c19f61a..0000000 Binary files a/templates/debs/opensrf_2.1.1_amd64.deb and /dev/null differ diff --git a/templates/debs/opensrf_2.1.2_amd64.deb b/templates/debs/opensrf_2.1.2_amd64.deb new file mode 100644 index 0000000..27cbe2f Binary files /dev/null and b/templates/debs/opensrf_2.1.2_amd64.deb differ diff --git a/templates/eg_fstab_reporter b/templates/eg_fstab_reporter new file mode 100644 index 0000000..f80611f --- /dev/null +++ b/templates/eg_fstab_reporter @@ -0,0 +1,2 @@ +## NFS Mounts for Evergreen. +REPORTER_OUTPUT_NFS_HOST_IP:/storage/reports-output /openils/var/web/reporter/ nfs rw 0 0 diff --git a/templates/interfaces b/templates/interfaces index 63784de..22f039b 100644 --- a/templates/interfaces +++ b/templates/interfaces @@ -12,5 +12,5 @@ iface eth0 inet static netmask 255.255.255.0 gateway Priv_NET.1 # dns-* options are implemented by the resolvconf package, if installed - dns-nameservers Cluster_Private_IP LVS01_Private_IP LVS02_Private_IP + dns-nameservers LVS01_Private_IP LVS02_Private_IP dns-search CLUSTER_DOMAINNAME diff --git a/templates/logger/archive.sh b/templates/logger/archive.sh deleted file mode 100644 index 87dce1e..0000000 --- a/templates/logger/archive.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -goback=$1 -host="10.0.1.81" -host="$HOSTNAME" -remote="off" # [on/off] - -[ -z "$goback" ] && goback=1; - -month=$(date --date="$goback day ago" +"%m"); -year=$(date --date="$goback day ago" +"%Y"); -day=$(date --date="$goback day ago" +"%d"); - -[ ${#month} == 1 ] && month="0$month"; -[ ${#day} == 1 ] && day="0$day"; - - -function arch { - #type=$1 - #dir="/var/log/evergreen/$type/$year/$month/$day"; - dir="/var/log/evergreen/$year/$month/$day"; - cd $dir; - echo "Archiving files in $dir"; - - # make sure the directory exists on the backup host - su - opensrf -c "ssh $host 'mkdir -m770 -p $dir'" - - for i in *; do - echo "Archiving $i"; - pigz -p3 "$i"; - #chgrp opensrf "$dir/$i.gz"; # why is this needed? - chmod 640 "$dir/$i.gz"; - if [ "$remote" = "on" ]; then - # make sure the directory exists on the backup host - su - opensrf -c "ssh $host 'mkdir -m770 -p $dir'" - echo "Sending $dir/$i.gz to $host..." - su - opensrf -c "scp $dir/$i.gz $host:$dir/" - fi - done; -} - -#for type in 'demo' 'dev' 'prod'; do -#for type in 'prod'; do - arch # "$type"; -#done; diff --git a/templates/lvs/ha.cf b/templates/lvs/ha.cf index c09b41b..5245a52 100644 --- a/templates/lvs/ha.cf +++ b/templates/lvs/ha.cf @@ -6,6 +6,6 @@ initdead 10 baud 19200 serial /dev/ttyS1 auto_failback on -node lvs01 -node lvs02 +node FIRST_LVS_SERVER +node SECOND_LVS_SERVER diff --git a/templates/lvs/haresources b/templates/lvs/haresources index 7e0a9e8..20ee583 100644 --- a/templates/lvs/haresources +++ b/templates/lvs/haresources @@ -1 +1 @@ -lvs01 IPaddr::ClusterPublic_IP/ClusterPublic_CIDR/eth0/ClusterPublic_Bcast IPaddr::Lvs01Private_Shared_IP/24/eth1/lvs01Private_Net.255 +FIRST_LVS IPaddr::ClusterPublic_IP/ClusterPublic_CIDR/eth1/ClusterPublic_Bcast IPaddr::Lvs01Private_Shared_IP/24/eth0/lvs01Private_Net.255 diff --git a/templates/lvs/interfaces b/templates/lvs/interfaces index b5ca452..cc51e18 100644 --- a/templates/lvs/interfaces +++ b/templates/lvs/interfaces @@ -13,10 +13,10 @@ iface eth1 inet static netmask Pub_NETMASK gateway Pub_GATEWAY # dns-* options are implemented by the resolvconf package, if installed - dns-nameservers Cluster_Private_IP LVS01_Private_IP LVS02_Private_IP + dns-nameservers 127.0.0.1 LVS01_Private_IP LVS02_Private_IP dns-search CLUSTER_DOMAINNAME -auto eth1:0 +#auto eth1:0 iface eth1:0 inet static name LVS Public Shared Address address Cluster_Public_IP @@ -30,7 +30,7 @@ iface eth0 inet static address Priv_Physical_Address netmask 255.255.255.0 -auto eth0:0 +#auto eth0:0 iface eth0:0 inet static name LVS Private Shared Address address Priv_NET.1 diff --git a/templates/lvs/iptables-rules.fw b/templates/lvs/iptables-rules.fw index ebaf121..8b9f6ec 100755 --- a/templates/lvs/iptables-rules.fw +++ b/templates/lvs/iptables-rules.fw @@ -7,10 +7,10 @@ ## to add more rules see rules section below. ### What is the external interface? eg. eth0 -EXTERNAL_IF="eth0" +EXTERNAL_IF="eth1" ### What is the internal interface? eg eth1, eth0:1 -INTERNAL_IF="eth1" +INTERNAL_IF="eth0" ### What is the private network address? eg. Priv_NET.0/24 PRIVATE_NET="Priv_NET.0/24" diff --git a/templates/lvs/ldirectord-ssl-noverify_3.9.2-5ubuntu4_all.deb b/templates/lvs/ldirectord-ssl-noverify_3.9.2-5ubuntu4_all.deb new file mode 100644 index 0000000..b7c4493 Binary files /dev/null and b/templates/lvs/ldirectord-ssl-noverify_3.9.2-5ubuntu4_all.deb differ diff --git a/templates/lvs/ldirectord.cf-footer b/templates/lvs/ldirectord.cf-footer index 1c4414e..2c7718d 100644 --- a/templates/lvs/ldirectord.cf-footer +++ b/templates/lvs/ldirectord.cf-footer @@ -1,4 +1,4 @@ - fallback=Priv_NET.131:80 masq + fallback=127.0.0.1:80 gate service=http request="ldirectorping.txt" receive="pong" diff --git a/templates/opensrf-rsyslog.conf b/templates/opensrf-rsyslog.conf deleted file mode 100644 index 3f66597..0000000 --- a/templates/opensrf-rsyslog.conf +++ /dev/null @@ -1,60 +0,0 @@ -# OpenSRF rsyslog configuration file -# Bill Erickson -# -# /etc/rsyslog.d/opensrf-rsyslog.conf - -# Message format templates -# TIMESTAMP:::date-pgsql == YYYY-MM-DD HH:MM:SS -$template msgformat,"%TIMESTAMP:::date-pgsql% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n" - -# Log file templates ------- -$template osrfsys,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrfsys.%$HOUR%.log" -$template osrferror,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrferror.log" -$template osrfwarn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrfwarn.log" -$template activity,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/activity.log" -$template gateway,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/gateway.%$HOUR%.log" -$template router,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/router.log" -$template pg,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/pg.%$HOUR%.log" -$template ap_access,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_access.%$HOUR%.log" -$template ap_warn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_error.%$HOUR%.log" -$template ap_error,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_error.%$HOUR%.log" -$template maillog,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_info.%$HOUR%.log" -$template mail_info,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_info.%$HOUR%.log" -$template mail_warn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_warn.%$HOUR%.log" -$template mail_error,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_error.%$HOUR%.log" - -# Selectors ---------------- -# local0 : OpenSRF -# local1 : OpenSRF "activity" -# local2 : OpenSRF router -# local3 : PostgreSQL -# local6 : Gateway -# local7 : Apache -# mail : Mail - -local0.* ?osrfsys;msgformat -local1.* ?activity;msgformat -local2.* ?router;msgformat -local3.* ?pg;msgformat -local6.* ?gateway;msgformat -local7.* ?ap_access;msgformat -mail.* ?maillog;msgformat -mail.info ?mail_info;msgformat - -# Warn -local0.warn ?osrfwarn;msgformat -local1.warn ?osrfwarn;msgformat -local2.warn ?osrfwarn;msgformat -local3.warn ?osrfwarn;msgformat -local6.warn ?osrfwarn;msgformat -local7.warn ?ap_warn;msgformat -mail.warn ?mail_warn;msgformat - -# Error -local0.error ?osrferror;msgformat -local1.error ?osrferror;msgformat -local2.error ?osrferror;msgformat -local3.error ?osrferror;msgformat -local6.error ?osrferror;msgformat -local7.error ?ap_error;msgformat -mail.err ?mail_error;msgformat diff --git a/templates/opensrf.xml/opensrf.xml-header b/templates/opensrf.xml/opensrf.xml-header index 38a94c2..afdd5bd 100644 --- a/templates/opensrf.xml/opensrf.xml-header +++ b/templates/opensrf.xml/opensrf.xml-header @@ -238,13 +238,13 @@ vim:et:ts=4:sw=4: 15 - MY_USER_ID + MODULE_USER_ID - + router - public.localhost + public.Brick_head_Fqdn opensrf.math open-ils.actor open-ils.acq open-ils.auth - open-ils.auth_proxy open-ils.booking open-ils.cat open-ils.circ @@ -31,7 +30,6 @@ Example OpenSRF bootstrap configuration file for Evergreen open-ils.pcrud open-ils.permacrud open-ils.reporter - open-ils.resolver open-ils.search open-ils.supercat open-ils.vandelay @@ -45,12 +43,12 @@ Example OpenSRF bootstrap configuration file for Evergreen this router, so no explicit section is required --> router - private.localhost + private.Brick_head_Fqdn - private.localhost + private.Brick_head_Fqdn opensrf OpenSRF_Password 5222 @@ -61,12 +59,12 @@ Example OpenSRF bootstrap configuration file for Evergreen --> router - /openils/var/log/osrfsys.log - + syslog local0 local1 - --> + 3 /openils/conf/opensrf.xml @@ -79,7 +77,7 @@ Example OpenSRF bootstrap configuration file for Evergreen router - public.localhost + public.Brick_head_Fqdn @@ -90,7 +88,6 @@ Example OpenSRF bootstrap configuration file for Evergreen open-ils.circ open-ils.actor open-ils.auth - open-ils.auth_proxy open-ils.collections open-ils.reporter @@ -100,12 +97,12 @@ Example OpenSRF bootstrap configuration file for Evergreen OpenSRF_Password 5222 3 - /openils/var/log/gateway.log - + syslog local6 local1 - --> + @@ -116,18 +113,18 @@ Example OpenSRF bootstrap configuration file for Evergreen Allow private services to register with this router and public client to send requests to this router. --> - private.localhost + private.Brick_head_Fqdn - private.localhost - public.localhost + private.Brick_head_Fqdn + public.Brick_head_Fqdn - public.localhost + public.Brick_head_Fqdn 5222 /openils/var/sock/unix_sock router @@ -136,24 +133,24 @@ Example OpenSRF bootstrap configuration file for Evergreen 10 5 - /openils/var/log/router-public.log - + syslog local2 - --> + 2 - private.localhost + private.Brick_head_Fqdn - private.localhost + private.Brick_head_Fqdn - private.localhost + private.Brick_head_Fqdn 5222 router OpenSRF_Password @@ -161,13 +158,31 @@ Example OpenSRF bootstrap configuration file for Evergreen 10 5 - /openils/var/log/router-private.log - + syslog local2 - --> + 2 + + + + + open-ils.auth.authenticate.verify + open-ils.auth.authenticate.complete + open-ils.auth_proxy.login + open-ils.actor.user.password + open-ils.actor.user.username + open-ils.actor.user.email + open-ils.actor.patron.update + open-ils.cstore.direct.actor.user.create + open-ils.cstore.direct.actor.user.update + open-ils.cstore.direct.actor.user.delete + + diff --git a/templates/rsyslog.conf b/templates/rsyslog.conf deleted file mode 100644 index 0c88790..0000000 --- a/templates/rsyslog.conf +++ /dev/null @@ -1,136 +0,0 @@ -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging -$ModLoad imklog # provides kernel logging support (previously done by rklogd) -#$ModLoad immark # provides --MARK-- message capability - -# provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 - -# provides TCP syslog reception -#$ModLoad imtcp -#$InputTCPServerRun 514 - - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# -# Use traditional timestamp format. -# To enable high precision timestamps, comment out the following line. -# -$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat - -# -# Set the default permissions for all log files. -# -$FileOwner root -$FileGroup adm -$FileCreateMode 0640 -$DirCreateMode 0755 -$Umask 0022 - -# -# Include all config files in /etc/rsyslog.d/ -# -$IncludeConfig /etc/rsyslog.d/*.conf - - -############### -#### RULES #### -############### - -# -# First some standard log files. Log by facility. -# -auth,authpriv.* /var/log/auth.log -#*.*;auth,authpriv.none -/var/log/syslog - -###> disable logging of local.x used by Evergreen to /var/log/syslog. -*.*;\ - local0,local1.none;\ - local2,local3.none;\ - local6,local7.none;\ - auth,authpriv.none -/var/log/syslog - -#cron.* /var/log/cron.log -daemon.* -/var/log/daemon.log -kern.* -/var/log/kern.log -lpr.* -/var/log/lpr.log -#mail.* -/var/log/mail.log -user.* -/var/log/user.log - -# -# Logging for the mail system. Split it up so that -# it is easy to write scripts to parse these files. -# -#mail.info -/var/log/mail.info -#mail.warn -/var/log/mail.warn -#mail.err /var/log/mail.err - -# -# Logging for INN news system. -# -news.crit /var/log/news/news.crit -news.err /var/log/news/news.err -news.notice -/var/log/news/news.notice - -# -# Some "catch-all" log files. -# -*.=debug;\ - auth,authpriv.none;\ - news.none;mail.none -/var/log/debug - -#*.=info;*.=notice;*.=warn;\ -# auth,authpriv.none;\ -# cron,daemon.none;\ -# mail,news.none -/var/log/messages - -###> disable logging of local.x used by Evergreen to /var/log/messages -*.=info;*.=notice;*.=warn;\ - auth,authpriv.none;\ - cron,daemon.none;\ - local0,local1.none;\ - local2,local3.none;\ - local6,local7.none;\ - mail,news.none -/var/log/messages - -# -# Emergencies are sent to everybody logged in. -# -*.emerg * - -# -# I like to have messages displayed on the console, but only on a virtual -# console I usually leave idle. -# -#daemon,mail.*;\ -# news.=crit;news.=err;news.=notice;\ -# *.=debug;*.=info;\ -# *.=notice;*.=warn /dev/tty8 - -# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, -# you must invoke `xconsole' with the `-file' option: -# -# $ xconsole -file /dev/xconsole [...] -# -# NOTE: adjust the list below, or you'll go crazy if you have a reasonably -# busy site.. -# -daemon.*;mail.*;\ - news.err;\ - *.=debug;*.=info;\ - *.=notice;*.=warn |/dev/xconsole - - diff --git a/templates/rsyslog/50-default.conf b/templates/rsyslog/50-default.conf new file mode 100644 index 0000000..2cd6c4d --- /dev/null +++ b/templates/rsyslog/50-default.conf @@ -0,0 +1,76 @@ +# Default rules for rsyslog. +# +# For more information see rsyslog.conf(5) and /etc/rsyslog.conf + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +#*.*;auth,authpriv.none -/var/log/syslog +*.*;\ + local0,local1.none;\ + local2,local3.none;\ + local6,local7.none;\ + auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +#daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +#lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +#user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +#mail.info -/var/log/mail.info +#mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Logging for INN news system. +# +news.crit /var/log/news/news.crit +news.err /var/log/news/news.err +news.notice -/var/log/news/news.notice + +# +# Some "catch-all" log files. +# +#*.=debug;\ +# auth,authpriv.none;\ +# news.none;mail.none -/var/log/debug +#*.=info;*.=notice;*.=warn;\ +# auth,authpriv.none;\ +# cron,daemon.none;\ +# mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg :omusrmsg:* + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole + + 1,1 Top + diff --git a/templates/rsyslog/60-evergreen-ils.conf b/templates/rsyslog/60-evergreen-ils.conf new file mode 100644 index 0000000..9850d18 --- /dev/null +++ b/templates/rsyslog/60-evergreen-ils.conf @@ -0,0 +1,9 @@ + + +## Evergreen logger configuration +local0.* @@LoggerHostName.CLUSTER_DOMAINNAME:514 +local1.* @@LoggerHostName.CLUSTER_DOMAINNAME:514 +local2.* @@LoggerHostName.CLUSTER_DOMAINNAME:514 +local3.* @@LoggerHostName.CLUSTER_DOMAINNAME:514 +local6.* @@LoggerHostName.CLUSTER_DOMAINNAME:514 +local7.* @@LoggerHostName.CLUSTER_DOMAINNAME:514 diff --git a/templates/rsyslog/archive.sh b/templates/rsyslog/archive.sh new file mode 100644 index 0000000..87dce1e --- /dev/null +++ b/templates/rsyslog/archive.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +goback=$1 +host="10.0.1.81" +host="$HOSTNAME" +remote="off" # [on/off] + +[ -z "$goback" ] && goback=1; + +month=$(date --date="$goback day ago" +"%m"); +year=$(date --date="$goback day ago" +"%Y"); +day=$(date --date="$goback day ago" +"%d"); + +[ ${#month} == 1 ] && month="0$month"; +[ ${#day} == 1 ] && day="0$day"; + + +function arch { + #type=$1 + #dir="/var/log/evergreen/$type/$year/$month/$day"; + dir="/var/log/evergreen/$year/$month/$day"; + cd $dir; + echo "Archiving files in $dir"; + + # make sure the directory exists on the backup host + su - opensrf -c "ssh $host 'mkdir -m770 -p $dir'" + + for i in *; do + echo "Archiving $i"; + pigz -p3 "$i"; + #chgrp opensrf "$dir/$i.gz"; # why is this needed? + chmod 640 "$dir/$i.gz"; + if [ "$remote" = "on" ]; then + # make sure the directory exists on the backup host + su - opensrf -c "ssh $host 'mkdir -m770 -p $dir'" + echo "Sending $dir/$i.gz to $host..." + su - opensrf -c "scp $dir/$i.gz $host:$dir/" + fi + done; +} + +#for type in 'demo' 'dev' 'prod'; do +#for type in 'prod'; do + arch # "$type"; +#done; diff --git a/templates/rsyslog/opensrf-rsyslog.conf b/templates/rsyslog/opensrf-rsyslog.conf new file mode 100644 index 0000000..3f66597 --- /dev/null +++ b/templates/rsyslog/opensrf-rsyslog.conf @@ -0,0 +1,60 @@ +# OpenSRF rsyslog configuration file +# Bill Erickson +# +# /etc/rsyslog.d/opensrf-rsyslog.conf + +# Message format templates +# TIMESTAMP:::date-pgsql == YYYY-MM-DD HH:MM:SS +$template msgformat,"%TIMESTAMP:::date-pgsql% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n" + +# Log file templates ------- +$template osrfsys,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrfsys.%$HOUR%.log" +$template osrferror,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrferror.log" +$template osrfwarn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrfwarn.log" +$template activity,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/activity.log" +$template gateway,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/gateway.%$HOUR%.log" +$template router,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/router.log" +$template pg,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/pg.%$HOUR%.log" +$template ap_access,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_access.%$HOUR%.log" +$template ap_warn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_error.%$HOUR%.log" +$template ap_error,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_error.%$HOUR%.log" +$template maillog,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_info.%$HOUR%.log" +$template mail_info,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_info.%$HOUR%.log" +$template mail_warn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_warn.%$HOUR%.log" +$template mail_error,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/mail_error.%$HOUR%.log" + +# Selectors ---------------- +# local0 : OpenSRF +# local1 : OpenSRF "activity" +# local2 : OpenSRF router +# local3 : PostgreSQL +# local6 : Gateway +# local7 : Apache +# mail : Mail + +local0.* ?osrfsys;msgformat +local1.* ?activity;msgformat +local2.* ?router;msgformat +local3.* ?pg;msgformat +local6.* ?gateway;msgformat +local7.* ?ap_access;msgformat +mail.* ?maillog;msgformat +mail.info ?mail_info;msgformat + +# Warn +local0.warn ?osrfwarn;msgformat +local1.warn ?osrfwarn;msgformat +local2.warn ?osrfwarn;msgformat +local3.warn ?osrfwarn;msgformat +local6.warn ?osrfwarn;msgformat +local7.warn ?ap_warn;msgformat +mail.warn ?mail_warn;msgformat + +# Error +local0.error ?osrferror;msgformat +local1.error ?osrferror;msgformat +local2.error ?osrferror;msgformat +local3.error ?osrferror;msgformat +local6.error ?osrferror;msgformat +local7.error ?ap_error;msgformat +mail.err ?mail_error;msgformat diff --git a/templates/rsyslog/rsyslog.conf-debian6 b/templates/rsyslog/rsyslog.conf-debian6 new file mode 100644 index 0000000..bcebbdf --- /dev/null +++ b/templates/rsyslog/rsyslog.conf-debian6 @@ -0,0 +1,136 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +$ModLoad imklog # provides kernel logging support (previously done by rklogd) +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +$ModLoad imudp +$UDPServerRun 514 + +# provides TCP syslog reception +$ModLoad imtcp +$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +#*.*;auth,authpriv.none -/var/log/syslog + +###> disable logging of local.x used by Evergreen to /var/log/syslog. +*.*;\ + local0,local1.none;\ + local2,local3.none;\ + local6,local7.none;\ + auth,authpriv.none -/var/log/syslog + +#cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +lpr.* -/var/log/lpr.log +#mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +#mail.info -/var/log/mail.info +#mail.warn -/var/log/mail.warn +#mail.err /var/log/mail.err + +# +# Logging for INN news system. +# +news.crit /var/log/news/news.crit +news.err /var/log/news/news.err +news.notice -/var/log/news/news.notice + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + news.none;mail.none -/var/log/debug + +#*.=info;*.=notice;*.=warn;\ +# auth,authpriv.none;\ +# cron,daemon.none;\ +# mail,news.none -/var/log/messages + +###> disable logging of local.x used by Evergreen to /var/log/messages +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + local0,local1.none;\ + local2,local3.none;\ + local6,local7.none;\ + mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg * + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole + + diff --git a/templates/rsyslog/rsyslog.conf-logger b/templates/rsyslog/rsyslog.conf-logger new file mode 100644 index 0000000..10ed5cf --- /dev/null +++ b/templates/rsyslog/rsyslog.conf-logger @@ -0,0 +1,59 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html +# +# Default logging rules can be found in /etc/rsyslog.d/50-default.conf + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +$ModLoad imklog # provides kernel logging support (previously done by rklogd) +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +$ModLoad imudp +$UDPServerRun 514 + +# provides TCP syslog reception +$ModLoad imtcp +$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Filter duplicated messages +$RepeatedMsgReduction on + +# +# Set the default permissions for all log files. +# +$FileOwner syslog +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 +#$PrivDropToUser syslog +#$PrivDropToGroup adm + +# +# Where to place spool files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + diff --git a/templates/setup-functions b/templates/setup-functions index c219a7b..8aee115 100644 --- a/templates/setup-functions +++ b/templates/setup-functions @@ -37,11 +37,18 @@ rm debconf-settings && \ cd debs && \ if apt-get update then - gdebi --n opensrf*.deb + # gdebi --n opensrf*.deb + echo + echo "Installing Dependencies for Evergreen:";sleep 2 gdebi --n spidermonkey_*.deb gdebi --n spidermonkey-perl*.deb gdebi --n libclass-dbi*.deb gdebi --n libtemplate-plugin-posix-perl*.deb + echo + echo "Installing Opensrf:";sleep 2 + gdebi --n opensrf*.deb + echo + echo "Installing Evergreen ILS:";sleep 2 gdebi --n evergreen-ils*.deb fi cd .. @@ -57,9 +64,24 @@ PG_Deps_Warning () { ### Dependency install error message sleep 5 } -GenSSL() { ### Generate SSL cert. +GenSSL () { ### Generate SSL cert. mkdir -p /etc/apache2/ssl cd /etc/apache2/ssl openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key cd $WD } + +Config_Apache2_Default_SSL () { ### configure Apache2 default-ssl vhost for our certs. +if [ -e etc/apache2/sites-available/default-ssl ] +then + sed -i 's^SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem^SSLCertificateFile ssl/server.crt^g' /etc/apache2/sites-available/default-ssl + sed -i 's^SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key^SSLCertificateFile ssl/server.key^g' /etc/apache2/sites-available/default-ssl + [ -e /etc/apache2/ssl/ca.crt ] && sed -i '/SSLCertificateKeyFile/ a\ \tSSLCACertificateFile ssl/ca.crt' /etc/apache2/sites-available/default-ssl #insert after match. +else + echo;echo "/etc/apache2/sites-available/default-ssl not found.." + echo "Cannot configure Apache2 default-ssl vhost for your SSL" + echo "certificates in /etc/apache2/sites-available/default-ssl" + echo "You will have to do this manually." + read -p "Press [Enter] to continue." +fi +} diff --git a/templates/setup-head.sh b/templates/setup-head.sh index 4ff2d1e..ed5cc04 100755 --- a/templates/setup-head.sh +++ b/templates/setup-head.sh @@ -26,8 +26,8 @@ fi Prep_DB_9_X () { #Prepare the database schema -eg_db_config.pl --service all --create-schema --create-offline \ - --user EG_DB_USER --password EG_DB_PASSWORD --hostname db01.CLUSTER_DOMAINNAME --port 5432 \ +/openils/bin/eg_db_config.pl --service all --create-schema --create-offline --create-database \ + --user EG_DB_USER --password EG_DB_PASSWORD --hostname MASTER_DB.CLUSTER_DOMAINNAME --port 5432 \ --database evergreen --admin-user EG_ADMIN_USER --admin-pass EG_ADMIN_PASS } @@ -74,7 +74,7 @@ echo echo $(date) >> "$INSTALL_LOG" THISHOST="head_file" -if [ "$THISHOST" = "brick01-head" ] +if echo "$THISHOST" | grep -q "brick01-head" then echo echo "WARNING ** You are setting up the first brick head of the cluster" @@ -104,38 +104,6 @@ if grep -q 'Debian GNU/Linux 6' /etc/issue echo "deb http://backports.debian.org/debian-backports squeeze-backports main contrib" > /etc/apt/sources.list.d/backports.list;PKG_SET=$? fi -### Enhance bashrc for root. -cat > bashrc-options.txt << EOF - -### Evergreen Modifications -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -export LS_OPTIONS='--color=auto' -eval "`dircolors`" -alias ls='ls $LS_OPTIONS' -alias ll='ls $LS_OPTIONS -l' -alias l='ls $LS_OPTIONS -lA' - -### -EOF - -if ! grep -q "Evergreen Modifications" /root/.bashrc - then - if [ "$OSDISTRO" == "Debian" ] - then - cat bashrc-options.txt >> /root/.bashrc - fi -fi - -echo -e "alias detach='su - -c \"brick_ctl.sh -a detach_brick\" opensrf'" >> /root/.bashrc -echo -e "alias attach='su - -c \"brick_ctl.sh -a attach_brick\" opensrf'" >> /root/.bashrc - ### Install dependencies. if [ -e head_file_apt.list ] @@ -251,12 +219,12 @@ if cat /etc/hostname|grep -q brick01-head echo "Configuring database for Evergreen" echo sleep 2 - if ! ping -c2 db01.CLUSTER_DOMAINNAME + if ! ping -c2 MASTER_DB.CLUSTER_DOMAINNAME then echo echo "WARNING. Do not continue until db is up..." echo - echo "Cannot ping db01.CLUSTER_DOMAINNAME" + echo "Cannot ping MASTER_DB.CLUSTER_DOMAINNAME" echo "Is the database server running?" echo "Make sure the db server is configured with" echo "the db setup script, rebooted, and running" @@ -265,7 +233,7 @@ if cat /etc/hostname|grep -q brick01-head Prep_DB_9_X else echo - echo "Found db server db01.CLUSTER_DOMAINNAME" + echo "Found db server MASTER_DB.CLUSTER_DOMAINNAME" chown -R opensrf:opensrf /openils Prep_DB_9_X fi @@ -342,6 +310,40 @@ sleep 1 /etc/init.d/opensrf restart } +### Enhance bashrc for root. +cat > bashrc-options.txt << EOF + +### Evergreen Modifications +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +export LS_OPTIONS='--color=auto' +eval "`dircolors`" +alias ls='ls $LS_OPTIONS' +alias ll='ls $LS_OPTIONS -l' +alias l='ls $LS_OPTIONS -lA' + +### +EOF + +if ! grep -q "Evergreen Modifications" /root/.bashrc + then + if [ "$OSDISTRO" == "Debian" ] + then + cat bashrc-options.txt >> /root/.bashrc + fi +fi + + +echo -e "alias detach='su - -c \"brick_ctl.sh -a detach_brick\" opensrf'" >> /root/.bashrc +echo -e "alias attach='su - -c \"brick_ctl.sh -a attach_brick\" opensrf'" >> /root/.bashrc +echo 'PS1="\[\033[1;33m\]\`if [[ -e /openils/var/web/ldirectorping.txt ]]; then echo "\\[\\033[32m\\]\[Attached\]\\[\\033[0m\\]"; else echo "\\[\\033[31m\\]\[Detached\]\\[\\033[0m\\]"; fi\`\u@\h:\w\\$ "'>> /root/.bashrc +echo 'PS1="\[\033[1;33m\]\`if [[ -e /openils/var/web/ldirectorping.txt ]]; then echo "\\[\\033[32m\\]\[Attached\]\\[\\033[0m\\]"; else echo "\\[\\033[31m\\]\[Detached\]\\[\\033[0m\\]"; fi\`\u@\h:\w\\$ "' >> /home/opensrf/.bashrc echo echo diff --git a/templates/setup-vars b/templates/setup-vars index 48b1fbb..2b91864 100644 --- a/templates/setup-vars +++ b/templates/setup-vars @@ -26,9 +26,7 @@ COL_BR_CYAN=$ESC_SEQ"1;36m" ### Set install log INSTALL_LOG="/var/log/genasys_install.log" -#Get_OS_Distro () { OSDISTRO=$(cat /etc/issue|head -1|awk '{ print $1 }') -#} #Get_OS_Distro if [ "$OSDISTRO" == "Debian" ] @@ -43,3 +41,7 @@ if [ "$(id -u)" != "0" ] ### Check if we are root. echo "You must be root to setup Evergreen $EG_VER" exit 1 fi + + +### Postgres user UID is sycronized for NFS +PG_UID="499" diff --git a/templates/setup.sh b/templates/setup.sh old mode 100755 new mode 100644 index f5a3943..afd36ca --- a/templates/setup.sh +++ b/templates/setup.sh @@ -173,6 +173,13 @@ if [ -e tar_file_apt.list ] then echo "Installing Dependencies" sleep 2 + if cat /etc/hostname|grep -q db0 + then + if ! getent passwd postgres > /dev/null; then + adduser --system --quiet --home /var/lib/postgresql --no-create-home \ + --shell /bin/bash --group --gecos "PostgreSQL administrator" --uid "$PG_UID" postgres + fi + fi apt-get update 2>&1 | tee -a $INSTALL_LOG apt-get -y install $(cat tar_file_apt.list) 2>&1 | tee -a "$INSTALL_LOG" fi @@ -215,6 +222,23 @@ fi ### Setup LVS servers if cat /etc/hostname|grep -q lvs0; then echo "Setting up lvs servers" + +### Install the custom ldirector package that works around broken SSL +LDIRECTOR_CUSTOM_DEB="ldirectord-ssl-noverify_3.9.2-5ubuntu4_all.deb" + if [ -e ldirectord*.deb ] + then + echo + echo "Installing ldirectord-ssl-noverify....." + sleep 2 + gdebi --n ldirectord*.deb + else + echo + echo "ldirector-ssl-no-verify not found" + echo "installing standard ldirector from repos..." + read -p "Press [Enter] to continue" CONT + apt-get install ldirectord + fi + echo "CONFIG_FILE=/etc/ha.d/ldirectord.cf" >> /etc/default/ldirectord cat > named_options.txt << EOF @@ -225,43 +249,44 @@ category edns-disabled { null; }; EOF cat named_options.txt >> /etc/bind/named.options - + fi ConfigLogging () { ### Configure logging for the cluster. if ! cat /etc/hostname|grep -q logger +then + if [ -e /etc/rsyslog.d ] then - if ! cat /etc/rsyslog.conf|grep -q "Evergreen logger configuration" - then echo echo "Setting up logging to the logger server" sleep 2 - if ! grep -q "Evergreen logger configuration" /etc/rsyslog.conf - then - echo >> /etc/rsyslog.conf - echo "## Evergreen logger configuration" >> /etc/rsyslog.conf - echo "local0.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf - echo "local1.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf - echo "local2.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf - echo "local3.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf - echo "local6.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf - echo "local7.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf - echo "mail.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.conf + if [ ! -e /etc/rsyslog.d/60-evergreen-ils.conf ] + then + echo >> /etc/rsyslog.conf + echo "## Evergreen logger configuration" > /etc/rsyslog.d/60-evergreen-ils.conf + echo "local0.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf + echo "local1.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf + echo "local2.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf + echo "local3.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf + echo "local6.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf + echo "local7.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf + echo "mail.* @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf fi fi - else - echo - echo "Setting up logging for the cluster on this host" - sleep 2 - mkdir -p /var/log/evergreen - sed -i 's/^#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf - sed -i 's/^#$InputUDPServerRun 514/$InputUDPServerRun 514/g' /etc/rsyslog.conf - sed -i 's/^#$ModLoad imtcp/$ModLoad imtcp/g' /etc/rsyslog.conf - sed -i 's/^#$InputTCPServerRun 514/$InputTCPServerRun 514/g' /etc/rsyslog.conf - echo "alias findlogs=\"cd /var/log/evergreen/\\\$(date +%Y/%m/%d) && pwd\"" >> /root/.bashrc - echo "alias osrfwarn=\"findlogs && tail -f osrfwarn.log | grep -v 'File does not exist' | grep -v 'config.hard_due_date'\"" >> /root/.bashrc - echo "alias osrferror=\"findlogs && tail -f osrferror.log | grep -v 'File does not exist'\"" >> /root/.bashrc +else + echo + echo "Setting up logging for the cluster on this host" + sleep 2 + mkdir -p /var/log/evergreen + sed -i 's/^#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf + sed -i 's/^#$InputUDPServerRun 514/$InputUDPServerRun 514/g' /etc/rsyslog.conf + sed -i 's/^#$ModLoad imtcp/$ModLoad imtcp/g' /etc/rsyslog.conf + sed -i 's/^#$InputTCPServerRun 514/$InputTCPServerRun 514/g' /etc/rsyslog.conf + echo "alias findlogs=\"cd /var/log/evergreen/\\\$(date +%Y/%m/%d) && pwd\"" >> /root/.bashrc + echo "alias osrfwarn=\"findlogs && tail -f osrfwarn.log | grep -v 'File does not exist' | grep -v 'config.hard_due_date'\"" >> /root/.bashrc + echo "alias osrferror=\"findlogs && tail -f osrferror.log | grep -v 'File does not exist'\"" >> /root/.bashrc + rm -f /etc/rsyslog.d/60-evergreen-ils.conf fi } @@ -292,43 +317,54 @@ if cat /etc/hostname|grep -q db0 #|| cat /etc/hostname|grep -q reporter0 echo "Cannot continue... Exiting" exit 6 fi - echo "## Evergreen database settings for postgresql" > /etc/sysctl.d/evergreen_db.conf - #echo "kernel.shmmax=338788352" >> /etc/sysctl.d/evergreen_db.conf - echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/evergreen_db.conf - echo "kernel.shmall = 4194304" >> /etc/sysctl.d/evergreen_db.conf + echo "## Evergreen database settings for postgresql" > /etc/sysctl.d/evergreen_db.conf #TODO disabled for now + #echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/evergreen_db.conf #TODO disabled for now + #echo "kernel.shmall = 4194304" >> /etc/sysctl.d/evergreen_db.conf #TODO dislbed for now Install_DB_Deps - Init_DB_9 - Add_EG_DB_User - if [ -e /etc/eg_fstab_db ] - then - if ! grep -q -f /etc/eg_fstab_db /etc/fstab - then - cat /etc/eg_fstab_db >> /etc/fstab - fi - - - fi - if [ -e ./eg_db_root.crontab ] && [ -e ./eg_db_postgres.crontab ] - then - crontab -u root eg_db_root.crontab - crontab -u postgres eg_db_postgres.crontab - else - echo - echo "WARNING!! Failed to install new crontabs for tar_file" - sleep 3 - fi + sed -i "s^#listen_addresses = 'localhost'^listen_addresses = '*'^g" /etc/postgresql/9.1/main/postgresql.conf + #Init_DB_9 #TODO disabled. Now done the new way from the 1st brick head. + Add_EG_DB_User #TODO disabled same as above + + #if grep -q postgres /etc/passwd + #then + # if pgrep posgtres + # then + # POSTGRES_STATE="1" + # fi + # echo + # echo "Updating user postgres permissions" + # sleep 1 + # while pgrep "postgres" + # do + # echo + # echo stopping postgres to updated permissions + # /etc/init.d/postgres stop + # sleep 5 + # done + # if usermod -u 499 postgres + # then + # chown -R postgres:postgres /var/lib/postgresql + # [ "$POSTGRES_STATE" = "1" ] && /etc/init.d/postgres start + # else + # echo + # echo "failed to update permissions." + # fi + #fi fi fi ### Setup Memcache to use 6GB or Memory. if cat /etc/hostname|grep -q memcache0 - then +then echo echo "Configuring memcached" sleep 2 sed -i 's^-l^#-l^g' /etc/memcached.conf sed -i 's^-m 64^-m 6144^g' /etc/memcached.conf + echo + echo -e $COL_BRIGHT_RED"*** WARNING: "$COL_BRIGHT_CYAN "This Memcache server has been configured" + echo -e "for a MINimum of 8GB RAM" $COL_RESET fi ### Setup Utility @@ -355,23 +391,37 @@ EOF fi if [ -e /home/opensrf ] - then + then + chown -R opensrf:opensrf /home/opensrf echo echo "setting crontab..." echo "Please check the crontab for the user opensrf" echo "to make sure it suits your environment." sleep 2 if [ -e ./opensrf-crontab ] - then + then crontab -u opensrf opensrf-crontab echo "Warning.. If using Pines, un-comment" echo "the Pines section in the crontab" echo "for the user opensrf" - else - echo - echo "Failed to install new crontab for tar_file" - sleep 3 + else + echo + echo "Failed to install new crontab for tar_file" + sleep 3 + fi + if -e ./setup_sshkeys.sh + then + echo;echo;echo "Setting up ssh keys" + sleep 3 + ./setup_sshkeys.sh + else + echo -e COL_BR_RED"***Warning.. setup_sshkeys.sh is missing" fi + + else + echo;echo -e $COL_BR_RED"***Warning.. opensrf user does not exist" + echo -e "Not setting up crontab or ssh keys.."$COL_RESET + sleep 3 fi fi @@ -393,21 +443,61 @@ if [ "$OSRF_NODE" = "1" ] fi } + ### Extract system files echo "Installing system files" sleep 2 tar zxvf tar_file.tar.gz -C / + ConfigLogging -echo -echo "Done! This system is now configured as tar_file for evergreen $EG_VER" -echo hostname for this node is $(cat /etc/hostname) + + + +### Finish setting up the dbs +if cat /etc/hostname|grep -q db0 +then + if [ -e /etc/eg_fstab_db ] ### update fstab for backup mounts + then + if ! grep -q -f /etc/eg_fstab_db /etc/fstab + then + echo;echo -e $COL_BR_GREEN"Updating /etc/fstab"$COL_RESET + cat /etc/eg_fstab_db >> /etc/fstab + sleep 1 + else + echo;echo -e $COL_BR_GREEN"fstab already updated"$COL_RESET + sleep 3 + fi + else + echo + echo -e $COL_BR_RED"***WARNING eg_fstab_db not found" + echo -e "Could not update /etc/fstab"$COL_RESET + sleep 3 + fi + if [ -e ./eg_db_root.crontab ] && [ -e ./eg_db_postgres.crontab ] ### update crontab for archiving. + then + crontab -u root eg_db_root.crontab + crontab -u postgres eg_db_postgres.crontab + else + echo + echo $COL_BR_RED"WARNING!! Failed to install new crontabs for tar_file"$COL_RESET + sleep 3 + fi + +if [ ! -e /var/backup ] +then + mkdir -p /var/backup +fi +chown postgres:postgres /var/backup echo -echo "Please reboot this node for the changes to take effect." +echo -e $COL_BR_RED"WARNING ** Make sure you database server is optimized for Evergreen." +echo -e "Run pgtune then adjust kernel.shmmax and kernel.shmall accordingly for you hardware."$COL_RESET +sleep 4 +fi ### Setup SIP if cat /etc/hostname | grep -q "sip0" - then +then chown -R opensrf:opensrf /opt/SIPServer chown -R opensrf:opensrf /openils echo @@ -418,39 +508,75 @@ if cat /etc/hostname | grep -q "sip0" echo "See: http://docs.evergreen-ils.org/2.0/draft/html/sipserver.html" echo -e "Continue the steps from the section labled" $COL_RESET$COL_BR_GREEN"\"Configuring the Server\"" $COL_RESET if [ -e /etc/init.d/oils_sip ] - then + then update-rc.d oils_sip defaults - else - echo - echo "/etc/init.d/oils_sip not found" - echo "SIP Server will not start on boot" + else + echo + echo "/etc/init.d/oils_sip not found" + echo "SIP Server will not start on boot" fi a2dissite eg.conf && a2ensite default + if [ -e /root/eg/eg_sip_root.crontab ] + then + crontab -u root ./eg_sip_root.crontab && \ + echo;echo "SIP Server is configured to restart nightly at midnight." + else + echo + echo "Failed to install new crontab for tar_file" + sleep 3 + fi fi if cat /etc/hostname | grep -q "backup0" - then - echo "postgres:x:103:107:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash" >> /etc/passwd - echo -e $COL_BR_BLUE "NOTE ** Please verify that the user postgres" - echo -e "has write permissions to the NFS share" - echo -e "from all the DB servers." $COL_RESET +then + #echo "postgres:x:103:107:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash" >> /etc/passwd + #echo -e $COL_BR_BLUE "NOTE ** Please verify that the user postgres" + #echo -e "has write permissions to the NFS share" + #echo -e "from all the DB servers." $COL_RESET + useradd -m -s /bin/bash -u "$PG_UID" -d /var/backup postgres + chown -R postgres:postgres /var/backup fi ### Setup offline for all OpenSRF nodes. if [ "$OSRF_NODE" = "1" ] - then +then su - opensrf -c eg_db_config.pl --create-offline fi ### Display LVS Notes. if cat /etc/hostname | grep -q "lvs0" - then +then echo echo -e $COL_BR_GREEN "NOTE ** You must have a null-modem serial cable" echo -e "connected between lvs01 and lvs02 for failover" echo -e "to function correctly." $COL_RESET + ### Configure apache for lvs servers. + if [ -e "/etc/apache2/sites-available/default-ssl" ] + then + Config_Apache2_Default_SSL + a2ensite default-ssl + else + echo;echo "Apache2 not installed yet" + echo "installing Apache2..." + apt-get install apache2 openssl + Config_Apache2_Default_SSL + a2ensite default-ssl + fi fi + + + +if cat /etc/hostname | grep -q "reporter0" +then + if [ -e /etc/eg_fstab_reporter ] + then + if ! grep -q -f /etc/eg_fstab_reporter /etc/fstab + then + cat /etc/eg_fstab_reporter >> /etc/fstab + fi + fi +fi ### Enhance bashrc for root. cat > bashrc-options.txt << EOF @@ -480,4 +606,31 @@ if ! grep -q "Evergreen Modifications" /root/.bashrc fi fi +### Check if this is hosting the reports output share +### and make sure user opensrf exits and perms correct. +if [ -e /etc/eg_reports_output_host.txt ] +then + if ! grep -q "^opensrf" /etc/passwd + then + useradd -m -u 2000 -s /bin/bash opensrf + fi + chown -R opensrf:opensrf /storage/reports-output + apt-get install nfs-kernel-server +fi + +### make sure the permissions are correct. +if [ -e /openils ] +then + chown -R opensrf:opensrf /openils +fi +if [ -e /home/opensrf ] +then + chown -R opensrf:opensrf /home/opensrf +fi +echo +echo "Done! This system is now configured as tar_file for evergreen $EG_VER" +echo hostname for this node is $(cat /etc/hostname) + +echo +echo "Please reboot this node for the changes to take effect." diff --git a/templates/utility/gen_blocked_list.sh b/templates/utility/gen_blocked_list.sh index 10a6df2..8fd4c63 100755 --- a/templates/utility/gen_blocked_list.sh +++ b/templates/utility/gen_blocked_list.sh @@ -1,17 +1,18 @@ -#!/bin/bash - -. /etc/profile -cd /home/opensrf/scripts;\ + #!/bin/bash +SCRIPTDIR="/home/opensrf/eg" DATE=$(date +%Y-%m-%d); -FILE="/openils/var/data/offline/blocked/patron-blocked-list.$DATE.txt" -HOSTNAME="private.utility01.gapines.org" -HEADS="brick01-head brick02-head brick03-head brick04-head brick05-head brick06-head" +DATA_DIR="/openils/var/data/offline/blocked" +FILE="$DATA_DIR/patron-blocked-list.$DATE.txt" +OSRF_BIN_DIR="/openils/bin" +REMOTE_DIR="/openils/var/web/standalone" +HOSTNAME="private.Utility_Hostname.Domain_Name" +HEADS="Brick_Head_List" -#/openils/bin/offline-blocked-list.pl /home/opensrf/.srfsh.xml srfsh > $FILE -/openils/bin/offline-blocked-list.pl --hostname $HOSTNAME --barcodes L --barcodes B --barcodes D > $FILE +cd $SCRIPTDIR;\ +$OSRF_BIN_DIR/offline-blocked-list.pl --hostname $HOSTNAME --barcodes L --barcodes B --barcodes D > $FILE for host in $HEADS; do - scp "$FILE" "opensrf@$host:/openils/var/web/standalone/list.txt"; + scp "$FILE" "opensrf@$host:$REMOTE_DIR/list.txt"; done; diff --git a/templates/utility/ums/run-calls.pl b/templates/utility/ums/run-calls.pl new file mode 100755 index 0000000..37e6699 --- /dev/null +++ b/templates/utility/ums/run-calls.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +use strict; use warnings; +use OpenSRF::AppSession; +use OpenSRF::System; +use OpenSRF::Utils::JSON; +require '/openils/bin/oils_header.pl'; +use vars qw/$authtoken/; + +my $days_back = 15; +my $fine_limit = '4.99'; +my $method = 'open-ils.collections.users_of_interest.retrieve'; + + +die "usage: $0 " unless $ARGV[3]; +osrf_connect($ARGV[0]); +oils_login($ARGV[1], $ARGV[2]); +my $lib = $ARGV[3]; + +my $ses = OpenSRF::AppSession->create('open-ils.collections'); +my $req = $ses->request($method, $authtoken, $days_back, $fine_limit, $lib); +my @data; + +while(my $resp = $req->recv(timeout=>7200)) { + push(@data, $resp->content); +} + +open(F, ">data-$lib"); +print F OpenSRF::Utils::JSON->perl2JSON(\@data); +close(F); +