initial commit
authorroot <root@lvs01.fang.pls-hq.org>
Fri, 23 Mar 2012 18:16:17 +0000 (14:16 -0400)
committerroot <root@lvs01.fang.pls-hq.org>
Fri, 23 Mar 2012 18:16:17 +0000 (14:16 -0400)
108 files changed:
GenaSYS.sh [new file with mode: 0755]
License.txt [new file with mode: 0644]
README.txt [new file with mode: 0644]
genasys.conf-dist [new file with mode: 0644]
templates/Net-Z3950-SimpleServer-1.12.tar.gz [new file with mode: 0644]
templates/SIP/SIPServer.tar.gz [new file with mode: 0644]
templates/SIP/eg_sip_root.crontab [new file with mode: 0644]
templates/SIP/index.html [new file with mode: 0644]
templates/SIP/sip.init [new file with mode: 0755]
templates/action_trigger_filters.json [new file with mode: 0644]
templates/apache2/apache2.conf [new file with mode: 0644]
templates/apache2/eg.conf [new file with mode: 0644]
templates/apache2/eg_vhost.conf [new file with mode: 0644]
templates/apache2/startup.pl [new file with mode: 0755]
templates/apt/admin01_apt.list [new file with mode: 0644]
templates/apt/apt.list [new file with mode: 0644]
templates/apt/backup01_apt.list [new file with mode: 0644]
templates/apt/db01_apt.list [new file with mode: 0644]
templates/apt/db02_apt.list [new file with mode: 0644]
templates/apt/db03_apt.list [new file with mode: 0644]
templates/apt/drone_apt.list [new file with mode: 0644]
templates/apt/head_apt.list [new file with mode: 0644]
templates/apt/logger01_apt.list [new file with mode: 0644]
templates/apt/lvs01_apt.list [new file with mode: 0644]
templates/apt/lvs02_apt.list [new file with mode: 0644]
templates/apt/memcache01_apt.list [new file with mode: 0644]
templates/apt/memcache02_apt.list [new file with mode: 0644]
templates/apt/reporter01_apt.list [new file with mode: 0644]
templates/apt/sip01_apt.list [new file with mode: 0644]
templates/apt/sip02_apt.list [new file with mode: 0644]
templates/apt/utility01_apt.list [new file with mode: 0644]
templates/db/9.0/main/environment [new file with mode: 0644]
templates/db/9.0/main/pg_ctl.conf [new file with mode: 0644]
templates/db/9.0/main/pg_hba.conf [new file with mode: 0644]
templates/db/9.0/main/pg_ident.conf [new file with mode: 0644]
templates/db/9.0/main/postgresql-tuned.conf [new file with mode: 0644]
templates/db/9.0/main/postgresql.conf [new file with mode: 0644]
templates/db/9.0/main/start.conf [new file with mode: 0644]
templates/db/create_database_9.0.sql [new file with mode: 0644]
templates/db/create_database_9.1.sql [new file with mode: 0644]
templates/db/eg-db-backup.sh [new file with mode: 0755]
templates/db/eg-wal-archive.sh [new file with mode: 0755]
templates/db/eg_db_config.pl [new file with mode: 0755]
templates/db/eg_db_postgres.crontab [new file with mode: 0644]
templates/db/eg_db_root.crontab [new file with mode: 0644]
templates/db/eg_fstab_db [new file with mode: 0644]
templates/db/pg9_etc_postgresl.tgz [new file with mode: 0644]
templates/db/pg_hba.conf [new file with mode: 0644]
templates/db/postgresql.conf [new file with mode: 0644]
templates/db/postgresql.conf-8.4 [new file with mode: 0644]
templates/db/postgresql.conf-9.1.0 [new file with mode: 0644]
templates/db/snapshot.sh [new file with mode: 0755]
templates/debconf-settings [new file with mode: 0755]
templates/debs/evergreen-ils_2.1.1_amd64.deb [new file with mode: 0644]
templates/debs/libdbi-drivers_0.8.3_amd64.deb [new file with mode: 0644]
templates/debs/libdbi_0.8.3_amd64.deb [new file with mode: 0644]
templates/debs/opensrf_2.0.1_amd64.deb [new file with mode: 0644]
templates/debs/spidermonkey-perl_0.20_amd64.deb [new file with mode: 0644]
templates/debs/spidermonkey_1.7.0_amd64.deb [new file with mode: 0644]
templates/eg-logger-root.crontab [new file with mode: 0644]
templates/eg_fstab_drone [new file with mode: 0644]
templates/eg_fstab_head [new file with mode: 0644]
templates/etc_profile [new file with mode: 0644]
templates/exports [new file with mode: 0644]
templates/hosts-footer [new file with mode: 0644]
templates/hosts-header [new file with mode: 0644]
templates/init/eg_database [new file with mode: 0755]
templates/init/eg_opensrf [new file with mode: 0755]
templates/interfaces [new file with mode: 0644]
templates/lvs/apt.list [new file with mode: 0644]
templates/lvs/authkeys [new file with mode: 0644]
templates/lvs/ha.cf [new file with mode: 0644]
templates/lvs/haresources [new file with mode: 0644]
templates/lvs/interfaces [new file with mode: 0644]
templates/lvs/iptables-rules.fw [new file with mode: 0755]
templates/lvs/ldirectord.cf [new file with mode: 0644]
templates/lvs/ldirectord.cf-footer [new file with mode: 0644]
templates/lvs/main.cf [new file with mode: 0644]
templates/lvs/ntp.conf [new file with mode: 0644]
templates/lvs/rc.local [new file with mode: 0755]
templates/lvs/resolv.conf [new file with mode: 0644]
templates/ntp.conf [new file with mode: 0644]
templates/oils_brick.cfg-footer [new file with mode: 0644]
templates/oils_brick.cfg-header [new file with mode: 0644]
templates/oils_web.xml [new file with mode: 0644]
templates/opensrf-crontab-old [new file with mode: 0644]
templates/opensrf-rsyslog.conf [new file with mode: 0644]
templates/opensrf-rsyslog.conf-old [new file with mode: 0644]
templates/opensrf.xml/opensrf.xml-drone [new file with mode: 0644]
templates/opensrf.xml/opensrf.xml-footer [new file with mode: 0644]
templates/opensrf.xml/opensrf.xml-full [new file with mode: 0644]
templates/opensrf.xml/opensrf.xml-head [new file with mode: 0644]
templates/opensrf.xml/opensrf.xml-header [new file with mode: 0644]
templates/opensrf.xml/opensrf.xml-header-old [new file with mode: 0644]
templates/opensrf.xml/version [new file with mode: 0644]
templates/opensrf_core.xml [new file with mode: 0644]
templates/resolv.conf [new file with mode: 0644]
templates/rsyslog.conf [new file with mode: 0644]
templates/setup-drone.sh [new file with mode: 0755]
templates/setup-head.sh [new file with mode: 0755]
templates/setup.sh [new file with mode: 0755]
templates/setup_brick_to_drone_sshkeys.sh [new file with mode: 0755]
templates/setup_sshkeys.sh [new file with mode: 0755]
templates/utility/circ_notices.sh [new file with mode: 0755]
templates/utility/circ_notices_overdue_nomail.sh [new file with mode: 0755]
templates/utility/gen_blocked_list.sh [new file with mode: 0755]
templates/utility/opensrf-crontab [new file with mode: 0644]
templates/utility/run-collections.sh [new file with mode: 0755]

diff --git a/GenaSYS.sh b/GenaSYS.sh
new file mode 100755 (executable)
index 0000000..e6c76af
--- /dev/null
@@ -0,0 +1,1765 @@
+#!/bin/bash
+
+##############################################################################
+#   Copyright (c) 2010-2012 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
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+##########################################################################
+
+# ########################################################################
+
+       NAME_="GenaSYS"
+    PURPOSE_="Generate config files needed for Evergreen-ILS Cluster"
+   SYNOPSIS_="$NAME_"
+   REQUIRES_="standard GNU commands, apt, dpkg"
+    VERSION_="0.83"
+       DATE_="2010-09-18; last update: 2012-03-22"
+     AUTHOR_="Andy Witter <awitter@georgialibraries.org>"
+        URL_="http://evergreen-ils.org"
+   CATEGORY_="devel"
+   PLATFORM_="Linux"
+      SHELL_="bash"
+ DISTRIBUTE_="yes"
+   COMMENTS_="Generates system and opensrf config files for Evergreen clusters"
+
+# #############################################################################
+
+Usage () { ### Display Usage
+echo ; echo >&2 "Usage: $0 [-c config file] [-h] help" ; echo
+}
+
+while getopts c:nh OPTIONS
+do     case "$OPTIONS" in
+       c)      CONFIG_FILE="$OPTARG";;
+       n)      NOSPLASH="1";;
+       h)      Usage ; exit 1;;
+       [?])    Usage ; exit 2;;
+       esac
+done
+
+
+WD=$(dirname $(readlink -f $0))
+CUSTOMDIR="$WD/custom"
+EG_VERSION="2.1.1"
+LICENSE="$WD/License.txt"
+TEMPLATEDIR="$WD/templates"
+DEFAULT_PRIVATE_NET="10.0.1"
+PRIVATENET="$DEFAULT_PRIVATE_NET"
+OSRF_USERNAME="opensrf"
+DB_USERNAME="evergreen"
+#DRONECOUNT="2"
+TMPHOSTS="/tmp/tmphost.txt"
+TMPOSRFNODES="/tmp/tmposrfnodes"
+TMPOPENSRF_XML="/tmp/tmpopensrf.xml"
+PSQL_VERSION="9.1"
+[ -z $CONFIG_FILE ] && CONFIG_FILE="$WD/genasys.conf"
+NEW_CONFIG_FILE="$OUTDIR/genasys.conf"
+CERT_DIR="${OUTDIR}/ssl_cert"
+#TMPBRICKDRONES="/tmp/tmpbricknodes"
+
+
+### Setup colors.
+## Normal colors.
+ESC_SEQ="\x1b["
+COL_RESET=$ESC_SEQ"39;49;00m"
+COL_RED=$ESC_SEQ"0;31m"
+COL_GREEN=$ESC_SEQ"0;32m"
+COL_YELLOW=$ESC_SEQ"0;33m"
+COL_BLUE=$ESC_SEQ"0;34m"
+COL_MAGENTA=$ESC_SEQ"0;35m"
+COL_CYAN=$ESC_SEQ"0;36m"
+
+## Bright colors.
+COL_BR_RED=$ESC_SEQ"1;31m"
+COL_BR_GREEN=$ESC_SEQ"1;32m"
+COL_BR_YELLOW=$ESC_SEQ"1;33m"
+COL_BR_BLUE=$ESC_SEQ"1;34m"
+COL_BR_MAGENTA=$ESC_SEQ"1;35m"
+COL_BR_CYAN=$ESC_SEQ"1;36m"
+
+CHAR="\033%@\033(0"
+TEXT="\033(B"
+
+DRAW(){ echo -en "\033%@";echo -en "\033(0";}        # switch to 'character' mode
+WRITE(){ echo -en "\033(B";}                          # return to normal mode from 'character' mode
+
+
+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 " Georgia Public Library Service"$COL_RESET
+echo
+echo " Version: $VERSION_"
+sleep 7
+more "$LICENSE"
+echo
+echo "[1] - I ACCEPT the terms of this license."
+echo "[2] - I DO NOT ACCEPT the terms of this license."
+echo
+select yn in "Yes" "No"; do
+    case $yn in
+        Yes ) echo ; echo -e $COL_BR_GREEN" License accepted..."$COL_RESET; sleep 1 ; break;;
+        No ) exit 3;;
+    esac
+done
+
+}
+
+[ "$NOSPLASH" == "1" ] || ShowLicense
+
+### Into Screen.
+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
+sleep 4
+echo
+echo "Installation Notes:"
+echo "==================="
+echo
+echo -e $COL_YELLOW"Library IP based redirction:"$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
+echo "before continuing." 
+sleep 0.1
+echo
+echo -e $COL_YELLOW"Zip Codes for libraries:"$COL_RESET
+echo "If you are using mutliple zip codes for libraries copy"
+echo -e "a preconfigured" $COL_BR_GREEN zips.txt $COL_RESET
+echo -e "file to the" $COL_YELLOW "${CUSTOMDIR}" $COL_RESET folder
+echo "before continuing." 
+sleep 0.1
+echo
+echo -e $COL_YELLOW"Action Trigger Filters:"$COL_RESET
+echo "If you are using customized action trigger filters then copy" 
+echo -e "the custom" $COL_BR_GREEN action_trigger_filters.json $COL_RESET
+echo -e "file to the" $COL_YELLOW "${CUSTOMDIR}" $COL_RESET folder
+echo "before continuing." 
+sleep 0.1
+echo
+echo -e $COL_YELLOW"Custom Maintenance Page:"$COL_RESET
+echo "If you are using a customized maintenance page" 
+echo -e "then copy the custom" $COL_BR_GREEN index.html or index.php $COL_RESET
+echo -e "file and any image files"$COL_BR_RED .jpg or .png$COL_RESET
+echo -e "to the" $COL_YELLOW "${CUSTOMDIR}" $COL_RESET folder
+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 -e "The domain for this cluster appears to be :"$COL_BR_YELLOW" $(hostname -d)"$COL_RESET
+while true; do
+    read -n 1 -p "Is this correct? [y/n] : " USE_DETECTED_DOMAIN
+    case $USE_DETECTED_DOMAIN in
+        [Yy]* ) echo ; break;;
+        [Nn]* ) echo ; break;;
+        * ) echo " Please answer yes or no.";;
+    esac
+done
+}
+
+Get_Domain_Name () { ### Get the domain name for the cluster.
+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
+echo
+echo -e "The Domain Name $COL_BR_YELLOW $CLUSTERDOMAINNAME $COL_RESET will be used."
+echo
+}
+
+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 "An SSL Certificate is required for Evergreen to function correctly."
+echo "If you have purchased a certificate from a CA then please copy "
+echo "the certificate files (server.crt, server.key and ca.crt if applicable)"
+echo -e "to"$COL_YELLOW ${WD}/ssl_cert $COL_RESET"now then press [y] to continue."
+echo "If you do not have a purchased certificate from a CA then press [n]"
+echo "and GenaSYS will generate a self-signed certificate automatically."
+echo
+while true; do
+    read -n 1 -p "Do you currently have a purchased Certificate from a CA? [y/n] : " USE_CA_CERT
+    case $USE_CA_CERT in
+        [Yy]* ) echo ; break;;
+        [Nn]* ) echo ; break;;
+        * ) echo " Please answer yes or no.";;
+    esac
+done
+}
+
+Generate_SSL_Cert () { ### Generate SSL Certificate.
+       mkdir -p "${OUTDIR}/ssl_cert"
+       echo
+       echo -e $COL_BR_BLUE"Generating self-signed certificate"${COL_RESET}
+       sleep 1
+       if ! which openssl >/dev/null
+               then
+               echo
+               echo "openssl command not found - please install openssl"
+               read -p "then press [Enter] to continue" ENTER
+               echo
+               cd "${CERT_DIR}"
+                openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key -subj "/CN=$CLUSTERDOMAINNAME"
+               echo;echo;echo "Certificate for $CLUSTERDOMAINNAME"
+               openssl x509 -in server.crt -text -noout
+               sleep 2
+               cd "${WD}"
+                       else
+                       echo
+                       cd "${CERT_DIR}"
+                       openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key -subj "/CN=$CLUSTERDOMAINNAME"
+                       echo;echo;echo "Certificate for $CLUSTERDOMAINNAME"
+                       openssl x509 -in server.crt -text -noout
+                       sleep 2
+                       cd "${WD}"
+       fi      
+}
+
+
+Use_CA_Cert () { ### Configure with CA Certificate
+               if [ -e "${WD}/ssl_cert/server.key" ] && [ -e "${WD}/ssl_cert/server.crt" ]
+                       then
+                       CERT_DIR="${WD}/ssl_cert"
+                       echo
+                       echo -e $COL_BR_BLUE"Using certificate files found in"$COL_RESET $COL_YELLOW"${CERT_DIR}"$COL_RESET
+                       sleep 1
+                       #openssl x509 -in $CERT_DIR/server.crt -text -noout
+                       #sleep 2
+                       CA_FILES_EXIST="y"
+                               else
+                               echo
+                               echo "The files server.crt and server.key are not found in ${WD}/ssl_cert."
+                               echo "You must include both files."
+                               echo "please copy the certificate files to ${WD}/ssl_cert"
+                               echo "and run this program again."
+                               echo "Exiting...."
+                               exit 4
+               fi
+               
+        
+}
+
+Get_Brick_Layout () { ### Prompt for brick layout.
+echo;echo;echo
+echo -e $COL_BR_BLUE"_____________Evergreen_Brick Configuration_____________"$COL_RESET
+echo
+echo "The standard configuration for a brick is 2 drones per head."
+while true; do
+    read -n 1 -p "Do you want to use the standard configuration? [y/n] : " USE_STANDARD_HEAD_CONFIG
+    case $USE_STANDARD_HEAD_CONFIG in
+        [Yy]* ) echo ; DRONECOUNT="2" ; break;;
+        [Nn]* ) echo ; break;;
+        * ) echo " Please answer yes or no.";;
+    esac
+done
+}
+
+Get_Drone_Config () { ### Choose seperate or integrated drones
+while true; do
+       read -n 1 -p "Do you want to use separate drones in this configuration? [y/n]: " USEDRONES
+       case $USEDRONES in
+               [Yy]* ) echo ; break;;
+               [Nn]* ) echo ; break;;
+               * ) echo " Please answer yes or no.";;
+       esac
+done
+}
+
+Get_Drone_Count () { ### Get the number of drones
+while true; do
+       echo
+       read -n 1 -p "How many drones per brick would you like to configure? [1-9] : " DRONECOUNT
+       case $DRONECOUNT in
+               [1-9]* ) echo ; break;;
+               * ) echo " Please enter a number between [1-9].";;
+       esac
+done
+}
+
+Get_Brick_Count () { ### Prompt for # of bricks in the cluster.
+while true; do
+    echo;read -n 1 -p "How many bricks will be in this cluster? [1-9] : " BRICKCOUNT
+    case $BRICKCOUNT in
+        [1-9]* ) echo ; break;;
+        * ) echo " Please enter a number between [1-9].";;
+    esac
+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 "The reporter must be configured for this cluster."
+echo "First we'll configure the reporter output directory."
+echo "This is shared and mounted on all the heads."
+echo "Please choose the host where the reports output"
+echo "directory will reside and be shared."
+while true; do
+        echo
+        echo "(1) db01"
+        echo "(2) db02"
+        echo "(3) db03"
+        echo "(4) reporter01"
+        echo "(5) Enter new hostname"
+        echo
+    read -n 1 -p "Select Host [1-5] : " REPORTS_MENU_SELECTION
+    case $REPORTS_MENU_SELECTION in
+        [1]* ) REPORTS_NFS_HOSTNAME="db01" ; break;;
+        [2]* ) REPORTS_NFS_HOSTNAME="db02" ; break;;
+        [3]* ) REPORTS_NFS_HOSTNAME="db03" ; break;;
+        [4]* ) REPORTS_NFS_HOSTNAME="reporter01" ; break;;
+        [5]* ) echo ; echo -e $COL_BR_CYAN ; read -p "Enter new hostname: " REPORTS_NFS_HOSTNAME ; break;;
+
+
+        * ) echo " Please select choice [1-5].";;
+    esac
+done
+echo -e $COL_RESET
+echo
+echo;echo -e $COL_BR_BLUE"Setting up reports output NFS share on"$COL_RESET $COL_BR_GREEN"$REPORTS_NFS_HOSTNAME"$COL_RESET
+sleep 2
+}
+
+
+Get_OSRF_Cred () { ### Prompt for OpenSRF Credentials.
+echo;echo;echo
+echo -e $COL_BR_BLUE"________Evergreen OpenSRF configuration________"$COL_RESET
+echo 
+echo "Open Service Request Framework requires"
+echo "credentials configured for authentication"
+echo
+read -p "Enter OpenSRF Password: " OPENSRF_PASSWORD
+while [ "$OPENSRF_PASSWORD" = "" ]
+        do
+        echo
+       MORON="1"
+        echo "Cannot be blank - you must enter a password"
+        read -p "Enter the opensrf password: " OPENSRF_PASSWORD
+done
+}
+
+Get_DB_Cred () { ### Prompt for Database Credentials.
+echo;echo;echo
+echo -e $COL_BR_BLUE"________Evergreen database configuration________"$COL_RESET
+echo
+read -p "Enter the database password: " DATABASE_PASSWORD
+while [ "$DATABASE_PASSWORD" = "" ]
+        do
+       if [ "$MORON" = "1" ]
+               then
+               echo
+               echo "Cannot be blank you - must enter a password"
+               sleep 1
+               echo "are you a moron?"
+               sleep 3
+               echo
+               echo "Lets try this again shall we?"
+               sleep 3
+               echo "Try not to be a moron this time"
+               sleep 2
+               read -p "Enter the database password: " DATABASE_PASSWORD
+                       else
+                       echo
+                       MORON=1
+                       echo "Cannot be blank you must enter a password"
+                       read -p "Enter the database password: " DATABASE_PASSWORD
+       fi
+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
+read -p "Enter the Evergreen Administrator Username: " EG_ADMIN_USER
+}
+
+Get_EG_Admin_Password () { ### Prompt for Evergreen admin password.
+echo
+read -p "Enter the Evergreen Administrator Password: " EG_ADMIN_PASSWORD
+while [ -z "$EG_ADMIN_PASSWORD" ]
+       do 
+       echo
+       echo -e $COL_BR_RED"Cannot be blank you must enter a password"$COL_RESET
+       read -p "Enter the Evergreen Administrator Password: " EG_ADMIN_PASSWORD
+done
+}
+
+
+
+GetNetInfo () { ### Get Public Network broadcast and network IP.
+typeset -i mask=255
+
+[[ $# != 2 ]] && {
+   echo "Usage: $0 ipaddress subnetmask"
+   exit 5
+}
+
+SaveIFS=$IFS
+IFS=.
+typeset -a IParr=($1)
+typeset -a NMarr=($2)
+IFS=$SaveIFS
+
+typeset -i ipbin1=${IParr[0]}
+typeset -i ipbin2=${IParr[1]}
+typeset -i ipbin3=${IParr[2]}
+typeset -i ipbin4=${IParr[3]}
+
+typeset -i nmbin1=${NMarr[0]}
+typeset -i nmbin2=${NMarr[1]}
+typeset -i nmbin3=${NMarr[2]}
+typeset -i nmbin4=${NMarr[3]}
+
+
+PUB_BCAST=$(echo "$((ipbin1 | (mask ^ nmbin1))).$((ipbin2 | (mask ^ nmbin2))).$((ipbin3 | (mask ^ nmbin3))).$((ipbin4 | (mask ^ nmbin4)))")
+PUB_NETWORK=$(echo "$((ipbin1 & nmbin1)).$((ipbin2 & nmbin2)).$((ipbin3 & nmbin3)).$((ipbin4 & nmbin4))")
+unset IFS
+}
+
+Mask2CIDR() { ### Convert Netmask to CIDR
+    nbits=0
+    IFS=.
+    for dec in $1 ; do
+        case $dec in
+            255) let nbits+=8;;
+            254) let nbits+=7;;
+            252) let nbits+=6;;
+            248) let nbits+=5;;
+            240) let nbits+=4;;
+            224) let nbits+=3;;
+            192) let nbits+=2;;
+            128) let nbits+=1;;
+            0);;
+            *) echo "Error: $dec is not recognized"; exit 6
+        esac
+    done
+    echo "$nbits"
+unset IFS
+}
+
+Choose_Private_Net () { ### Default Private Network Configuration.
+echo
+echo
+echo -e $COL_BR_BLUE"________Private network configuration________"$COL_RESET
+echo
+echo -e "The default private network is IP is" $COL_BR_YELLOW "${PRIVATENET}.0/24" $COL_RESET
+while true; do
+    read -n 1 -p "Do you want to use the standard configuration? [y/n] : " USE_STANDARD_PRIVATE_NETWORK
+    case $USE_STANDARD_PRIVATE_NETWORK in
+        [Yy]* ) echo ; break;;
+        [Nn]* ) echo ; break;;
+        * ) echo " Please answer yes or no.";;
+    esac
+done
+}
+
+Get_Private_Net () { ### Get Private Network Configuration.
+if [ "$USE_STANDARD_PRIVATE_NETWORK" != "y" ]
+        then
+       echo
+       echo "Enter the first 3 octets of the private network ip address for the cluster : "
+       echo -en $COL_BR_CYAN
+        read -p "eg. 192.168.1   Private Network IP: " PRIVATENET
+       echo -e $COL_RESET
+                echo
+                echo -e "The network IP" $COL_BR_YELLOW "${PRIVATENET}.0/24" $COL_RESET "will be used for the private network."
+                echo
+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 "The public IP address for the cluster"
+echo "will be used for LVS Director and Heartbeat."
+echo "This address is the \"virtual\" address and"
+echo "will be *shared* between two LVS machines in the cluster."
+echo "Enter the public IP address for the cluster."
+echo -en $COL_BR_CYAN
+read -p "Cluster Public IP: " CLUSTERIPADDRESS
+echo -e $COL_RESET
+echo
+echo -e "The public IP address "$COL_BR_YELLOW"$CLUSTERIPADDRESS"$COL_RESET
+echo "will be used to configure LVS Director"
+echo 
+}
+
+Get_Cluster_Public_Netmask () { ### Get the public netmask for the cluster
+echo
+echo "Enter the netmask that corresponds to the"
+echo "public IP address entered above"
+echo -en $COL_BR_CYAN 
+read -p "Subnet Mask: " CLUSTERNETMASK
+echo -e $COL_RESET
+echo
+echo -e "The netmask address "$COL_BR_YELLOW"$CLUSTERNETMASK"$COL_RESET
+echo "will be used to set the netmask"
+echo "for the public IP of the cluster"
+echo
+}
+
+Get_Cluster_Public_Gateway () { ### Get the public gateway for the cluster
+echo
+echo "Enter the gateway that corresponds to the"
+echo "public IP address entered above"
+echo -en $COL_BR_CYAN 
+read -p "Gateway: " CLUSTERGATEWAY
+echo -e $COL_RESET
+echo
+echo -e "The public IP address "$COL_BR_YELLOW"$CLUSTERGATEWAY"$COL_RESET
+echo "will be used to set the gateway"
+echo "for the cluster"
+echo
+}
+
+Get_Lvs01_Physical_Public_IP () { ### Get the public IP for the physical interface of lvs01
+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"
+echo -e "each server independent of the shared address entered above."
+echo -e "In this case the defaults are lvs01.${CLUSTERDOMAINNAME} and"
+echo -e "lvs02.${CLUSTERDOMAINNAME}" $COL_RESET
+echo
+echo "---First LVS server---"
+echo "Enter the public physical ip address for lvs01"
+echo -en $COL_BR_CYAN 
+read -p "lvs01.${CLUSTERDOMAINNAME} Physical Public IP Address: " LVS01_PHYSICAL_PUBLIC_IP
+echo -e $COL_RESET
+echo
+echo -e "The public IP address "$COL_BR_YELLOW"$LVS01_PHYSICAL_PUBLIC_IP"$COL_RESET
+echo "will be used for the  physical public interface"
+echo "of lvs01.${CLUSTERDOMAINNAME}"
+echo
+}
+
+Get_Lvs02_Physical_Public_IP () { ### Get the public IP for the physical interface of lvs02
+echo
+echo "---Second LVS server---"
+echo "Enter the public physical ip address for lvs02"
+echo -en $COL_BR_CYAN 
+read -p "lvs02.${CLUSTERDOMAINNAME} Physical Public IP Address: " LVS02_PHYSICAL_PUBLIC_IP
+echo -e $COL_RESET
+echo
+echo -e "The public IP address "$COL_BR_YELLOW"$LVS02_PHYSICAL_PUBLIC_IP"$COL_RESET
+echo "will be used for the  physical public interface"
+echo "of lvs02.${CLUSTERDOMAINNAME}"
+echo
+}
+
+Confirm_Input () { ### Confirm input. Correct? [y/n]
+while true; do
+       read -n 1 -p "Is this correct? [y/n] : " RETRY
+       case $RETRY in
+               [Yy]* ) echo ; break;;
+               [Nn]* ) $@;;
+               * ) echo " Please choose [y] or [n].";;
+       esac
+done
+}
+
+Confirm_Input_Continue () { ### Confirm input. Continue [y/n]
+while true; do
+       echo -e $COL_BR_CYAN
+        read -n 1 -p "(C)ontinue? (R)etry [c/r] : " RETRY
+       echo -e $COL_RESET
+        case $RETRY in
+                [Cc]* ) echo ; break;;
+                [Rr]* ) $@;;
+                * ) echo " Please choose [c] to continue or [r] to retry.";;
+        esac
+done
+}
+
+Write_Config_File () { ### Add to new config file.
+eval echo  $@=\\\"\$$@\\\" >> $NEW_CONFIG_FILE
+}
+
+
+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"
+fi
+
+### Prompt to use detected domain name.
+if [ -z $CLUSTERDOMAINNAME ] || [ "$USE_CONFIG_FILE" == "0" ] ; then
+Choose_Detected_Domain_Name
+
+### prompt for domain info if chosen
+       if [ "$USE_DETECTED_DOMAIN" != "y" ]
+               then
+               Get_Domain_Name
+               Confirm_Input Get_Domain_Name
+                       else
+                       CLUSTERDOMAINNAME="$(hostname -d)"
+       fi
+fi
+### Set output directory.
+OUTDIR="$WD/config/${CLUSTERDOMAINNAME}_evergreen_config"
+
+### Move old output directory to backup and creat new one.
+[ -d "$OUTDIR" ] && mv $OUTDIR "${OUTDIR}_$(date +%m%d%Y_%H%M)"
+mkdir -p $OUTDIR
+
+### Set Cert output directory
+CERT_DIR="${OUTDIR}/ssl_cert"
+
+### New Config file
+NEW_CONFIG_FILE="$OUTDIR/genasys.conf"
+
+### Certifcate output directory.
+CERT_DIR="${OUTDIR}/ssl_cert"
+
+# Create New config file
+echo "## GenaSYS $VERSION_ Configuration" > $NEW_CONFIG_FILE
+echo "## Created $(date)" >> $NEW_CONFIG_FILE
+echo >> $NEW_CONFIG_FILE
+
+Write_Config_File CLUSTERDOMAINNAME 
+
+if [ -z $USE_CA_CERT ]  || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Choose_SSL_Cert
+fi
+echo "USE_CA_CERT=\"$USE_CA_CERT\"" >> $NEW_CONFIG_FILE
+
+if [ "$USE_CA_CERT" == "N" ] || [ "$USE_CA_CERT" == "n" ]
+       then
+       Generate_SSL_Cert
+               else
+               Use_CA_Cert
+fi
+
+
+if [ -z $USE_STANDARD_HEAD_CONFIG ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       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 [ "$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
+Write_Config_File USEDRONES
+Write_Config_File DRONECOUNT
+
+
+if [ -z $BRICKCOUNT ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_Brick_Count
+fi
+Write_Config_File BRICKCOUNT
+
+if [ -z $REPORTS_NFS_HOSTNAME ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       EG_Reporter
+fi
+Write_Config_File REPORTS_NFS_HOSTNAME
+
+if [ -z $OPENSRF_PASSWORD ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_OSRF_Cred
+fi
+Write_Config_File OPENSRF_PASSWORD
+
+if [ -z $DATABASE_PASSWORD ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_DB_Cred
+fi
+Write_Config_File DATABASE_PASSWORD
+
+if [ -z $EG_ADMIN_USER ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_EG_Admin_User
+fi
+Write_Config_File EG_ADMIN_USER
+
+if [ -z $EG_ADMIN_PASSWORD ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_EG_Admin_Password
+fi
+Write_Config_File EG_ADMIN_PASSWORD
+
+if [ -z $USE_STANDARD_PRIVATE_NETWORK ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Choose_Private_Net
+fi
+Write_Config_File USE_STANDARD_PRIVATE_NETWORK
+
+if [ "$USE_STANDARD_PRIVATE_NETWORK" = "n" ] || [ "$USE_STANDARD_PRIVATE_NETWORK" = "N" ]
+       then
+       if [ "$USE_CONFIG_FILE" == "0" ]
+               then
+               Get_Private_Net
+               Confirm_Input Get_Private_Net
+       fi
+       if [ -z $PRIVATENET ]
+               then
+               Get_Private_Net
+               Confirm_Input Get_Private_Net
+       fi
+fi
+Write_Config_File PRIVATENET
+
+if [ -z $CLUSTERIPADDRESS ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_Cluster_Public_IP
+       Confirm_Input Get_Cluster_Public_IP
+fi
+Write_Config_File CLUSTERIPADDRESS
+
+if [ -z $CLUSTERNETMASK ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       then
+       Get_Cluster_Public_Netmask
+       Confirm_Input Get_Cluster_Public_Netmask
+fi
+Write_Config_File CLUSTERNETMASK
+
+if [ -z $CLUSTERGATEWAY ] || [ "$USE_CONFIG_FILE" == "0" ] 
+       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
+       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
+       Get_Lvs02_Physical_Public_IP
+       Confirm_Input Get_Lvs02_Physical_Public_IP
+fi
+Write_Config_File LVS02_PHYSICAL_PUBLIC_IP
+
+# The new config file contains sensitive information.
+chmod 600 $NEW_CONFIG_FILE
+
+echo;echo -e $COL_BR_BLUE
+cat $NEW_CONFIG_FILE
+echo;echo -e $COL_RESET
+#############################################################
+}
+Run_Functions_For_Input
+if [ "$USE_CONFIG_FILE" == "0" ]
+       then
+       Confirm_Input_Continue Run_Functions_For_Input
+fi
+
+GetNetInfo ${CLUSTERIPADDRESS} ${CLUSTERNETMASK}
+CLUSTER_CIDR=$(Mask2CIDR ${CLUSTERNETMASK})
+
+
+### Setup Privatenet IP for all hosts except bricks.
+LVS01_PRIVATE_SHARED_IP="${PRIVATENET}.1"
+LVS01_PRIVATE_IP="${PRIVATENET}.2"
+LVS02_PRIVATE_IP="${PRIVATENET}.3"
+DB01_IP="${PRIVATENET}.101"
+DB02_IP="${PRIVATENET}.102"
+DB03_IP="${PRIVATENET}.103"
+UTILITY01_IP="${PRIVATENET}.111"
+LOGGER01_IP="${PRIVATENET}.121"
+SIP01_IP="${PRIVATENET}.131"
+SIP02_IP="${PRIVATENET}.132"
+REPORTER01_IP="${PRIVATENET}.141"
+MEMCACHE01_IP="${PRIVATENET}.151"
+MEMCACHE02_IP="${PRIVATENET}.152"
+BACKUP01_IP="${PRIVATENET}.171"
+MONITOR01_IP="${PRIVATENET}.201"
+ADMIN01_IP="${PRIVATENET}.211"
+
+cp -f "$TEMPLATEDIR/ntp.conf" /tmp
+cp -f "$TEMPLATEDIR/resolv.conf" /tmp
+sed -i "s^CLUSTER_DOMAIN_NAME^$CLUSTERDOMAINNAME^g" "/tmp/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
+
+### Begin lvs setup.
+LVSCONFIGFILE="/tmp/ldirectord.cf"
+echo "virtual=${CLUSTERIPADDRESS}:80" > "$LVSCONFIGFILE"
+
+for LVS in lvs01 lvs02
+        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 "$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^ClusterDomainName^$CLUSTERDOMAINNAME^g" "$OUTDIR/$LVS/etc/postfix/main.cf"
+        sed -i "s^Priv_NET^${PRIVATENET}^g" "$OUTDIR/$LVS/etc/network/iptables-rules.fw"
+        sed -i "s^Priv_NET^${PRIVATENET}^g" "$OUTDIR/$LVS/etc/postfix/main.cf"
+        sed -i "s^Pub_BCAST^${PUB_BCAST}^g" "$OUTDIR/$LVS/etc/network/iptables-rules.fw"
+        chmod 700 "$OUTDIR/$LVS/etc/network/iptables-rules.fw"
+        sed -i "s^ClusterPublic_IP^${CLUSTERIPADDRESS}^g" "$OUTDIR/$LVS/etc/ha.d/haresources"
+        sed -i "s^ClusterPublic_CIDR^${CLUSTER_CIDR}^g" "$OUTDIR/$LVS/etc/ha.d/haresources"
+        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"
+done
+
+
+### Start hosts file configuration.
+cp $TEMPLATEDIR/hosts-footer /tmp
+sed -i "s^Priv_NET^${PRIVATENET}^g" /tmp/hosts-footer
+sed -i "s^ClusterDomainName^${CLUSTERDOMAINNAME}^g" /tmp/hosts-footer
+
+### Start reports output configuration.
+echo
+echo Begin Reports Output Confiugration.
+if [ "$REPORTS_NFS_HOSTNAME" = "db01" ]
+       then
+       REPORTS_NFS_HOSTNAME_IP="${PRIVATENET}.101"
+               elif [ "$REPORTS_NFS_HOSTNAME" = "db02" ]
+                       then
+                       REPORTS_NFS_HOSTNAME_IP="${PRIVATENET}.102"
+               elif [ "$REPORTS_NFS_HOSTNAME" = "db03" ]
+                       then
+                       REPORTS_NFS_HOSTNAME_IP="${PRIVATENET}.103"
+               elif [ "$REPORTS_NFS_HOSTNAME" = "reporter01" ]
+                       then 
+                       REPORTS_NFS_HOSTNAME_IP="${PRIVATENET}.141"
+fi
+if [ ! -z "$REPORTS_NFS_HOSTNAME" ]
+       then
+       if ! grep -q "$REPORTS_NFS_HOSTNAME" /tmp/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
+       fi
+fi
+
+if [ ! -e "${OUTDIR}/${REPORTS_NFS_HOSTNAME}" ]
+       then
+       mkdir -p "${OUTDIR}/${REPORTS_NFS_HOSTNAME}/etc/network" || echo "failed to create : ${OUTDIR}/${REPORTS_NFS_HOSTNAME}/etc/network"
+fi
+mkdir -p "${OUTDIR}/${REPORTS_NFS_HOSTNAME}/storage/reports-output"
+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"
+
+### 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"
+
+### Start Logger setup.
+cp $TEMPLATEDIR/rsyslog.conf /tmp
+sed -i "s^ClusterDomainName^$CLUSTERDOMAINNAME^g" /tmp/rsyslog.conf
+
+
+### Split domain name.
+CLUSTER_DOMAIN_PREFIX="$(echo $CLUSTERDOMAINNAME |awk -F"." 'sub(FS $NF,x)')"
+CLUSTER_TLD="$(echo $CLUSTERDOMAINNAME |awk -F"." '{ print $NF }')"
+
+#####################################
+######## Create Output Tree #########
+######## ------------------ #########
+
+[ -e "$TMPHOSTS" ] && rm -f "$TMPHOSTS"
+[ -e "$TMPOSRFNODES" ] && rm -f "$TMPOSRFNODES"
+cat $TEMPLATEDIR/hosts-header > "$TMPHOSTS"
+#echo "$LVS01_PRIVATE_SHARED_IP ${CLUSTERDOMAINNAME}" >> "$TMPHOSTS" 
+echo "$LVS01_PRIVATE_IP lvs01.${CLUSTERDOMAINNAME}  lvs01 " >> "$TMPHOSTS"
+echo "$LVS02_PRIVATE_IP lvs02.${CLUSTERDOMAINNAME}  lvs02 " >> "$TMPHOSTS"
+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^DatabaseHostName^db01^g" $TMPOPENSRF_XML
+sed -i "s^ClusterDomainName^$CLUSTERDOMAINNAME^g" $TMPOPENSRF_XML
+sed -i "s^memcache01_IP^$MEMCACHE01_IP^g" $TMPOPENSRF_XML
+sed -i "s^memcache02_IP^$MEMCACHE02_IP^g" $TMPOPENSRF_XML
+if [ -e "${CUSTOMDIR}/zips.txt" ] 
+       then
+       sed -i 's^<!--<zips_file>^<zips_file>^g' $TMPOPENSRF_XML
+       sed -i 's^</zips_file>-->^</zips_file>^g' $TMPOPENSRF_XML
+fi
+
+### Set the hostnames and IPs of heads and drones.
+### And create the configuration  files as needed. 
+
+CreateBricks () { ### Create config for Bricks without separate drones. DRONELESS
+for BRICK in $(seq $BRICKCOUNT)
+        do
+        typeset BRICKHOSTNAME${BRICK}="brick0${BRICK}"
+        echo >> "$NETCFGFILE"
+        eval echo \$BRICKHOSTNAME${BRICK} >> "$NETCFGFILE"
+        echo "Brick${BRICK} hostname set to: $(eval echo \$BRICKHOSTNAME${BRICK})" >> "$NETCFGFILE"
+        typeset BRICKHOSTNAME${BRICK}_HEAD="$(eval echo \$BRICKHOSTNAME${BRICK}-head)"
+        echo "Brick${BRICK} Head hostname set to: $(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)" >> "$NETCFGFILE"
+        typeset BRICKHOSTNAME${BRICK}_HEAD_IP="$PRIVATENET.${BRICK}0"
+        echo "Brick${BRICK} Head IP Address set to: $(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)" >> "$NETCFGFILE"
+       [ "${BRICK}" = "1" ] && BRICK01_HEAD_IP="$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)"
+        eval echo -e "\\\treal=\$BRICKHOSTNAME${BRICK}_HEAD_IP:80 masq" >> "$LVSCONFIGFILE"
+        eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}
+        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/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
+        eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/init.d
+        eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/var/run/evergreen
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/data/offline
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/web/reporter
+       
+        ### head gets exports
+       eval cp -f $TEMPLATEDIR/eg_fstab_head ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc
+       eval cp -f ${CERT_DIR}/server.* ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/ssl
+       [ -e "${CERT_DIR}/ca.crt" ] && eval cp -f "${CERT_DIR}/ca.crt" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/ssl
+       [ -e "${CUSTOMDIR}/zips.txt" ] && eval cp -f "${CUSTOMDIR}/zips.txt"  ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/data/zips.txt
+        eval cp -f $TEMPLATEDIR/opensrf_core.xml ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf
+       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 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
+        eval sed -i "s^Priv_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg
+        eval printf 'export\ DRONES\=\(' >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg
+        eval cp -f $TEMPLATEDIR/apache2/eg.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-available
+        eval cp -f $TEMPLATEDIR/apache2/eg_vhost.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2
+       eval cp -f $TEMPLATEDIR/apache2/apache2.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2
+       eval cp -f $TEMPLATEDIR/apache2/startup.pl ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2
+        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/
+       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
+       sed -i "s^_CLUSTERDOMAINNAME^$CLUSTERDOMAINNAME^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf
+       sed -i "s^_PRIVATENET^$PRIVATENET^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/eg_vhost.conf
+       [ "$CA_FILES_EXIST" = "y" ] &&  sed -i "s^#SSLCACertificateFile ssl/ca.crt^SSLCACertificateFile ssl/ca.crt^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/sites-available/eg.conf
+        eval sed -i "s^Priv_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/network/interfaces
+        eval sed -i "s^Priv_NET^$PRIVATENET^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/network/interfaces
+        #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 sed -i "s^head_file^$(eval echo \$BRICKHOSTNAME${BRICK}-head)^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh
+       eval sed -i "s^_GENVER^${VERSION_}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh
+       eval sed -i "s^_EGVER^${EG_VERSION}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh
+       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 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
+       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
+        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
+
+done
+
+### Setup hosts file for bricks.
+cat /tmp/hosts-footer >> "$TMPHOSTS"
+sed -i "s^sampledomain.org^$CLUSTERDOMAINNAME^g" "$TMPHOSTS"
+# sed -i "s^Pub_IP^$CLUSTERIPADDRESS^g" "$TMPHOSTS"
+for BRICK in $(seq $BRICKCOUNT)
+        do
+        eval cat $TMPHOSTS >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hosts
+        eval sed -i "s^thishost^$(eval echo \$BRICKHOSTNAME${BRICK})-head^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hosts
+        done
+}
+
+CreateBricksAndDrones () { ### Create config for bricks with seperate drones
+for BRICK in $(seq $BRICKCOUNT)
+       do
+       typeset BRICKHOSTNAME${BRICK}="brick0${BRICK}"
+       echo >> "$NETCFGFILE"
+       eval echo \$BRICKHOSTNAME${BRICK} >> "$NETCFGFILE"
+       echo "Brick${BRICK} hostname set to: $(eval echo \$BRICKHOSTNAME${BRICK})" >> "$NETCFGFILE"
+       typeset BRICKHOSTNAME${BRICK}_HEAD="$(eval echo \$BRICKHOSTNAME${BRICK}-head)"
+       echo "Brick${BRICK} Head hostname set to: $(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)" >> "$NETCFGFILE"
+       typeset BRICKHOSTNAME${BRICK}_HEAD_IP="$PRIVATENET.${BRICK}0"
+       echo "Brick${BRICK} Head IP Address set to: $(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)" >> "$NETCFGFILE"
+       [ "${BRICK}" = "1" ] && BRICK01_HEAD_IP="$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)"
+       eval echo -e "\\\treal=\$BRICKHOSTNAME${BRICK}_HEAD_IP:80 masq" >> "$LVSCONFIGFILE"
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}
+       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/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
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/init.d
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/var/run/evergreen
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/data/offline
+       eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/web/reporter
+       ### head gets exports
+       eval cp -f $TEMPLATEDIR/eg_fstab_head ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc
+       eval cp -f ${CERT_DIR}/server.* ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/ssl
+       [ -e "${CERT_DIR}/ca.crt" ] && eval cp -f "${CERT_DIR}/ca.crt" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/ssl
+       [ -e "${CUSTOMDIR}/zips.txt" ] && eval cp -f "${CUSTOMDIR}/zips.txt"  ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/data/zips.txt
+       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 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 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
+       eval cp -f $TEMPLATEDIR/oils_brick.cfg-header ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/conf/.oils_brick.cfg
+       eval sed -i "s^Priv_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg
+       eval printf 'export\ DRONES\=\(' >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/openils/conf/.oils_brick.cfg
+       eval cp -f $TEMPLATEDIR/apache2/eg.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2/sites-available
+       eval cp -f $TEMPLATEDIR/apache2/eg_vhost.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2
+       eval cp -f $TEMPLATEDIR/apache2/apache2.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2
+       eval cp -f $TEMPLATEDIR/apache2/startup.pl ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/apache2
+       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/
+       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
+       [ "$CA_FILES_EXIST" = "y" ] &&  sed -i "s^#SSLCACertificateFile ssl/ca.crt^SSLCACertificateFile ssl/ca.crt^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/apache2/sites-available/eg.conf
+       eval sed -i "s^Priv_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/network/interfaces
+       eval sed -i "s^Priv_NET^$PRIVATENET^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 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 sed -i "s^_GENVER^${VERSION_}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh
+       eval sed -i "s^_EGVER^${EG_VERSION}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh
+       eval sed -i "s^head_file^$(eval echo \$BRICKHOSTNAME${BRICK}-head)^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/setup-head.sh
+       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 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
+               for DRONE in $(seq $DRONECOUNT)
+               do
+               typeset TMPBRICKDRONES="$(eval echo \$BRICKHOSTNAME${BRICK}-head)_drones.txt"
+               typeset BRICKHOSTNAME${BRICK}_DRONE${DRONE}="$(eval echo \$BRICKHOSTNAME${BRICK}-drone0${DRONE})"
+               echo "Brick${BRICK} Drone${DRONE} hostname set to: $(eval echo "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}")" >> "$NETCFGFILE"
+               typeset BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP="$PRIVATENET.${BRICK}${DRONE}"
+                echo "Brick${BRICK} Drone${DRONE} IP Address set to: $(eval echo "\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP")" >> "$NETCFGFILE"
+               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/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"
+               ### 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 $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/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 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^_GENVER^${VERSION_}^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^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/setup-drone.sh"
+               eval sed -i "s^HEAD_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/eg_fstab_drone"
+               eval sed -i "s^UTILITY01_IP^$UTILITY01_IP^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/eg_fstab_drone"
+               eval sed -i "s^Priv_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP)^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/network/interfaces"
+               eval sed -i "s^Priv_NET^$PRIVATENET^g" "${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-drone0${DRONE}/etc/network/interfaces"
+               #eval sed -i "s^DRONE_IP^$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/exports
+               eval echo "/openils \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP\(ro,sync,no_subtree_check\)" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/exports
+               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 "\$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
+               ### 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
+               done
+       #echo
+       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
+       
+done
+
+### Setup hosts file for bricks.
+cat /tmp/hosts-footer >> "$TMPHOSTS"
+sed -i "s^sampledomain.org^$CLUSTERDOMAINNAME^g" "$TMPHOSTS"
+sed -i "s^Pub_IP^$CLUSTERIPADDRESS^g" "$TMPHOSTS"
+for BRICK in $(seq $BRICKCOUNT)
+        do
+        eval cat $TMPHOSTS >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hosts
+        eval sed -i "s^thishost^$(eval echo \$BRICKHOSTNAME${BRICK})-head^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hosts
+                for DRONE in $(seq $DRONECOUNT)
+                do
+                eval cat $TMPHOSTS >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-drone0${DRONE}/etc/hosts
+                eval sed -i "s^thishost^$(eval echo \$BRICKHOSTNAME${BRICK})-drone0${DRONE}^g" ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-drone0${DRONE}/etc/hosts
+                done
+
+done
+}
+
+### Run fuctions to create bricks.
+if [ "$DRONELESS" == "1" ] 
+       then
+       echo
+       echo Creating bricks without separate drones please wait....
+       sleep 1
+       CreateBricks
+               else
+               echo
+               echo Creating bricks with separate drones please wait....
+               sleep 1
+               CreateBricksAndDrones
+fi
+
+### Add reporter01 to reporter exports share
+### it is not the one exporting reports output
+### to the network. (heads)
+
+if [ "${REPORTS_NFS_HOSTNAME}" != "reporter01" ]
+       then
+       echo "/storage/reports-output ${REPORTER01_IP}(rw,sync,no_subtree_check)" >> /tmp/exports_reporter
+fi
+
+
+
+### Opensrf.xml config continued.
+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
+echo >> "$LVSCONFIGFILE"
+cat /tmp/ldirectord.conf >> "$LVSCONFIGFILE"
+sed -i "s^Priv_NET^$PRIVATENET^g" "$LVSCONFIGFILE"
+
+### Complete LVS Director config.
+for LVS in lvs01 lvs02
+       do
+       cp -f $LVSCONFIGFILE $OUTDIR/$LVS/etc/ha.d
+done
+
+### Setup hosts file for LVS
+cp -f "$TMPHOSTS" "$OUTDIR/lvs01/etc/hosts" && sed -i "s^thishost^lvs01^g" "$OUTDIR/lvs01/etc/hosts"
+cp -f "$TMPHOSTS" "$OUTDIR/lvs02/etc/hosts" && sed -i "s^thishost^lvs02^g" "$OUTDIR/lvs02/etc/hosts"
+
+### Setup hosts file all except lvs and bricks.
+for HOSTS in db01 db02 db03 logger01 utility01 sip01 sip02 reporter01 memcache01 memcache02 monitor01 backup01 admin01 
+       do
+       mkdir -p "$OUTDIR/$HOSTS/etc/network" && \
+       cp -f "$TMPHOSTS" "$OUTDIR/$HOSTS/etc/hosts" && \
+       sed -i "s^thishost^$HOSTS^g" "$OUTDIR/$HOSTS/etc/hosts"
+done
+
+
+
+### Setup LVS Interfaces file.
+for LVS in lvs01 lvs02
+       do
+       cp -f "$TEMPLATEDIR/lvs/interfaces" "$OUTDIR/$LVS/etc/network"
+       sed -i "s^Pub_NETMASK^$CLUSTERNETMASK^g" "$OUTDIR/$LVS/etc/network/interfaces"
+       sed -i "s^Pub_GATEWAY^$CLUSTERGATEWAY^g" "$OUTDIR/$LVS/etc/network/interfaces"
+       sed -i "s^Priv_NET^$PRIVATENET^g" "$OUTDIR/$LVS/etc/network/interfaces"
+       sed -i "s^Cluster_Public_IP^$CLUSTERIPADDRESS^g" "$OUTDIR/$LVS/etc/network/interfaces"
+done
+sed -i "s^Pub_IP^$LVS01_PHYSICAL_PUBLIC_IP^g" "$OUTDIR/lvs01/etc/network/interfaces"
+sed -i "s^Pub_IP^$LVS02_PHYSICAL_PUBLIC_IP^g" "$OUTDIR/lvs02/etc/network/interfaces"
+sed -i "s^Priv_Physical_Address^$LVS01_PRIVATE_IP^g" "$OUTDIR/lvs01/etc/network/interfaces"
+sed -i "s^Priv_Physical_Address^$LVS02_PRIVATE_IP^g" "$OUTDIR/lvs02/etc/network/interfaces"
+
+### Setup interfaces file all except lvs and bricks.
+SetupInterfaces () { #Configure Interfaces file.
+for NET_NODE in db01 db02 db03 logger01 utility01 sip01 sip02 reporter01 memcache01 memcache02 monitor01 backup01 admin01 
+       do
+       cp -f "$TEMPLATEDIR/interfaces" "$OUTDIR/$NET_NODE/etc/network" && \
+       eval sed -i "s^Priv_IP^\$${NET_NODE^^*}_IP^g" "$OUTDIR/$NET_NODE/etc/network/interfaces"
+       sed -i "s^Priv_NET^$PRIVATENET^g" "$OUTDIR/$NET_NODE/etc/network/interfaces"
+done
+}
+SetupInterfaces
+
+### Setup Utility
+### setup exports for utility.
+cp -f "/tmp/exports" "$OUTDIR/utility01/etc/"
+
+### action trigger filters for utility.
+mkdir -p "$OUTDIR/utility01/openils/conf"
+if [ -e "$CUSTOMDIR/action_trigger_filters.json" ]
+       then
+       echo
+       echo -e $COL_GREEN"Using custom action trigger filters."$COL_RESET
+       cp -f "$CUSTOMDIR/action_trigger_filters.json" "$OUTDIR/utility01/openils/conf"
+               else
+               cp -f "$TEMPLATEDIR/action_trigger_filters.json" "$OUTDIR/utility01/openils/conf"
+fi
+### copy pines scripts to utility
+mkdir -p "$OUTDIR/utility01/home/opensrf/eg"
+cp $TEMPLATEDIR/utility/*.sh "$OUTDIR/utility01/home/opensrf/eg"
+
+### setup exports for reporter output
+cp -f "/tmp/exports_reporter" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/exports"
+
+
+### 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 
+       do
+       cp -f "/tmp/resolv.conf" "$OUTDIR/$DNSNODE/etc"
+       cp -f "/tmp/ntp.conf" "$OUTDIR/$DNSNODE/etc"
+done
+
+
+### Setup hostname and logger config files on all hosts except bricks.
+echo
+echo "Setting up hostname and logger config files for non-brick nodes.."
+for HOSTNODE in lvs01 lvs02 db01 db02 db03 logger01 utility01 sip01 sip02 reporter01 memcache01 memcache02 monitor01 backup01 admin01 
+       do
+       echo $HOSTNODE > "$OUTDIR/${HOSTNODE}/etc/hostname"
+       cp -f /tmp/rsyslog.conf "$OUTDIR/${HOSTNODE}/etc"
+done
+echo "Done setting up hostname and logger config for non-bricks nodes."
+
+
+### Setup OpenSRF and Evergreen on other OpenSRF Nodes.
+for OTHERNODE in utility01 sip01 sip02 reporter01
+       do
+       mkdir -p "$OUTDIR/$OTHERNODE/var/backup"
+       mkdir -p "$OUTDIR/$OTHERNODE/openils/var/data/offline"
+       mkdir -p "$OUTDIR/$OTHERNODE/openils/var/web/reporter"
+       mkdir -p "$OUTDIR/$OTHERNODE/etc/apache2/ssl" && cp -f "${CERT_DIR}/server.key" "$OUTDIR/$OTHERNODE/etc/apache2/ssl"
+       cp -f "${CERT_DIR}/server.crt" "$OUTDIR/$OTHERNODE/etc/apache2/ssl"
+       [ -e "${CERT_DIR}/ca.crt" ] && cp -f "${CERT_DIR}/ca.crt" "$OUTDIR/$OTHERNODE/etc/apache2/ssl"
+       [ -e "${CUSTOMDIR}/zips.txt" ] && cp -f "${CUSTOMDIR}/zips.txt"  "$OUTDIR/$OTHERNODE/openils/var/data/zips.txt"
+       mkdir -p "$OUTDIR/$OTHERNODE/openils/conf" && cp -f "$TEMPLATEDIR/opensrf_core.xml" "$OUTDIR/${OTHERNODE}/openils/conf"
+       #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
+       cp -f "$TEMPLATEDIR/oils_web.xml" "$OUTDIR/$OTHERNODE/openils/conf"
+       echo ${OTHERNODE} >> $TMPOSRFNODES
+done
+
+### copy completed opensrf file to their respective locations.
+for OSRF_NODE in utility01 sip01 sip02 reporter01
+       do
+       cp -f "$TMPOPENSRF_XML" "$OUTDIR/$OSRF_NODE/openils/conf/opensrf.xml"
+       cat $TEMPLATEDIR/opensrf.xml/opensrf.xml-footer >> "$OUTDIR/$OTHERNODE/openils/conf/opensrf.xml"
+done
+
+
+### Setup SIP
+echo
+echo "Setting up SIP.."
+for SIPNODE in sip01 sip02
+       do
+       mkdir -p "$OUTDIR/$SIPNODE/opt"
+       mkdir -p "$OUTDIR/$SIPNODE/etc/init.d"
+       mkdir -p "$OUTDIR/$SIPNODE/etc/cron.d"
+       mkdir -p "$OUTDIR/$SIPNODE/var/www"
+       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/"
+       cp -f $TEMPLATEDIR/SIP/index.html "$OUTDIR/$SIPNODE/var/www"
+done
+echo "Done setting up SIP."
+
+
+
+### Setup Logger.
+echo
+echo "Setting up logger"
+mkdir -p "$OUTDIR/logger01/etc/rsyslog.d"
+cp -f "$TEMPLATEDIR/opensrf-rsyslog.conf" "$OUTDIR/logger01/etc/rsyslog.d"
+echo "Done setting up logger"
+
+### Setup DB - !!More stuff to do here for sure.
+for DB_SERVER in db01 db02 db03
+       do
+       mkdir -p $OUTDIR/${DB_SERVER}/etc/init.d
+       mkdir -p $OUTDIR/${DB_SERVER}/etc/postgresql/$PSQL_VERSION/main
+       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/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"
+       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
+
+done
+
+### setup exports for backup 
+cp -f "/tmp/exports_backup" "$OUTDIR/backup01/etc/exports"
+mkdir -p "$OUTDIR/backup01/var/backup"
+
+
+### Setup system files for the node 
+### that hosts the reporter exports share
+
+Reports_NFS_Host () {
+### Setup hosts file
+mkdir -p "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/network" && \
+cp -f "$TMPHOSTS" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/hosts" && \
+sed -i "s^thishost^$HOSTS^g" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/hosts"
+
+### Configure interfaces file
+cp -f "$TEMPLATEDIR/interfaces" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/network" && \
+eval sed -i "s^Priv_IP^\$${REPORTS_NFS_HOSTNAME_IP^^*}_IP^g" "$OUTDIR/${REPORTS_NFS_HOSTNAME}/etc/network/interfaces"
+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"
+
+### 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"
+}
+
+if ! grep -q "reporter0\|db0" ${REPORTS_NFS_HOSTNAME} 2>/dev/null
+       then
+       Reports_NFS_Host
+fi
+
+### Write config info file.
+echo >> "$NETCFGFILE"
+echo "Cluster Public (shared) IP Address set to : $CLUSTERIPADDRESS" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "LVS" >> "$NETCFGFILE"
+echo "lvs01 Public Physical IP Address set to : $LVS01_PHYSICAL_PUBLIC_IP" >> "$NETCFGFILE"
+echo "lvs01 Public Netmask Address set to : $CLUSTERNETMASK" >> "$NETCFGFILE"
+echo "lvs01 Public Gateway Address set to : $CLUSTERGATEWAY" >> "$NETCFGFILE"
+echo "lvs01 Private IP Address set to : $LVS01_PRIVATE_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "lvs02 Public Physical IP Address set to : $LVS02_PHYSICAL_PUBLIC_IP" >> "$NETCFGFILE"
+echo "lvs02 Public Netmask Address set to : $CLUSTERNETMASK" >> "$NETCFGFILE"
+echo "lvs02 Public Gateway Address set to : $CLUSTERGATEWAY" >> "$NETCFGFILE"
+echo "lvs02 Private IP Address set to : $LVS02_PRIVATE_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "DB">> "$NETCFGFILE"
+echo "db01 IP Address set to: $DB01_IP" >> "$NETCFGFILE"
+echo "db02 IP Address set to: $DB02_IP" >> "$NETCFGFILE"
+echo "db03 IP Address set to: $DB03_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "** Make sure the database server has a minimum of 128GB RAM" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Utility">> "$NETCFGFILE"
+echo "utility01 IP Address set to: $UTILITY01_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Logger" >> "$NETCFGFILE"
+echo "logger01 IP Address set to: $LOGGER01_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Sip" >> "$NETCFGFILE"
+echo "sip01 IP Address set to: $SIP01_IP" >> "$NETCFGFILE"
+echo "sip02 IP Address set to: $SIP02_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Backup" >> "$NETCFGFILE"
+echo "backup01 IP Address set to: $BACKUP01_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+#TODO: Verify reporter/db03
+echo "Reporter" >> "$NETCFGFILE"
+echo "reporter01 IP Address set to: $REPORTER01_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Reports" >> "$NETCFGFILE"
+echo "Reports Output NFS share host: $REPORTS_NFS_HOSTNAME" >> "$NETCFGFILE"
+echo "Reports Output NFS share host IP: $REPORTS_NFS_HOSTNAME_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Memcache" >> "$NETCFGFILE"
+echo "memcache01 IP Address set to: $MEMCACHE01_IP" >> "$NETCFGFILE"
+echo "memcache02 IP Address set to: $MEMCACHE02_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "** Make sure the memcache server has a minimum of 8GB RAM" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "monitor01 IP Address set to: $MONITOR01_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "admin01 IP Address set to: $ADMIN01_IP" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Database Username set to: $DB_USERNAME" >> "$NETCFGFILE"
+echo "Database Password set to: $DATABASE_PASSWORD" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "OpenSRF Username set to: $OSRF_USERNAME" >> "$NETCFGFILE"
+echo "OpenSRF Password set to: $OPENSRF_PASSWORD" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "Evergreen Administrator Username set to: $EG_ADMIN_USER" >> "$NETCFGFILE"
+echo "Evergreen Administrator Password set to: $EG_ADMIN_PASSWORD" >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+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
+
+cat $TEMPLATEDIR/opensrf.xml/opensrf.xml-footer >> $TMPOPENSRF_XML
+
+
+echo
+echo "Packaging files.  Just relax...."
+echo -e $COL_BR_GREEN
+
+Optimize_OpenSRF () { ### Optimize OpenSRF for non bricks
+#--- Optimize OpenSRF max_children
+sed -i "s^actor_MAX^40^g" openils/conf/opensrf.xml
+sed -i "s^search_MAX^40^g" openils/conf/opensrf.xml
+sed -i "s^cata_MAX^30^g" openils/conf/opensrf.xml
+sed -i "s^supercat_MAX^30^g" openils/conf/opensrf.xml
+sed -i "s^penalty_MAX^30^g" openils/conf/opensrf.xml
+sed -i "s^circ_MAX^30^g" openils/conf/opensrf.xml
+sed -i "s^ingest_MAX^40^g" openils/conf/opensrf.xml
+sed -i "s^storage_MAX^24^g" openils/conf/opensrf.xml
+sed -i "s^cstore_MAX^72^g" openils/conf/opensrf.xml
+sed -i "s^permacrud_MAX^25^g" openils/conf/opensrf.xml
+sed -i "s^fielder_MAX^25^g" openils/conf/opensrf.xml
+sed -i "s^vandelay_MAX^25^g" openils/conf/opensrf.xml
+#---
+}
+
+Optimize_Brick_OpenSRF () { ### Optimize OpenSRF for bricks
+
+#--- Optimize OpenSRF max_children
+sed -i "s^actor_MAX^60^g" openils/conf/opensrf.xml
+sed -i "s^search_MAX^80^g" openils/conf/opensrf.xml
+sed -i "s^cata_MAX^60^g" openils/conf/opensrf.xml
+sed -i "s^supercat_MAX^60^g" openils/conf/opensrf.xml
+sed -i "s^penalty_MAX^60^g" openils/conf/opensrf.xml
+sed -i "s^circ_MAX^60^g" openils/conf/opensrf.xml
+sed -i "s^ingest_MAX^80^g" openils/conf/opensrf.xml
+sed -i "s^storage_MAX^48^g" openils/conf/opensrf.xml
+sed -i "s^cstore_MAX^72^g" openils/conf/opensrf.xml
+sed -i "s^permacrud_MAX^50^g" openils/conf/opensrf.xml
+sed -i "s^fielder_MAX^50^g" openils/conf/opensrf.xml
+sed -i "s^vandelay_MAX^50^g" openils/conf/opensrf.xml
+#---
+}
+
+
+
+PkgFiles () { ### Package All files.
+for FOLDER in $(ls -d */)
+        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%/*})
+       #pushd $(echo -e ${FOLDER%/*})
+       if echo $WORK_DIR |grep -q reporter0 || \
+       echo $WORK_DIR |grep -q utility0 || \
+       echo $WORK_DIR |grep -q sip0
+               then
+               cp $TMPOPENSRF_XML openils/conf/opensrf.xml
+               Optimize_OpenSRF
+       fi
+        tar zcf ../$(echo -e ${FOLDER%/*}).tar.gz *
+       [ -e etc/hosts ] && tar zcf ../$(echo -e ${FOLDER%/*})_etc-hosts.tar.gz etc/hosts 
+        cd ..
+       #popd
+        if test -e brick0[1-9].tar.gz ; then rm brick0[1-9].tar.gz ; fi
+       if test -e brick0[1-9]_etc-hosts.tar.gz ; then rm brick0[1-9]_etc-hosts.tar.gz ; fi
+        [ -e "$(echo -e ${FOLDER%/*}).tar.gz" ] && mv $(echo -e ${FOLDER%/*}).tar.gz $(echo -e ${FOLDER%/*})
+       [ -e "$(echo -e ${FOLDER%/*})_etc-hosts.tar.gz" ] && mv $(echo -e ${FOLDER%/*})_etc-hosts.tar.gz $(echo -e ${FOLDER%/*})
+done
+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
+                       
+                       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
+                       fi
+                       cp $TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz ../setup_${SUBFOLDER}
+                       mv setup*.sh ../setup_${SUBFOLDER}/setup_${SUBFOLDER}.sh
+                        tar zcf ../setup_${SUBFOLDER}/${SUBFOLDER}.tar.gz *
+                       tar zcf ../setup_${SUBFOLDER}/${SUBFOLDER}_etc-hosts.tar.gz etc/hosts
+                        cd ..
+                       tar zcf setup_${SUBFOLDER}.tar.gz setup_${SUBFOLDER}
+                       rm -rf setup_${SUBFOLDER}
+                done
+        cd ..
+done
+printf " "
+}
+
+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"
+       if [ -e "$TEMPLATEDIR/apt/${NODE_FOLDER}_apt.list" ]
+               then
+                cp "$TEMPLATEDIR/apt/${NODE_FOLDER}_apt.list" "setup_${NODE_FOLDER}"
+                       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}"
+               #Optimize_OpenSRF
+       fi
+       if echo ${NODE_FOLDER} | grep -q sip0
+               then
+               cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}"
+               #Optimize_OpenSRF
+       fi
+       sed -i "s^tar_file^$NODE_FOLDER^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh"
+       sed -i "s^_GENVER^$VERSION_^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^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
+}
+
+# We package the extra host here because of conflicts
+
+cd $OUTDIR
+PkgBricks
+PkgFiles
+#PkgOthers
+for NODE_FOLDER in lvs01 lvs02 db01 db02 db03 logger01 utility01 sip01 sip02 reporter01 memcache01 memcache02 backup01 admin01
+       do
+       PkgOthers
+       printf '. \r'
+done
+if [ "$ADD_REPORTS_SHARE" = "1" ]
+        then
+       printf " \n"
+       echo -e $COL_RESET packaging ${REPORTS_NFS_HOSTNAME}
+       NODE_FOLDER="${REPORTS_NFS_HOSTNAME}"
+       PkgOthers
+       printf '. \r'
+
+fi
+
+rm -f /tmp/debconf-settings
+echo -e $COL_BR_BLUE
+cat "$NETCFGFILE"
+echo -e $COL_RESET
+
+echo -e $COL_BR_YELLOW"___________________________Installation Order____________________________"$COL_RESET
+echo -e $COL_BR_YELLOW"Important!"$COL_RESET "Copy the setup tar.gz files one at a time to their" 
+echo -e "respective nodes in the cluster, extract and run the installation" 
+echo -e "and reboot each one before starting on the next one." 
+echo -e "Install in the order listed below." 
+#echo -e $COL_RESET
+echo 
+if echo $REPORTS_NFS_HOSTNAME | grep -q reporter
+       then
+       echo -e $COL_BR_GREEN" lvs logger backup reporter db brick01-head other-bricks utility sip" $COL_RESET
+               else
+               echo -e $COL_BR_GREEN" lvs logger backup $REPORTS_NFS_HOSTNAME db brick01-head other-bricks reporter utility sip" $COL_RESET
+fi
+echo 
+echo -e $COL_BR_YELLOW"_________________________________________________________________________"$COL_RESET
+echo -e $COL_BR_RED "*** Please secure this file as it contains sensitvive information. ***" $COL_RESET
+
+
+echo "_______________________Installation Order_______________________" >> "$NETCFGFILE"
+echo "Important! Copy the setup tar.gz files one at a time to the respective" >> "$NETCFGFILE"
+echo "nodes in the cluster, extract and run the installation" >> "$NETCFGFILE"
+echo "and reboot each one before starting on the next one." >> "$NETCFGFILE"
+echo "Install in the order listed below." >> "$NETCFGFILE"
+echo >> "$NETCFGFILE"
+echo "lvs logger db brick01-head other-bricks reporter utility sip" >> "$NETCFGFILE"
+echo "" >> "$NETCFGFILE"
+echo "_________________________________________________________________________" >> "$NETCFGFILE"
+echo "*** Please secure this file as it contains sensitvive information. ***" >> "$NETCFGFILE"
+chmod 600 "$NETCFGFILE"
+
+echo
+echo -e $COL_BR_CYAN"Done! config files for the cluster are"
+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
diff --git a/License.txt b/License.txt
new file mode 100644 (file)
index 0000000..dce778d
--- /dev/null
@@ -0,0 +1,189 @@
+GNU GENERAL PUBLIC LICENSE
+
+Version 3, 29 June 2007
+
+Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+Preamble
+
+The GNU General Public License is a free, copyleft license for software and other kinds of works.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
+
+To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
+
+Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and modification follow.
+TERMS AND CONDITIONS
+0. Definitions.
+
+“This License” refers to version 3 of the GNU General Public License.
+
+“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
+
+“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
+
+To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
+
+A “covered work” means either the unmodified Program or a work based on the Program.
+
+To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
+
+To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
+
+An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
+1. Source Code.
+
+The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
+
+A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
+
+The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
+
+The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same work.
+2. Basic Permissions.
+
+All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
+
+When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
+4. Conveying Verbatim Copies.
+
+You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
+5. Conveying Modified Source Versions.
+
+You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
+
+    * a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
+    * b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
+    * c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
+    * d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
+
+A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
+6. Conveying Non-Source Forms.
+
+You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
+
+    * a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
+    * b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
+    * c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
+    * d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
+    * e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
+
+A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
+
+A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
+
+“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
+
+The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
+
+Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
+7. Additional Terms.
+
+“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
+
+    * a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
+    * b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
+    * c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
+    * d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
+    * e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
+    * f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
+
+All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
+8. Termination.
+
+You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
+9. Acceptance Not Required for Having Copies.
+
+You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
+10. Automatic Licensing of Downstream Recipients.
+
+Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
+
+An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
+11. Patents.
+
+A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
+
+A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
+
+In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
+
+A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
+12. No Surrender of Others' Freedom.
+
+If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
+13. Use with the GNU Affero General Public License.
+
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
+14. Revised Versions of this License.
+
+The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+15. Disclaimer of Warranty.
+
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+16. Limitation of Liability.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+17. Interpretation of Sections 15 and 16.
+
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
diff --git a/README.txt b/README.txt
new file mode 100644 (file)
index 0000000..5fe41f1
--- /dev/null
@@ -0,0 +1,29 @@
+Installation Notes:
+===================
+
+LVS failover with Heartbeat:
+For heartbeat to work properly between 
+both LVS servers you should have a null-modem serial
+cable connected to functioning serial ports /dev/ttyS1
+between both servers.
+
+Library IP based redirction:
+If you are going be using Library based redirection then
+copy a preconfigured lib_ips.txt file to the custom folder 
+before running GenaSYS.sh.
+
+Zip Codes for libraries:
+If you are using mutliple zip codes for libraries copy
+a preconfigured zips.txt file to the custom folder
+before running GenaSYS.sh.
+
+Action Trigger Filters:
+If you are using customized action trigger filters then copy
+the custom  action_trigger_filters.json file to the custom folder
+before running GenaSYS.sh.
+
+Custom Maintenance Page:
+If you are using a customized maintenance page
+then copy the custom index.html or index.php 
+file and any image files .jpg or .png to the custom folder
+before running GenaSYS.sh.
diff --git a/genasys.conf-dist b/genasys.conf-dist
new file mode 100644 (file)
index 0000000..1e5f876
--- /dev/null
@@ -0,0 +1,69 @@
+### The DNS domain name for this cluster? eg. gapines.org
+CLUSTERDOMAINNAME="example.org"
+
+### Use a CA Certificate [y/n]
+USE_CA_CERT="n"
+
+### The default brick config is 2 drones per head
+### Use the default head configuration. [y/n]
+USE_STANDARD_HEAD_CONFIG="y"
+
+### Use separate drones
+### if not using the default brick config - [y/n]
+USEDRONES="y"
+
+### Number of separate drones
+### if not using the default brick config - [1-9]
+DRONECOUNT="2"
+
+### Number of bricks in the cluster - [1-9]
+BRICKCOUNT="2"
+
+### Hostname for the node that will be hosting
+### the reports output directory eg. reporter01
+REPORTS_NFS_HOSTNAME="storage01"
+
+### Password for the user 'opensrf'
+OPENSRF_PASSWORD="change-password"
+
+### Evergreen database password
+DATABASE_PASSWORD="change-password"
+
+### Evergreen admin User
+EG_ADMIN_USER="admin"
+
+### Evergreen admin Password
+EG_ADMIN_PASSWORD="change-password"
+
+### Use default private network - [y/n]
+USE_STANDARD_PRIVATE_NETWORK="y"
+
+### Private network IP address if not using
+### the default. First 3 octets. eg. 10.0.1
+PRIVATENET="10.0.1"
+
+
+### The public IP address for the cluster
+### will be used for LVS Director and Heartbeat.
+### This address is the "virtual" address and
+### will be *shared* between two LVS machines in the cluster.
+### Enter the public IP address for the cluster.
+CLUSTERIPADDRESS="192.168.5.55"
+
+### The netmask that corresponds to the
+### public IP address entered above
+CLUSTERNETMASK="255.255.255.0"
+
+### The gateway that corresponds to the
+### public IP address entered above
+CLUSTERGATEWAY="192.168.5.1"
+
+
+### The LVS servers must have a physical public address assigned to
+### each server independent of the shared address entered above.
+### In this case the defaults are lvs01 and lvs02
+
+#---First LVS server---
+LVS01_PHYSICAL_PUBLIC_IP="192.168.5.56"
+#---Second LVS server---
+LVS02_PHYSICAL_PUBLIC_IP="192.168.5.57"
diff --git a/templates/Net-Z3950-SimpleServer-1.12.tar.gz b/templates/Net-Z3950-SimpleServer-1.12.tar.gz
new file mode 100644 (file)
index 0000000..c6a7d0c
Binary files /dev/null and b/templates/Net-Z3950-SimpleServer-1.12.tar.gz differ
diff --git a/templates/SIP/SIPServer.tar.gz b/templates/SIP/SIPServer.tar.gz
new file mode 100644 (file)
index 0000000..1563f80
Binary files /dev/null and b/templates/SIP/SIPServer.tar.gz differ
diff --git a/templates/SIP/eg_sip_root.crontab b/templates/SIP/eg_sip_root.crontab
new file mode 100644 (file)
index 0000000..9b61e29
--- /dev/null
@@ -0,0 +1 @@
+0 0 * * * /etc/init.d/oils_sip restart
diff --git a/templates/SIP/index.html b/templates/SIP/index.html
new file mode 100644 (file)
index 0000000..c17c1be
--- /dev/null
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Evergreen Maintenance Page</title>
+</head>
+<body>
+<center><img src="http://open-ils.org/img/evergreen_logo.gif" /></center>
+<center><h1>Evergreen is currently down for maintenance.  We apologize for the inconvenience.</h1></center>
+</body></html>
diff --git a/templates/SIP/sip.init b/templates/SIP/sip.init
new file mode 100755 (executable)
index 0000000..32fa82e
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          sip
+# Required-Start:    $local_fs $remote_fs $network $syslog opensrf
+# Required-Stop:     $local_fs $remote_fs $network $syslog 
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# X-Interactive:     true
+# Short-Description: Start/stop Open-ILS SIP Server.
+### END INIT INFO
+. /lib/lsb/init-functions
+
+OPENILS_BASE="/openils"
+OPENILS_CORE="${OPENILS_BASE}/conf/opensrf_core.xml"
+SRU_LOG="${OPENILS_BASE}/var/log/sru.log"
+
+PIDFILES="${OPENILS_BASE}/var/run"
+SIP_CONF="${OPENILS_BASE}/conf/oils_sip.xml"
+
+REP_LOCK="${OPENILS_BASE}/var/lock/reporter-LOCK"
+REP_NAME="Clark Kent, waiting for trouble"
+
+sru_name='simple2zoom'
+
+export PATH=$PATH:${OPENILS_BASE}/bin
+
+if [ $(whoami) != 'opensrf' ]; then
+ PERL5LIB='/openils/lib/perl5:$PERL5LIB';
+fi;
+
+start_sip() {
+        sleep 3
+       #log_daemon_msg "Starting 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 start_sip"
+}
+
+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"
+}
+
+
+case "$1" in
+    start)
+        start_sip
+    ;;
+    stop)
+        stop_sip
+    ;;
+    restart)
+       log_daemon_msg "Restarting SIP Services Evergreen:"
+        stop_sip
+       sleep 2
+        start_sip
+    ;;
+*)
+        echo " * Usage: /etc/init.d/sip {start|stop|restart|autogen}"
+        exit 1
+    ;;
+esac;
diff --git a/templates/action_trigger_filters.json b/templates/action_trigger_filters.json
new file mode 100644 (file)
index 0000000..d599d7b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+"checkout.due" :
+    { "context_org" : "circ_lib",
+      "filter"      :
+            { "checkin_time"  : null,
+              "-or"           :
+                    [ { "stop_fines"  : ["MAXFINES", "LONGOVERDUE"] },
+                      { "stop_fines"  : null }
+                    ]
+            }
+    },
+    "hold_request.shelf_expires_soon" : {
+        "context_org": "pickup_lib",
+        "filter": {
+            "shelf_expire_time": {"!=": null},
+            "capture_time": {"!=": null},
+            "current_copy": {"!=": null},
+            "shelf_time": {"!=": null},
+            "cancel_time": null
+        }
+    },
+    "hold_request.long_wait" : {
+        "context_org": "pickup_lib",
+        "filter": {
+            "frozen": "f",
+            "cancel_time": null,
+            "capture_time": null
+        }
+    }
+}
diff --git a/templates/apache2/apache2.conf b/templates/apache2/apache2.conf
new file mode 100644 (file)
index 0000000..ecf1c9f
--- /dev/null
@@ -0,0 +1,230 @@
+#
+# Based upon the NCSA server configuration files originally by Rob McCool.
+#
+# This is the main Apache server configuration file.  It contains the
+# configuration directives that give the server its instructions.
+# See http://httpd.apache.org/docs/2.2/ for detailed information about
+# the directives.
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do.  They're here only as hints or reminders.  If you are unsure
+# consult the online docs. You have been warned.  
+#
+# The configuration directives are grouped into three basic sections:
+#  1. Directives that control the operation of the Apache server process as a
+#     whole (the 'global environment').
+#  2. Directives that define the parameters of the 'main' or 'default' server,
+#     which responds to requests that aren't handled by a virtual host.
+#     These directives also provide default values for the settings
+#     of all virtual hosts.
+#  3. Settings for virtual hosts, which allow Web requests to be sent to
+#     different IP addresses or hostnames and have them handled by the
+#     same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path.  If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "foo.log"
+# with ServerRoot set to "/etc/apache2" will be interpreted by the
+# server as "/etc/apache2/foo.log".
+#
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE!  If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation (available
+# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+# Do NOT add a slash at the end of the directory path.
+#
+#ServerRoot "/etc/apache2"
+
+#
+# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
+#
+LockFile ${APACHE_LOCK_DIR}/accept.lock
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+# This needs to be set in /etc/apache2/envvars
+#
+PidFile ${APACHE_PID_FILE}
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 1
+
+##
+## Server-Pool Size Regulation (MPM specific)
+## 
+
+# prefork MPM
+# StartServers: number of server processes to start
+# MinSpareServers: minimum number of server processes which are kept spare
+# MaxSpareServers: maximum number of server processes which are kept spare
+# MaxClients: maximum number of server processes allowed to start
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_prefork_module>
+    StartServers         20 
+    MinSpareServers       5
+    MaxSpareServers      15
+    MaxClients          150
+    MaxRequestsPerChild   10000
+</IfModule>
+
+# worker MPM
+# StartServers: initial number of server processes to start
+# MaxClients: maximum number of simultaneous client connections
+# MinSpareThreads: minimum number of worker threads which are kept spare
+# MaxSpareThreads: maximum number of worker threads which are kept spare
+# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
+#              graceful restart. ThreadLimit can only be changed by stopping
+#              and starting Apache.
+# ThreadsPerChild: constant number of worker threads in each server process
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_worker_module>
+    StartServers          2
+    MinSpareThreads      25
+    MaxSpareThreads      75 
+    ThreadLimit          64
+    ThreadsPerChild      25
+    MaxClients          150
+    MaxRequestsPerChild   0
+</IfModule>
+
+# event MPM
+# StartServers: initial number of server processes to start
+# MaxClients: maximum number of simultaneous client connections
+# MinSpareThreads: minimum number of worker threads which are kept spare
+# MaxSpareThreads: maximum number of worker threads which are kept spare
+# ThreadsPerChild: constant number of worker threads in each server process
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_event_module>
+    StartServers          2
+    MaxClients          150
+    MinSpareThreads      25
+    MaxSpareThreads      75 
+    ThreadLimit          64
+    ThreadsPerChild      25
+    MaxRequestsPerChild   0
+</IfModule>
+
+# These need to be set in /etc/apache2/envvars
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for additional configuration directives.  See also the AllowOverride
+# directive.
+#
+
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess and .htpasswd files from being 
+# viewed by Web clients. 
+#
+<Files ~ "^\.ht">
+    Order allow,deny
+    Deny from all
+    Satisfy all
+</Files>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value.  If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here.  If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+ErrorLog ${APACHE_LOG_DIR}/error.log
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+# Include module configuration:
+Include mods-enabled/*.load
+Include mods-enabled/*.conf
+
+# Include all the user configurations:
+Include httpd.conf
+
+# Include ports listing
+Include ports.conf
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
+#
+LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
+LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %O" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+# Include of directories ignores editors' and dpkg's backup files,
+# see README.Debian for details.
+
+# Include generic snippets of statements
+Include conf.d/
+
+# Include the virtual host configurations:
+Include sites-enabled/
diff --git a/templates/apache2/eg.conf b/templates/apache2/eg.conf
new file mode 100644 (file)
index 0000000..cdc9ca8
--- /dev/null
@@ -0,0 +1,150 @@
+# :vim set syntax apache
+
+LogLevel info 
+# - log locally
+#CustomLog /var/log/apache2/access.log combined
+#ErrorLog /var/log/apache2/error.log
+# - log to syslog 
+CustomLog "|/usr/bin/logger -p local7.info" common
+ErrorLog syslog:local7
+
+
+# ----------------------------------------------------------------------------------
+# Set up Perl 
+# ----------------------------------------------------------------------------------
+
+# - needed by CGIs
+PerlRequire /etc/apache2/startup.pl
+PerlChildInitHandler OpenILS::WWW::Reporter::child_init
+PerlChildInitHandler OpenILS::WWW::SuperCat::child_init
+PerlChildInitHandler OpenILS::WWW::AddedContent::child_init
+PerlChildInitHandler OpenILS::WWW::PasswordReset::child_init
+
+# ----------------------------------------------------------------------------------
+# Set some defaults for our working directories
+# ----------------------------------------------------------------------------------
+<Directory /openils/var/web>
+    Order allow,deny
+    Allow from all
+</Directory>
+
+
+# ----------------------------------------------------------------------------------
+# XUL directory
+# ----------------------------------------------------------------------------------
+<Directory /openils/var/web/xul>
+   Options Indexes FollowSymLinks
+   AllowOverride None
+   Order allow,deny
+   Allow from all
+</Directory>
+
+
+# ----------------------------------------------------------------------------------
+# Remove the language portion from the URL
+# ----------------------------------------------------------------------------------
+AliasMatch ^/opac/.*/skin/(.*)/(.*)/(.*) /openils/var/web/opac/skin/$1/$2/$3
+AliasMatch ^/opac/.*/extras/slimpac/(.*) /openils/var/web/opac/extras/slimpac/$1
+AliasMatch ^/opac/.*/extras/selfcheck/(.*) /openils/var/web/opac/extras/selfcheck/$1
+
+
+
+# ----------------------------------------------------------------------------------
+# System config CGI scripts go here
+# ----------------------------------------------------------------------------------
+Alias /cgi-bin/offline/ "/openils/var/cgi-bin/offline/"
+<Directory "/openils/var/cgi-bin/offline">
+       AddHandler cgi-script .cgi .pl
+       AllowOverride None
+       Options None
+       Order deny,allow
+       Deny from all
+       Allow from 10.0.0.0/8
+       Options FollowSymLinks ExecCGI Indexes
+</Directory>
+
+
+# ----------------------------------------------------------------------------------
+# Updates folder
+# ----------------------------------------------------------------------------------
+Alias /updates/ "/openils/var/updates/pub/"
+<Directory "/openils/var/updates/pub">
+       <Files check>
+               ForceType cgi-script
+       </Files>
+       <Files update.rdf>
+               ForceType cgi-script
+       </Files>
+       <Files manualupdate.html>
+               ForceType cgi-script
+       </Files>
+       <Files download>
+               ForceType cgi-script
+       </Files>
+       AllowOverride None
+       Options None
+       Allow from all
+       Options ExecCGI
+</Directory>
+
+
+# ----------------------------------------------------------------------------------
+# OPTIONAL: Set how long the client will cache our content.  Change to suit
+# ----------------------------------------------------------------------------------
+ExpiresActive On
+ExpiresDefault A2592000
+ExpiresByType text/html A64800
+ExpiresByType application/xhtml+xml A64800
+ExpiresByType application/x-javascript A64800
+ExpiresByType application/javascript A64800
+ExpiresByType text/css A3000
+
+# ----------------------------------------------------------------------------------
+# Set up our SSL virtual host
+# ----------------------------------------------------------------------------------
+#Listen 443
+NameVirtualHost *:443
+<VirtualHost *:443>
+       DocumentRoot "/openils/var/web"
+       ServerName localhost:443
+       ServerAlias 127.0.0.1:443
+       SSLEngine on
+       SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+
+    # If you don't have an SSL cert, you can create self-signed 
+    # certificate and key with:
+    # 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
+
+    # help IE along with SSL pages
+    SetEnvIf User-Agent ".*MSIE [1-5].*" \
+        nokeepalive ssl-unclean-shutdown \
+        downgrade-1.0 force-response-1.0
+
+    SetEnvIf User-Agent ".*MSIE [6-9].*" \
+        ssl-unclean-shutdown
+
+</VirtualHost>
+
+# ----------------------------------------------------------------------------------
+# Set up our main virtual host
+# Port 80 comes after 443 to avoid "unknown protocol speaking not SSL to HTTPS port!?" 
+# errors, per http://wiki.apache.org/httpd/InternalDummyConnection
+# ----------------------------------------------------------------------------------
+
+# Commented to avoid warnings from duplicate "NameVirtualHost: *80" directives
+#NameVirtualHost *:80
+<VirtualHost *:80>
+       ServerName localhost:80
+       ServerAlias 127.0.0.1:80
+       DocumentRoot /openils/var/web/
+       DirectoryIndex index.xml index.html index.xhtml
+    # - absorb the shared virtual host settings
+    Include eg_vhost.conf
+</VirtualHost>
+
diff --git a/templates/apache2/eg_vhost.conf b/templates/apache2/eg_vhost.conf
new file mode 100644 (file)
index 0000000..379a35d
--- /dev/null
@@ -0,0 +1,637 @@
+# ----------------------------------------------------------------------------------
+# This is the global Evergreen virtual host config.  Anything you want published
+# through all virtual hosts (port 80, port 443, etc.) should live in here.
+# ----------------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------------
+# 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]
+
+# ----------------------------------------------------------------------------------
+# Point / to the IP address redirector
+# ----------------------------------------------------------------------------------
+#<LocationMatch ^/$>
+#    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"
+#    allow from all
+#</LocationMatch>
+
+
+# ----------------------------------------------------------------------------------
+# Assign a default locale to the accessible OPAC
+# ----------------------------------------------------------------------------------
+RedirectMatch 301 ^/opac/extras/slimpac/start.html$    /opac/en-US/extras/slimpac/start.html
+RedirectMatch 301 ^/opac/extras/slimpac/advanced.html$ /opac/en-US/extras/slimpac/advanced.html
+
+# ----------------------------------------------------------------------------------
+# Configure the gateway
+# ----------------------------------------------------------------------------------
+OSRFGatewayConfig /openils/conf/opensrf_core.xml
+# Translator memcache server.  Default is localhost
+# OSRFTranslatorCacheServer 127.0.0.1:11211
+
+
+# ----------------------------------------------------------------------------------
+# Added content plugin
+# ----------------------------------------------------------------------------------
+<Location /opac/extras/ac/>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::AddedContent
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Replace broken cover images with a transparent GIF by default
+# ----------------------------------------------------------------------------------
+RewriteEngine ON
+RewriteRule ^/opac/extras/ac/jacket/(small|medium|large)/$ \
+    /opac/images/blank.png [P,L]
+
+# ----------------------------------------------------------------------------------
+# Add the row ID (RID) and date so we can make unAPI happy
+# ----------------------------------------------------------------------------------
+RewriteCond %{QUERY_STRING} (^r|&r)=(\d+)
+RewriteRule . - [E=OILS_OPAC_RID:%2,E=OILS_TIME_YEAR:%{TIME_YEAR}]
+
+# ----------------------------------------------------------------------------------
+# Pull the locale from the URL
+# ----------------------------------------------------------------------------------
+RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
+RewriteRule . - [E=locale:%1]
+
+# ----------------------------------------------------------------------------------
+# Configure the OPAC
+# ----------------------------------------------------------------------------------
+<LocationMatch /opac/>
+    AddType application/xhtml+xml .xml
+   
+    # - configure mod_xmlent
+    XMLEntStripPI "yes"
+    XMLEntEscapeScript "no"
+    XMLEntStripComments "yes"
+    XMLEntContentType "text/html; charset=utf-8"
+    # forces quirks mode which we want for now
+    XMLEntStripDoctype "yes" 
+
+    # - set up the include handlers
+    Options +Includes
+    AddOutputFilter INCLUDES .xsl
+    AddOutputFilter INCLUDES;XMLENT .xml
+                   
+    SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/
+    
+    # This gives you the option to configure a different host to serve OPAC images from
+    # Specify the hostname (without protocol) and path to the images.  Protocol will
+    # be determined at runtime
+    #SetEnvIf Request_URI ".*" OILS_OPAC_IMAGES_HOST=static.example.org/opac/
+
+    # In addition to loading images from a static host, you can also load CSS and/or
+    # Javascript from a static host or hosts. Protocol will be determined at runtime
+    # and/or by configuration options immediately following.
+    #SetEnvIf Request_URI ".*" OILS_OPAC_CSS_HOST=static.example.org/opac/
+    #SetEnvIf Request_URI ".*" OILS_OPAC_JS_HOST=static.example.org/opac/
+
+    # If you are not able to serve static content via https and 
+    # wish to force http:// (and are comfortable with mixed-content
+    # warnings in client browsers), set this:
+    #SetEnvIf Request_URI ".*" OILS_OPAC_STATIC_PROTOCOL=http
+
+    # If you would prefer to fall back to your non-static servers for 
+    # https pages, avoiding mixed-content warnings in client browsers
+    # and are willing to accept some increased server load, set this:
+    #SetEnvIf Request_URI ".*" OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=yes
+
+    # Specify a ChiliFresh account to integrate their services with the OPAC
+    #SetEnv OILS_CHILIFRESH_ACCOUNT
+    #SetEnv OILS_CHILIFRESH_PROFILE
+    #SetEnv OILS_CHILIFRESH_URL http://chilifresh.com/on-site/js/evergreen.js
+
+    # Specify the initial script URL for Novelist (containing account credentials, etc.)
+    #SetEnv OILS_NOVELIST_URL
+    
+
+    # Uncomment to force SSL any time a patron is logged in.  This protects 
+    # authentication tokens.  Left commented out for backwards compat for now.
+    #SetEnv OILS_OPAC_FORCE_LOGIN_SSL 1
+
+
+    # If set, the skin uses the combined JS file at $SKINDIR/js/combined.js
+    #SetEnv OILS_OPAC_COMBINED_JS 1
+
+</LocationMatch>
+
+<Location /opac/>
+    # ----------------------------------------------------------------------------------
+    # Some mod_deflate fun
+    # ----------------------------------------------------------------------------------
+    <IfModule mod_deflate.c>
+        SetOutputFilter DEFLATE
+
+        BrowserMatch ^Mozilla/4 gzip-only-text/html
+        BrowserMatch ^Mozilla/4\.0[678] no-gzip
+        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
+
+        SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+
+        <IfModule mod_headers.c>
+            Header append Vary User-Agent env=!dont-vary
+        </IfModule>
+    </IfModule>
+
+</Location>
+
+<Location //opac/>
+    # ----------------------------------------------------------------------------------
+    # Some mod_deflate fun
+    # ----------------------------------------------------------------------------------
+    <IfModule mod_deflate.c>
+        SetOutputFilter DEFLATE
+
+        BrowserMatch ^Mozilla/4 gzip-only-text/html
+        BrowserMatch ^Mozilla/4\.0[678] no-gzip
+        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
+
+        SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+
+        <IfModule mod_headers.c>
+            Header append Vary User-Agent env=!dont-vary
+        </IfModule>
+    </IfModule>
+
+</Location>
+
+<Location /js/>
+    # ----------------------------------------------------------------------------------
+    # Some mod_deflate fun
+    # ----------------------------------------------------------------------------------
+    <IfModule mod_deflate.c>
+        SetOutputFilter DEFLATE
+
+        BrowserMatch ^Mozilla/4 gzip-only-text/html
+        BrowserMatch ^Mozilla/4\.0[678] no-gzip
+        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
+
+        SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+
+        <IfModule mod_headers.c>
+            Header append Vary User-Agent env=!dont-vary
+        </IfModule>
+    </IfModule>
+
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Force SSL on the OPAC's "My Account" page
+# ----------------------------------------------------------------------------------
+<LocationMatch .*/myopac.xml>
+    SSLRequireSSL
+</LocationMatch>
+
+<LocationMatch /opac/extras/>
+    # Force to en-US for now to satisfy bbags.xml
+    SetEnv locale en-US
+    Options +Includes
+    AddOutputFilter INCLUDES .xml
+    AddType application/xhtml+xml .xml
+</LocationMatch>
+
+RewriteCond %{QUERY_STRING} locale=([^&]*)
+RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redirect]
+<LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/>
+    AddOutputFilter INCLUDES;XMLENT .html
+</LocationMatch>
+
+# ----------------------------------------------------------------------------------
+# 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]
+
+# 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]
+
+<LocationMatch /xul/.*\.x?html$>
+    Options +Includes
+    XMLEntEscapeScript "no"
+    XMLEntStripComments "yes"
+    XMLEntStripPI "yes"
+    XMLEntStripDoctype "yes"
+    XMLEntContentType "text/html; charset=utf-8"
+    AddOutputFilter INCLUDES;XMLENT .xhtml
+    AddOutputFilter INCLUDES;XMLENT .html
+    SetEnv no-gzip
+    allow from all
+</LocationMatch>
+
+
+<LocationMatch /xul/.*\.xul$>
+    Options +Includes
+    XMLEntContentType "application/vnd.mozilla.xul+xml"
+    AddOutputFilter INCLUDES;XMLENT .xul
+    SetEnv no-gzip
+    allow from all
+</LocationMatch>
+
+# ----------------------------------------------------------------------------------
+# Self-serve password interface
+# ----------------------------------------------------------------------------------
+<Location /opac/password>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::PasswordReset::password_reset
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+
+    # Force clients to use HTTPS
+    RewriteCond %{HTTPS} !=on [NC]
+    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Supercat feeds
+# ----------------------------------------------------------------------------------
+<Location /opac/extras/oisbn>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::oisbn
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/supercat>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::supercat
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/unapi>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::unapi
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/feed/bookbag>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::bookbag_feed
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/opensearch>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::opensearch_feed
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/sru>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::sru_search
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/sru_auth>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::sru_auth_search
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/feed/freshmeat>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::changes_feed
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+<Location /opac/extras/browse>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::string_browse
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>    
+<Location /opac/extras/startwith>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::SuperCat::string_startwith
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>    
+       
+# ----------------------------------------------------------------------------------
+# Module for displaying OpenSRF API documentation
+# ----------------------------------------------------------------------------------
+<Location /opac/extras/docgen.xsl>
+    AddOutputFilter INCLUDES .xsl
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Module for processing staff-client offline scripts lives here
+# ----------------------------------------------------------------------------------
+<Directory "/openils/var/cgi-bin/offline">
+    AddHandler cgi-script .pl
+    AllowOverride None
+    Options +ExecCGI
+    allow from all
+</Directory>
+       
+       
+# ----------------------------------------------------------------------------------
+# XXX Note, it's important to explicitly set the JSON encoding style 
+# (OSRFGatewayLegacyJSON), since the default encoding style will likely change 
+# with OpenSRF 1.0
+# ----------------------------------------------------------------------------------
+# OpenSRF JSON legacy gateway
+# ----------------------------------------------------------------------------------
+<Location /gateway>
+    SetHandler osrf_json_gateway_module
+    OSRFGatewayLegacyJSON "true"
+    allow from all
+</Location>
+# ----------------------------------------------------------------------------------
+# New-style OpenSRF JSON gateway
+# ----------------------------------------------------------------------------------
+<Location /osrf-gateway-v1>
+    SetHandler osrf_json_gateway_module
+    OSRFGatewayLegacyJSON "false"
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# OpenSRF-over-HTTP translator
+# (http://open-ils.org/dokuwiki/doku.php?id=opensrf_over_http)
+# ----------------------------------------------------------------------------------
+<Location /osrf-http-translator>
+    SetHandler osrf_http_translator_module
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# The exporter lives here
+# ----------------------------------------------------------------------------------
+<Location /exporter>
+    SetHandler perl-script
+    PerlSetVar OILSProxyTitle "Exporter Login"
+    PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to export records"
+    PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
+    PerlHandler OpenILS::WWW::Proxy OpenILS::WWW::Exporter
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+
+<Location /opac/extras/merge_template>
+    SetHandler perl-script
+    PerlSetVar OILSProxyTitle "Batch Update Login"
+    PerlSetVar OILSProxyDescription "Please log in to update records in batch"
+    PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
+    PerlHandler OpenILS::WWW::Proxy OpenILS::WWW::TemplateBatchBibUpdate
+    PerlSendHeader On
+    Options +ExecCGI
+    allow from all
+</Location>
+
+<Location /opac/extras/circ>
+    SetHandler perl-script
+    PerlSetVar OILSProxyTitle "Circ Extras Login"
+    PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to export records"
+    PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
+    PerlHandler OpenILS::WWW::Proxy
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Reporting output lives here
+# ----------------------------------------------------------------------------------
+<Location /reporter/>
+    SetHandler perl-script
+    PerlSetVar OILSProxyTitle "Report Login"
+    PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to view this report"
+    PerlSetVar OILSProxyPermissions "VIEW_REPORT_OUTPUT"
+    PerlHandler OpenILS::WWW::Proxy
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Selfcheck interface
+# ----------------------------------------------------------------------------------
+<LocationMatch .*/selfcheck.xml>
+    SetHandler perl-script
+    PerlSetVar OILSProxyTitle "Self-check Login"
+    PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to activate the self-check interface"
+    PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
+    PerlHandler OpenILS::WWW::Proxy
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</LocationMatch>
+
+
+# ----------------------------------------------------------------------------------
+# Reports GUI
+# ----------------------------------------------------------------------------------
+<LocationMatch /reports>
+    Options +Includes
+    AddOutputFilter INCLUDES;XMLENT .xhtml
+</LocationMatch>
+
+<LocationMatch /reports/fm_IDL.xml>
+    IDLChunkStripPI "yes"
+    IDLChunkEscapeScript "no"
+    IDLChunkStripComments "yes"
+    IDLChunkStripDoctype "yes"
+    IDLChunkContentType "application/xml; charset=utf-8"
+    AddOutputFilter INCLUDES;IDLCHUNK .xml
+</LocationMatch>
+
+# ----------------------------------------------------------------------------------
+# EDI Message viewer
+# ----------------------------------------------------------------------------------
+<Location /edi>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::EDI
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>    
+
+# ----------------------------------------------------------------------------------
+# XML-RPC gateway
+# ----------------------------------------------------------------------------------
+<Location /xml-rpc>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::XMLRPCGateway
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Conify - next-generation Evergreen administration interface
+# ----------------------------------------------------------------------------------
+RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=locale:$1,L]
+<Location /conify>
+    Options +Includes
+    XMLEntStripPI "yes"
+    XMLEntEscapeScript "no"
+    XMLEntStripComments "no"
+    XMLEntContentType "text/html; charset=utf-8"
+    AddOutputFilter INCLUDES;XMLENT .html
+    SetHandler perl-script
+    PerlSetVar OILSProxyTitle "Dojo Admin Login"
+    PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to administer Evergreen"
+    PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
+    PerlHandler OpenILS::WWW::Proxy
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+
+# ----------------------------------------------------------------------------------
+# Vandelay importers / exporters (your Web interface to bibliographic travel)
+# ----------------------------------------------------------------------------------
+RedirectMatch 301 ^/vandelay/vandelay.xml(.*)$ /vandelay/en-US/vandelay.xml$1
+
+RewriteRule ^/vandelay/([a-z]{2}-[A-Z]{2})/(.*)$ /vandelay/$2 [E=locale:$1]
+
+<LocationMatch /vandelay.*xml>
+    XMLEntStripPI "yes"
+    XMLEntEscapeScript "no"
+    XMLEntStripComments "yes"
+    XMLEntContentType "text/html; charset=utf-8"
+    XMLEntStripDoctype "yes"
+    AddOutputFilter INCLUDES;XMLENT .xml
+       SetHandler perl-script
+       PerlSetVar OILSProxyTitle "Vandelay Login"
+       PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to import MARC records"
+       PerlSetVar OILSProxyPermissions "IMPORT_MARC"
+       PerlHandler OpenILS::WWW::Proxy
+       Options +ExecCGI
+       PerlSendHeader On
+       allow from all
+</LocationMatch>
+<Location /vandelay-upload>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::Vandelay::spool_marc
+    Options +ExecCGI
+    allow from all
+</Location>
+
+# OpenURL 0.1 searching based on OpenSearch
+RewriteMap openurl prg:/openils/bin/openurl_map.pl
+RewriteCond %{QUERY_STRING} (^.*$)
+RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
+
+
+
+# General Evergreen web template processor
+<Location /eg>
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::EGWeb
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+</Location>
+# 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.
+<LocationMatch ^/eg/.*(\.js|\.css|\.html|\.xhtml|\.xml|\.jpg|\.png|\.gif)$>
+    SetHandler None
+</LocationMatch>
+
+# ----------------------------------------------------------------------------------
+# Some mod_deflate logging setup
+# ----------------------------------------------------------------------------------
+<IfModule mod_deflate.c>
+    DeflateFilterNote Input instream
+    DeflateFilterNote Output outstream
+    DeflateFilterNote Ratio ratio
+
+    LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
+    CustomLog /var/log/apache2/deflate_log deflate
+
+    # There are problems with XMLENT and mod_deflate - so lets disable it
+    # This is where we don't have a pre-existing LocationMatch directive earlier
+    <LocationMatch /opac/.*\.xml$>
+        SetEnv no-gzip
+    </LocationMatch>
+    <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/.*\.html$>
+        SetEnv no-gzip
+    </LocationMatch>
+    <LocationMatch /reports/.*\.xhtml$>
+        SetEnv no-gzip
+    </LocationMatch>
+    <LocationMatch /conify/.*\.html$>
+        SetEnv no-gzip
+    </LocationMatch>
+</IfModule>
+
+
+<Location /IDL2js>
+
+    SetHandler perl-script
+    PerlHandler OpenILS::WWW::IDL2js
+    Options +ExecCGI
+    PerlSendHeader On
+    allow from all
+
+    <IfModule mod_headers.c>
+        Header append Cache-Control "public"
+    </IFModule>
+
+    <IfModule mod_deflate.c>
+        SetOutputFilter DEFLATE
+        BrowserMatch ^Mozilla/4 gzip-only-text/html
+        BrowserMatch ^Mozilla/4\.0[678] no-gzip
+        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
+        SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+        <IfModule mod_headers.c>
+            Header append Vary User-Agent env=!dont-vary
+        </IfModule>
+    </IfModule>
+</Location>
+
+# Uncomment the following to force SSL for everything. Note that this defeats caching
+# and you will suffer a performance hit.
+#RewriteCond %{HTTPS} off
+#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R,L]
+
+#copied to the bottom of this file from eg.conf
+CustomLog "|/usr/bin/logger -p local7.info" common
+ErrorLog syslog:local7
diff --git a/templates/apache2/startup.pl b/templates/apache2/startup.pl
new file mode 100755 (executable)
index 0000000..6f1a742
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+use OpenILS::WWW::Exporter qw( /openils/conf/opensrf_core.xml );
+use OpenILS::WWW::SuperCat qw( /openils/conf/opensrf_core.xml );
+use OpenILS::WWW::AddedContent qw( /openils/conf/opensrf_core.xml );
+use OpenILS::WWW::Proxy ('/openils/conf/opensrf_core.xml');
+use OpenILS::WWW::Vandelay qw( /openils/conf/opensrf_core.xml );
+use OpenILS::WWW::TemplateBatchBibUpdate qw( /openils/conf/opensrf_core.xml );
+use OpenILS::WWW::EGWeb ('/openils/conf/oils_web.xml');
+use OpenILS::WWW::PasswordReset ('/openils/conf/opensrf_core.xml');
+use OpenILS::WWW::IDL2js ('/openils/conf/opensrf_core.xml');
+
+# - 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:
+# - actor.org_unit.shortname <start_ip> <end_ip>
+# - e.g.  LIB123 10.0.0.1 10.0.0.254
+
+#use OpenILS::WWW::Redirect qw(/openils/conf/opensrf_core.xml);
+#OpenILS::WWW::Redirect->parse_ips_file('/openils/conf/lib_ips.txt');
+
+
+
+1;
+
diff --git a/templates/apt/admin01_apt.list b/templates/apt/admin01_apt.list
new file mode 100644 (file)
index 0000000..bb6b11a
--- /dev/null
@@ -0,0 +1 @@
+ntp gdebi-core
diff --git a/templates/apt/apt.list b/templates/apt/apt.list
new file mode 100644 (file)
index 0000000..1260022
--- /dev/null
@@ -0,0 +1 @@
+ntp gdebi-core ssh nfs-kernel-server
diff --git a/templates/apt/backup01_apt.list b/templates/apt/backup01_apt.list
new file mode 100644 (file)
index 0000000..2933bdc
--- /dev/null
@@ -0,0 +1 @@
+ntp nfs-kernel-server gdebi-core
diff --git a/templates/apt/db01_apt.list b/templates/apt/db01_apt.list
new file mode 100644 (file)
index 0000000..eb9f043
--- /dev/null
@@ -0,0 +1 @@
+ntp make gdebi-core
diff --git a/templates/apt/db02_apt.list b/templates/apt/db02_apt.list
new file mode 100644 (file)
index 0000000..eb9f043
--- /dev/null
@@ -0,0 +1 @@
+ntp make gdebi-core
diff --git a/templates/apt/db03_apt.list b/templates/apt/db03_apt.list
new file mode 100644 (file)
index 0000000..eb9f043
--- /dev/null
@@ -0,0 +1 @@
+ntp make gdebi-core
diff --git a/templates/apt/drone_apt.list b/templates/apt/drone_apt.list
new file mode 100644 (file)
index 0000000..bb6b11a
--- /dev/null
@@ -0,0 +1 @@
+ntp gdebi-core
diff --git a/templates/apt/head_apt.list b/templates/apt/head_apt.list
new file mode 100644 (file)
index 0000000..de6f3c1
--- /dev/null
@@ -0,0 +1 @@
+ntp apache2 nfs-kernel-server gdebi-core
diff --git a/templates/apt/logger01_apt.list b/templates/apt/logger01_apt.list
new file mode 100644 (file)
index 0000000..0137292
--- /dev/null
@@ -0,0 +1 @@
+ntp gdebi-core pigz
diff --git a/templates/apt/lvs01_apt.list b/templates/apt/lvs01_apt.list
new file mode 100644 (file)
index 0000000..5e5d2cb
--- /dev/null
@@ -0,0 +1 @@
+ldirectord bind9 ntp postfix gdebi-core heartbeat
diff --git a/templates/apt/lvs02_apt.list b/templates/apt/lvs02_apt.list
new file mode 100644 (file)
index 0000000..5e5d2cb
--- /dev/null
@@ -0,0 +1 @@
+ldirectord bind9 ntp postfix gdebi-core heartbeat
diff --git a/templates/apt/memcache01_apt.list b/templates/apt/memcache01_apt.list
new file mode 100644 (file)
index 0000000..8b4f5a2
--- /dev/null
@@ -0,0 +1 @@
+ntp memcached gdebi-core
diff --git a/templates/apt/memcache02_apt.list b/templates/apt/memcache02_apt.list
new file mode 100644 (file)
index 0000000..8b4f5a2
--- /dev/null
@@ -0,0 +1 @@
+ntp memcached gdebi-core
diff --git a/templates/apt/reporter01_apt.list b/templates/apt/reporter01_apt.list
new file mode 100644 (file)
index 0000000..9300184
--- /dev/null
@@ -0,0 +1 @@
+ntp gdebi-core nfs-kernel-server
diff --git a/templates/apt/sip01_apt.list b/templates/apt/sip01_apt.list
new file mode 100644 (file)
index 0000000..de6f3c1
--- /dev/null
@@ -0,0 +1 @@
+ntp apache2 nfs-kernel-server gdebi-core
diff --git a/templates/apt/sip02_apt.list b/templates/apt/sip02_apt.list
new file mode 100644 (file)
index 0000000..de6f3c1
--- /dev/null
@@ -0,0 +1 @@
+ntp apache2 nfs-kernel-server gdebi-core
diff --git a/templates/apt/utility01_apt.list b/templates/apt/utility01_apt.list
new file mode 100644 (file)
index 0000000..de6f3c1
--- /dev/null
@@ -0,0 +1 @@
+ntp apache2 nfs-kernel-server gdebi-core
diff --git a/templates/db/9.0/main/environment b/templates/db/9.0/main/environment
new file mode 100644 (file)
index 0000000..11e978b
--- /dev/null
@@ -0,0 +1,7 @@
+# environment variables for postmaster process
+# This file has the same syntax as postgresql.conf: 
+#  VARIABLE = simple_value
+#  VARIABLE2 = 'any value!'
+# I. e. you need to enclose any value which does not only consist of letters,
+# numbers, and '-', '_', '.' in single quotes. Shell commands are not
+# evaluated.
diff --git a/templates/db/9.0/main/pg_ctl.conf b/templates/db/9.0/main/pg_ctl.conf
new file mode 100644 (file)
index 0000000..d33e363
--- /dev/null
@@ -0,0 +1,5 @@
+# Automatic pg_ctl configuration
+# This configuration file contains cluster specific options to be passed to
+# pg_ctl(1).
+
+pg_ctl_options = ''
diff --git a/templates/db/9.0/main/pg_hba.conf b/templates/db/9.0/main/pg_hba.conf
new file mode 100644 (file)
index 0000000..80e8746
--- /dev/null
@@ -0,0 +1,93 @@
+# PostgreSQL Client Authentication Configuration File
+# ===================================================
+#
+# Refer to the "Client Authentication" section in the PostgreSQL
+# documentation for a complete description of this file.  A short
+# synopsis follows.
+#
+# This file controls: which hosts are allowed to connect, how clients
+# are authenticated, which PostgreSQL user names they can use, which
+# databases they can access.  Records take one of these forms:
+#
+# local      DATABASE  USER  METHOD  [OPTIONS]
+# host       DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTIONS]
+# hostssl    DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTIONS]
+# hostnossl  DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTIONS]
+#
+# (The uppercase items must be replaced by actual values.)
+#
+# The first field is the connection type: "local" is a Unix-domain
+# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
+# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
+# plain TCP/IP socket.
+#
+# DATABASE can be "all", "sameuser", "samerole", "replication", a
+# database name, or a comma-separated list thereof.
+#
+# USER can be "all", a user name, a group name prefixed with "+", or a
+# comma-separated list thereof.  In both the DATABASE and USER fields
+# you can also write a file name prefixed with "@" to include names
+# from a separate file.
+#
+# CIDR-ADDRESS specifies the set of hosts the record matches.  It is
+# made up of an IP address and a CIDR mask that is an integer (between
+# 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies the number
+# of significant bits in the mask.  Alternatively, you can write an IP
+# address and netmask in separate columns to specify the set of hosts.
+# Instead of a CIDR-address, you can write "samehost" to match any of
+# the server's own IP addresses, or "samenet" to match any address in
+# any subnet that the server is directly connected to.
+#
+# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
+# "krb5", "ident", "pam", "ldap", "radius" or "cert".  Note that
+# "password" sends passwords in clear text; "md5" is preferred since
+# it sends encrypted passwords.
+#
+# OPTIONS are a set of options for the authentication in the format
+# NAME=VALUE.  The available options depend on the different
+# authentication methods -- refer to the "Client Authentication"
+# section in the documentation for a list of which options are
+# available for which authentication methods.
+#
+# Database and user names containing spaces, commas, quotes and other
+# special characters must be quoted.  Quoting one of the keywords
+# "all", "sameuser", "samerole" or "replication" makes the name lose
+# its special character, and just match a database or username with
+# that name.
+#
+# This file is read on server startup and when the postmaster receives
+# a SIGHUP signal.  If you edit the file on a running system, you have
+# to SIGHUP the postmaster for the changes to take effect.  You can
+# use "pg_ctl reload" to do that.
+
+# Put your actual configuration here
+# ----------------------------------
+#
+# If you want to allow non-local connections, you need to add more
+# "host" records.  In that case you will also need to make PostgreSQL
+# listen on a non-local interface via the listen_addresses
+# configuration parameter, or via the -i or -h command line switches.
+
+
+
+
+# DO NOT DISABLE!
+# If you change this first entry you will need to make sure that the
+# database
+# super user can access the database using some other method.
+# Noninteractive
+# access to all databases is required during automatic maintenance
+# (custom daily cronjobs, replication, and similar tasks).
+#
+# Database administrative login by UNIX sockets
+local   all         postgres                          trust
+
+# TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD
+
+# "local" is for Unix domain socket connections only
+local   all             all                                    trust 
+# IPv4 local connections:
+host   all             all             10.10.10.1/24           trust
+host    all             all             127.0.0.1/32            trust
+# IPv6 local connections:
+host    all             all             ::1/128                 trust
diff --git a/templates/db/9.0/main/pg_ident.conf b/templates/db/9.0/main/pg_ident.conf
new file mode 100644 (file)
index 0000000..a5870e6
--- /dev/null
@@ -0,0 +1,42 @@
+# PostgreSQL User Name Maps
+# =========================
+#
+# Refer to the PostgreSQL documentation, chapter "Client
+# Authentication" for a complete description.  A short synopsis
+# follows.
+#
+# This file controls PostgreSQL user name mapping.  It maps external
+# user names to their corresponding PostgreSQL user names.  Records
+# are of the form:
+#
+# MAPNAME  SYSTEM-USERNAME  PG-USERNAME
+#
+# (The uppercase quantities must be replaced by actual values.)
+#
+# MAPNAME is the (otherwise freely chosen) map name that was used in
+# pg_hba.conf.  SYSTEM-USERNAME is the detected user name of the
+# client.  PG-USERNAME is the requested PostgreSQL user name.  The
+# existence of a record specifies that SYSTEM-USERNAME may connect as
+# PG-USERNAME.
+#
+# If SYSTEM-USERNAME starts with a slash (/), it will be treated as a
+# regular expression.  Optionally this can contain a capture (a
+# parenthesized subexpression).  The substring matching the capture
+# will be substituted for \1 (backslash-one) if present in
+# PG-USERNAME.
+#
+# Multiple maps may be specified in this file and used by pg_hba.conf.
+#
+# No map names are defined in the default configuration.  If all
+# system user names and PostgreSQL user names are the same, you don't
+# need anything in this file.
+#
+# This file is read on server startup and when the postmaster receives
+# a SIGHUP signal.  If you edit the file on a running system, you have
+# to SIGHUP the postmaster for the changes to take effect.  You can
+# use "pg_ctl reload" to do that.
+
+# Put your actual configuration here
+# ----------------------------------
+
+# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
diff --git a/templates/db/9.0/main/postgresql-tuned.conf b/templates/db/9.0/main/postgresql-tuned.conf
new file mode 100644 (file)
index 0000000..ed53397
--- /dev/null
@@ -0,0 +1,538 @@
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+#
+# This file consists of lines of the form:
+#
+#   name = value
+#
+# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
+# "#" anywhere on a line.  The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
+#
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
+#
+# This file is read on server startup and when the server receives a SIGHUP
+# signal.  If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, or use "pg_ctl reload".  Some
+# parameters, which are marked below, require a server shutdown and restart to
+# take effect.
+#
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on".  Some parameters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
+#                MB = megabytes                     s   = seconds
+#                GB = gigabytes                     min = minutes
+#                                                   h   = hours
+#                                                   d   = days
+
+
+#------------------------------------------------------------------------------
+# FILE LOCATIONS
+#------------------------------------------------------------------------------
+
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
+
+data_directory = '/var/lib/postgresql/9.0/main'                # use data in another directory
+                                       # (change requires restart)
+hba_file = '/etc/postgresql/9.0/main/pg_hba.conf'      # host-based authentication file
+                                       # (change requires restart)
+ident_file = '/etc/postgresql/9.0/main/pg_ident.conf'  # ident configuration file
+                                       # (change requires restart)
+
+# If external_pid_file is not explicitly set, no extra PID file is written.
+external_pid_file = '/var/run/postgresql/9.0-main.pid'         # write an extra PID file
+                                       # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONNECTIONS AND AUTHENTICATION
+#------------------------------------------------------------------------------
+
+# - Connection Settings -
+
+listen_addresses = '*'         # what IP address(es) to listen on;
+                                       # comma-separated list of addresses;
+                                       # defaults to 'localhost', '*' = all
+                                       # (change requires restart)
+port = 5432                            # (change requires restart)
+# max_connections = 100                        # (change requires restart)
+# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
+# connection slot, plus lock space (see max_locks_per_transaction).
+#superuser_reserved_connections = 3    # (change requires restart)
+unix_socket_directory = '/var/run/postgresql'          # (change requires restart)
+#unix_socket_group = ''                        # (change requires restart)
+#unix_socket_permissions = 0777                # begin with 0 to use octal notation
+                                       # (change requires restart)
+#bonjour = off                         # advertise server via Bonjour
+                                       # (change requires restart)
+#bonjour_name = ''                     # defaults to the computer name
+                                       # (change requires restart)
+
+# - Security and Authentication -
+
+#authentication_timeout = 1min         # 1s-600s
+ssl = true                             # (change requires restart)
+#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
+                                       # (change requires restart)
+#ssl_renegotiation_limit = 512MB       # amount of data between renegotiations
+#password_encryption = on
+#db_user_namespace = off
+
+# Kerberos and GSSAPI
+#krb_server_keyfile = ''
+#krb_srvname = 'postgres'              # (Kerberos only)
+#krb_caseins_users = off
+
+# - TCP Keepalives -
+# see "man 7 tcp" for details
+
+#tcp_keepalives_idle = 0               # TCP_KEEPIDLE, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_interval = 0           # TCP_KEEPINTVL, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_count = 0              # TCP_KEEPCNT;
+                                       # 0 selects the system default
+
+
+#------------------------------------------------------------------------------
+# RESOURCE USAGE (except WAL)
+#------------------------------------------------------------------------------
+
+# - Memory -
+
+# shared_buffers = 32MB                        # min 128kB
+                                       # (change requires restart)
+#temp_buffers = 8MB                    # min 800kB
+#max_prepared_transactions = 0         # zero disables the feature
+                                       # (change requires restart)
+# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
+# per transaction slot, plus lock space (see max_locks_per_transaction).
+# It is not advisable to set max_prepared_transactions nonzero unless you
+# actively intend to use prepared transactions.
+#work_mem = 1MB                                # min 64kB
+#maintenance_work_mem = 16MB           # min 1MB
+#max_stack_depth = 2MB                 # min 100kB
+
+# - Kernel Resource Usage -
+
+#max_files_per_process = 1000          # min 25
+                                       # (change requires restart)
+#shared_preload_libraries = ''         # (change requires restart)
+
+# - Cost-Based Vacuum Delay -
+
+#vacuum_cost_delay = 0ms               # 0-100 milliseconds
+#vacuum_cost_page_hit = 1              # 0-10000 credits
+#vacuum_cost_page_miss = 10            # 0-10000 credits
+#vacuum_cost_page_dirty = 20           # 0-10000 credits
+#vacuum_cost_limit = 200               # 1-10000 credits
+
+# - Background Writer -
+
+#bgwriter_delay = 200ms                        # 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100           # 0-1000 max buffers written/round
+#bgwriter_lru_multiplier = 2.0         # 0-10.0 multipler on buffers scanned/round
+
+# - Asynchronous Behavior -
+
+#effective_io_concurrency = 1          # 1-1000. 0 disables prefetching
+
+
+#------------------------------------------------------------------------------
+# WRITE AHEAD LOG
+#------------------------------------------------------------------------------
+
+# - Settings -
+
+#wal_level = minimal                   # minimal, archive, or hot_standby
+                                       # (change requires restart)
+#fsync = on                            # turns forced synchronization on or off
+#synchronous_commit = on               # immediate fsync at commit
+#wal_sync_method = fsync               # the default is the first option 
+                                       # supported by the operating system:
+                                       #   open_datasync
+                                       #   fdatasync (default on Linux)
+                                       #   fsync
+                                       #   fsync_writethrough
+                                       #   open_sync
+#full_page_writes = on                 # recover from partial page writes
+#wal_buffers = 64kB                    # min 32kB
+                                       # (change requires restart)
+#wal_writer_delay = 200ms              # 1-10000 milliseconds
+
+#commit_delay = 0                      # range 0-100000, in microseconds
+#commit_siblings = 5                   # range 1-1000
+
+# - Checkpoints -
+
+#checkpoint_segments = 3               # in logfile segments, min 1, 16MB each
+#checkpoint_timeout = 5min             # range 30s-1h
+#checkpoint_completion_target = 0.5    # checkpoint target duration, 0.0 - 1.0
+#checkpoint_warning = 30s              # 0 disables
+
+# - Archiving -
+
+#archive_mode = off            # allows archiving to be done
+                               # (change requires restart)
+#archive_command = ''          # command to use to archive a logfile segment
+#archive_timeout = 0           # force a logfile segment switch after this
+                               # number of seconds; 0 disables
+
+# - Streaming Replication -
+
+#max_wal_senders = 0           # max number of walsender processes
+                               # (change requires restart)
+#wal_sender_delay = 200ms      # walsender cycle time, 1-10000 milliseconds
+#wal_keep_segments = 0         # in logfile segments, 16MB each; 0 disables
+#vacuum_defer_cleanup_age = 0  # number of xacts by which cleanup is delayed
+
+# - Standby Servers -
+
+#hot_standby = off                     # "on" allows queries during recovery
+                                       # (change requires restart)
+#max_standby_archive_delay = 30s       # max delay before canceling queries
+                                       # when reading WAL from archive;
+                                       # -1 allows indefinite delay
+#max_standby_streaming_delay = 30s     # max delay before canceling queries
+                                       # when reading streaming WAL;
+                                       # -1 allows indefinite delay
+
+
+#------------------------------------------------------------------------------
+# QUERY TUNING
+#------------------------------------------------------------------------------
+
+# - Planner Method Configuration -
+
+#enable_bitmapscan = on
+#enable_hashagg = on
+#enable_hashjoin = on
+#enable_indexscan = on
+#enable_material = on
+#enable_mergejoin = on
+#enable_nestloop = on
+#enable_seqscan = on
+#enable_sort = on
+#enable_tidscan = on
+
+# - Planner Cost Constants -
+
+#seq_page_cost = 1.0                   # measured on an arbitrary scale
+#random_page_cost = 4.0                        # same scale as above
+#cpu_tuple_cost = 0.01                 # same scale as above
+#cpu_index_tuple_cost = 0.005          # same scale as above
+#cpu_operator_cost = 0.0025            # same scale as above
+#effective_cache_size = 128MB
+
+# - Genetic Query Optimizer -
+
+#geqo = on
+#geqo_threshold = 12
+#geqo_effort = 5                       # range 1-10
+#geqo_pool_size = 0                    # selects default based on effort
+#geqo_generations = 0                  # selects default based on effort
+#geqo_selection_bias = 2.0             # range 1.5-2.0
+#geqo_seed = 0.0                       # range 0.0-1.0
+
+# - Other Planner Options -
+
+#default_statistics_target = 100       # range 1-10000
+#constraint_exclusion = partition      # on, off, or partition
+#cursor_tuple_fraction = 0.1           # range 0.0-1.0
+#from_collapse_limit = 8
+#join_collapse_limit = 8               # 1 disables collapsing of explicit 
+                                       # JOIN clauses
+
+
+#------------------------------------------------------------------------------
+# ERROR REPORTING AND LOGGING
+#------------------------------------------------------------------------------
+
+# - Where to Log -
+
+#log_destination = 'stderr'            # Valid values are combinations of
+                                       # stderr, csvlog, syslog, and eventlog,
+                                       # depending on platform.  csvlog
+                                       # requires logging_collector to be on.
+
+# This is used when logging to stderr:
+#logging_collector = off               # Enable capturing of stderr and csvlog
+                                       # into log files. Required to be on for
+                                       # csvlogs.
+                                       # (change requires restart)
+
+# These are only used if logging_collector is on:
+#log_directory = 'pg_log'              # directory where log files are written,
+                                       # can be absolute or relative to PGDATA
+#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'       # log file name pattern,
+                                       # can include strftime() escapes
+#log_truncate_on_rotation = off                # If on, an existing log file of the
+                                       # same name as the new log file will be
+                                       # truncated rather than appended to.
+                                       # But such truncation only occurs on
+                                       # time-driven rotation, not on restarts
+                                       # or size-driven rotation.  Default is
+                                       # off, meaning append to existing files
+                                       # in all cases.
+#log_rotation_age = 1d                 # Automatic rotation of logfiles will
+                                       # happen after that time.  0 disables.
+#log_rotation_size = 10MB              # Automatic rotation of logfiles will 
+                                       # happen after that much log output.
+                                       # 0 disables.
+
+# These are relevant when logging to syslog:
+#syslog_facility = 'LOCAL0'
+#syslog_ident = 'postgres'
+
+#silent_mode = off                     # Run server silently.
+                                       # DO NOT USE without syslog or
+                                       # logging_collector
+                                       # (change requires restart)
+
+
+# - When to Log -
+
+#client_min_messages = notice          # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   log
+                                       #   notice
+                                       #   warning
+                                       #   error
+
+#log_min_messages = warning            # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic
+
+#log_min_error_statement = error       # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic (effectively off)
+
+#log_min_duration_statement = -1       # -1 is disabled, 0 logs all statements
+                                       # and their durations, > 0 logs only
+                                       # statements running at least this number
+                                       # of milliseconds
+
+
+# - What to Log -
+
+#debug_print_parse = off
+#debug_print_rewritten = off
+#debug_print_plan = off
+#debug_pretty_print = on
+#log_checkpoints = off
+#log_connections = off
+#log_disconnections = off
+#log_duration = off
+#log_error_verbosity = default         # terse, default, or verbose messages
+#log_hostname = off
+log_line_prefix = '%t '                        # special values:
+                                       #   %a = application name
+                                       #   %u = user name
+                                       #   %d = database name
+                                       #   %r = remote host and port
+                                       #   %h = remote host
+                                       #   %p = process ID
+                                       #   %t = timestamp without milliseconds
+                                       #   %m = timestamp with milliseconds
+                                       #   %i = command tag
+                                       #   %e = SQL state
+                                       #   %c = session ID
+                                       #   %l = session line number
+                                       #   %s = session start timestamp
+                                       #   %v = virtual transaction ID
+                                       #   %x = transaction ID (0 if none)
+                                       #   %q = stop here in non-session
+                                       #        processes
+                                       #   %% = '%'
+                                       # e.g. '<%u%%%d> '
+#log_lock_waits = off                  # log lock waits >= deadlock_timeout
+#log_statement = 'none'                        # none, ddl, mod, all
+#log_temp_files = -1                   # log temporary files equal or larger
+                                       # than the specified size in kilobytes;
+                                       # -1 disables, 0 logs all temp files
+#log_timezone = unknown                        # actually, defaults to TZ environment
+                                       # setting
+
+
+#------------------------------------------------------------------------------
+# RUNTIME STATISTICS
+#------------------------------------------------------------------------------
+
+# - Query/Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#track_functions = none                        # none, pl, all
+#track_activity_query_size = 1024      # (change requires restart)
+#update_process_title = on
+#stats_temp_directory = 'pg_stat_tmp'
+
+
+# - Statistics Monitoring -
+
+#log_parser_stats = off
+#log_planner_stats = off
+#log_executor_stats = off
+#log_statement_stats = off
+
+
+#------------------------------------------------------------------------------
+# AUTOVACUUM PARAMETERS
+#------------------------------------------------------------------------------
+
+#autovacuum = on                       # Enable autovacuum subprocess?  'on' 
+                                       # requires track_counts to also be on.
+#log_autovacuum_min_duration = -1      # -1 disables, 0 logs all actions and
+                                       # their durations, > 0 logs only
+                                       # actions running at least this number
+                                       # of milliseconds.
+#autovacuum_max_workers = 3            # max number of autovacuum subprocesses
+                                       # (change requires restart)
+#autovacuum_naptime = 1min             # time between autovacuum runs
+#autovacuum_vacuum_threshold = 50      # min number of row updates before
+                                       # vacuum
+#autovacuum_analyze_threshold = 50     # min number of row updates before 
+                                       # analyze
+#autovacuum_vacuum_scale_factor = 0.2  # fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
+                                       # (change requires restart)
+#autovacuum_vacuum_cost_delay = 20ms   # default vacuum cost delay for
+                                       # autovacuum, in milliseconds;
+                                       # -1 means use vacuum_cost_delay
+#autovacuum_vacuum_cost_limit = -1     # default vacuum cost limit for
+                                       # autovacuum, -1 means use
+                                       # vacuum_cost_limit
+
+
+#------------------------------------------------------------------------------
+# CLIENT CONNECTION DEFAULTS
+#------------------------------------------------------------------------------
+
+# - Statement Behavior -
+
+#search_path = '"$user",public'                # schema names
+#default_tablespace = ''               # a tablespace name, '' uses the default
+#temp_tablespaces = ''                 # a list of tablespace names, '' uses
+                                       # only default tablespace
+#check_function_bodies = on
+#default_transaction_isolation = 'read committed'
+#default_transaction_read_only = off
+#session_replication_role = 'origin'
+#statement_timeout = 0                 # in milliseconds, 0 is disabled
+#vacuum_freeze_min_age = 50000000
+#vacuum_freeze_table_age = 150000000
+#bytea_output = 'hex'                  # hex, escape
+#xmlbinary = 'base64'
+#xmloption = 'content'
+
+# - Locale and Formatting -
+
+datestyle = 'iso, mdy'
+#intervalstyle = 'postgres'
+#timezone = unknown                    # actually, defaults to TZ environment
+                                       # setting
+#timezone_abbreviations = 'Default'     # Select the set of available time zone
+                                       # abbreviations.  Currently, there are
+                                       #   Default
+                                       #   Australia
+                                       #   India
+                                       # You can create your own file in
+                                       # share/timezonesets/.
+#extra_float_digits = 0                        # min -15, max 3
+#client_encoding = sql_ascii           # actually, defaults to database
+                                       # encoding
+
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'en_US.UTF-8'                    # locale for system error message
+                                       # strings
+lc_monetary = 'en_US.UTF-8'                    # locale for monetary formatting
+lc_numeric = 'en_US.UTF-8'                     # locale for number formatting
+lc_time = 'en_US.UTF-8'                                # locale for time formatting
+
+# default configuration for text search
+default_text_search_config = 'pg_catalog.english'
+
+# - Other Defaults -
+
+#dynamic_library_path = '$libdir'
+#local_preload_libraries = ''
+
+
+#------------------------------------------------------------------------------
+# LOCK MANAGEMENT
+#------------------------------------------------------------------------------
+
+#deadlock_timeout = 1s
+#max_locks_per_transaction = 64                # min 10
+                                       # (change requires restart)
+# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
+# max_locks_per_transaction * (max_connections + max_prepared_transactions)
+# lock table slots.
+
+
+#------------------------------------------------------------------------------
+# VERSION/PLATFORM COMPATIBILITY
+#------------------------------------------------------------------------------
+
+# - Previous PostgreSQL Versions -
+
+#array_nulls = on
+#backslash_quote = safe_encoding       # on, off, or safe_encoding
+#default_with_oids = off
+#escape_string_warning = on
+#lo_compat_privileges = off
+#sql_inheritance = on
+#standard_conforming_strings = off
+#synchronize_seqscans = on
+
+# - Other Platforms and Clients -
+
+#transform_null_equals = off
+
+
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+#custom_variable_classes = ''          # list of custom variable class names
+default_statistics_target = 50 # pgtune wizard 2011-10-18
+maintenance_work_mem = 1GB # pgtune wizard 2011-10-18
+constraint_exclusion = on # pgtune wizard 2011-10-18
+checkpoint_completion_target = 0.9 # pgtune wizard 2011-10-18
+effective_cache_size = 88GB # pgtune wizard 2011-10-18
+work_mem = 768MB # pgtune wizard 2011-10-18
+wal_buffers = 8MB # pgtune wizard 2011-10-18
+checkpoint_segments = 16 # pgtune wizard 2011-10-18
+shared_buffers = 30GB # pgtune wizard 2011-10-18
+max_connections = 80 # pgtune wizard 2011-10-18
diff --git a/templates/db/9.0/main/postgresql.conf b/templates/db/9.0/main/postgresql.conf
new file mode 100644 (file)
index 0000000..d0367d4
--- /dev/null
@@ -0,0 +1,528 @@
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+#
+# This file consists of lines of the form:
+#
+#   name = value
+#
+# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
+# "#" anywhere on a line.  The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
+#
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
+#
+# This file is read on server startup and when the server receives a SIGHUP
+# signal.  If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, or use "pg_ctl reload".  Some
+# parameters, which are marked below, require a server shutdown and restart to
+# take effect.
+#
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on".  Some parameters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
+#                MB = megabytes                     s   = seconds
+#                GB = gigabytes                     min = minutes
+#                                                   h   = hours
+#                                                   d   = days
+
+
+#------------------------------------------------------------------------------
+# FILE LOCATIONS
+#------------------------------------------------------------------------------
+
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
+
+data_directory = '/var/lib/postgresql/9.0/main'                # use data in another directory
+                                       # (change requires restart)
+hba_file = '/etc/postgresql/9.0/main/pg_hba.conf'      # host-based authentication file
+                                       # (change requires restart)
+ident_file = '/etc/postgresql/9.0/main/pg_ident.conf'  # ident configuration file
+                                       # (change requires restart)
+
+# If external_pid_file is not explicitly set, no extra PID file is written.
+external_pid_file = '/var/run/postgresql/9.0-main.pid'         # write an extra PID file
+                                       # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONNECTIONS AND AUTHENTICATION
+#------------------------------------------------------------------------------
+
+# - Connection Settings -
+
+listen_addresses = '*'         # what IP address(es) to listen on;
+                                       # comma-separated list of addresses;
+                                       # defaults to 'localhost', '*' = all
+                                       # (change requires restart)
+port = 5432                            # (change requires restart)
+max_connections = 100                  # (change requires restart)
+# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
+# connection slot, plus lock space (see max_locks_per_transaction).
+#superuser_reserved_connections = 3    # (change requires restart)
+unix_socket_directory = '/var/run/postgresql'          # (change requires restart)
+#unix_socket_group = ''                        # (change requires restart)
+#unix_socket_permissions = 0777                # begin with 0 to use octal notation
+                                       # (change requires restart)
+#bonjour = off                         # advertise server via Bonjour
+                                       # (change requires restart)
+#bonjour_name = ''                     # defaults to the computer name
+                                       # (change requires restart)
+
+# - Security and Authentication -
+
+#authentication_timeout = 1min         # 1s-600s
+ssl = true                             # (change requires restart)
+#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
+                                       # (change requires restart)
+#ssl_renegotiation_limit = 512MB       # amount of data between renegotiations
+#password_encryption = on
+#db_user_namespace = off
+
+# Kerberos and GSSAPI
+#krb_server_keyfile = ''
+#krb_srvname = 'postgres'              # (Kerberos only)
+#krb_caseins_users = off
+
+# - TCP Keepalives -
+# see "man 7 tcp" for details
+
+#tcp_keepalives_idle = 0               # TCP_KEEPIDLE, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_interval = 0           # TCP_KEEPINTVL, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_count = 0              # TCP_KEEPCNT;
+                                       # 0 selects the system default
+
+
+#------------------------------------------------------------------------------
+# RESOURCE USAGE (except WAL)
+#------------------------------------------------------------------------------
+
+# - Memory -
+
+shared_buffers = 32MB                  # min 128kB
+                                       # (change requires restart)
+#temp_buffers = 8MB                    # min 800kB
+#max_prepared_transactions = 0         # zero disables the feature
+                                       # (change requires restart)
+# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
+# per transaction slot, plus lock space (see max_locks_per_transaction).
+# It is not advisable to set max_prepared_transactions nonzero unless you
+# actively intend to use prepared transactions.
+#work_mem = 1MB                                # min 64kB
+#maintenance_work_mem = 16MB           # min 1MB
+#max_stack_depth = 2MB                 # min 100kB
+
+# - Kernel Resource Usage -
+
+#max_files_per_process = 1000          # min 25
+                                       # (change requires restart)
+#shared_preload_libraries = ''         # (change requires restart)
+
+# - Cost-Based Vacuum Delay -
+
+#vacuum_cost_delay = 0ms               # 0-100 milliseconds
+#vacuum_cost_page_hit = 1              # 0-10000 credits
+#vacuum_cost_page_miss = 10            # 0-10000 credits
+#vacuum_cost_page_dirty = 20           # 0-10000 credits
+#vacuum_cost_limit = 200               # 1-10000 credits
+
+# - Background Writer -
+
+#bgwriter_delay = 200ms                        # 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100           # 0-1000 max buffers written/round
+#bgwriter_lru_multiplier = 2.0         # 0-10.0 multipler on buffers scanned/round
+
+# - Asynchronous Behavior -
+
+#effective_io_concurrency = 1          # 1-1000. 0 disables prefetching
+
+
+#------------------------------------------------------------------------------
+# WRITE AHEAD LOG
+#------------------------------------------------------------------------------
+
+# - Settings -
+
+#wal_level = minimal                   # minimal, archive, or hot_standby
+                                       # (change requires restart)
+#fsync = on                            # turns forced synchronization on or off
+#synchronous_commit = on               # immediate fsync at commit
+#wal_sync_method = fsync               # the default is the first option 
+                                       # supported by the operating system:
+                                       #   open_datasync
+                                       #   fdatasync (default on Linux)
+                                       #   fsync
+                                       #   fsync_writethrough
+                                       #   open_sync
+#full_page_writes = on                 # recover from partial page writes
+#wal_buffers = 64kB                    # min 32kB
+                                       # (change requires restart)
+#wal_writer_delay = 200ms              # 1-10000 milliseconds
+
+#commit_delay = 0                      # range 0-100000, in microseconds
+#commit_siblings = 5                   # range 1-1000
+
+# - Checkpoints -
+
+#checkpoint_segments = 3               # in logfile segments, min 1, 16MB each
+#checkpoint_timeout = 5min             # range 30s-1h
+#checkpoint_completion_target = 0.5    # checkpoint target duration, 0.0 - 1.0
+#checkpoint_warning = 30s              # 0 disables
+
+# - Archiving -
+
+#archive_mode = off            # allows archiving to be done
+                               # (change requires restart)
+#archive_command = ''          # command to use to archive a logfile segment
+#archive_timeout = 0           # force a logfile segment switch after this
+                               # number of seconds; 0 disables
+
+# - Streaming Replication -
+
+#max_wal_senders = 0           # max number of walsender processes
+                               # (change requires restart)
+#wal_sender_delay = 200ms      # walsender cycle time, 1-10000 milliseconds
+#wal_keep_segments = 0         # in logfile segments, 16MB each; 0 disables
+#vacuum_defer_cleanup_age = 0  # number of xacts by which cleanup is delayed
+
+# - Standby Servers -
+
+#hot_standby = off                     # "on" allows queries during recovery
+                                       # (change requires restart)
+#max_standby_archive_delay = 30s       # max delay before canceling queries
+                                       # when reading WAL from archive;
+                                       # -1 allows indefinite delay
+#max_standby_streaming_delay = 30s     # max delay before canceling queries
+                                       # when reading streaming WAL;
+                                       # -1 allows indefinite delay
+
+
+#------------------------------------------------------------------------------
+# QUERY TUNING
+#------------------------------------------------------------------------------
+
+# - Planner Method Configuration -
+
+#enable_bitmapscan = on
+#enable_hashagg = on
+#enable_hashjoin = on
+#enable_indexscan = on
+#enable_material = on
+#enable_mergejoin = on
+#enable_nestloop = on
+#enable_seqscan = on
+#enable_sort = on
+#enable_tidscan = on
+
+# - Planner Cost Constants -
+
+#seq_page_cost = 1.0                   # measured on an arbitrary scale
+#random_page_cost = 4.0                        # same scale as above
+#cpu_tuple_cost = 0.01                 # same scale as above
+#cpu_index_tuple_cost = 0.005          # same scale as above
+#cpu_operator_cost = 0.0025            # same scale as above
+#effective_cache_size = 128MB
+
+# - Genetic Query Optimizer -
+
+#geqo = on
+#geqo_threshold = 12
+#geqo_effort = 5                       # range 1-10
+#geqo_pool_size = 0                    # selects default based on effort
+#geqo_generations = 0                  # selects default based on effort
+#geqo_selection_bias = 2.0             # range 1.5-2.0
+#geqo_seed = 0.0                       # range 0.0-1.0
+
+# - Other Planner Options -
+
+#default_statistics_target = 100       # range 1-10000
+#constraint_exclusion = partition      # on, off, or partition
+#cursor_tuple_fraction = 0.1           # range 0.0-1.0
+#from_collapse_limit = 8
+#join_collapse_limit = 8               # 1 disables collapsing of explicit 
+                                       # JOIN clauses
+
+
+#------------------------------------------------------------------------------
+# ERROR REPORTING AND LOGGING
+#------------------------------------------------------------------------------
+
+# - Where to Log -
+
+#log_destination = 'stderr'            # Valid values are combinations of
+                                       # stderr, csvlog, syslog, and eventlog,
+                                       # depending on platform.  csvlog
+                                       # requires logging_collector to be on.
+
+# This is used when logging to stderr:
+#logging_collector = off               # Enable capturing of stderr and csvlog
+                                       # into log files. Required to be on for
+                                       # csvlogs.
+                                       # (change requires restart)
+
+# These are only used if logging_collector is on:
+#log_directory = 'pg_log'              # directory where log files are written,
+                                       # can be absolute or relative to PGDATA
+#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'       # log file name pattern,
+                                       # can include strftime() escapes
+#log_truncate_on_rotation = off                # If on, an existing log file of the
+                                       # same name as the new log file will be
+                                       # truncated rather than appended to.
+                                       # But such truncation only occurs on
+                                       # time-driven rotation, not on restarts
+                                       # or size-driven rotation.  Default is
+                                       # off, meaning append to existing files
+                                       # in all cases.
+#log_rotation_age = 1d                 # Automatic rotation of logfiles will
+                                       # happen after that time.  0 disables.
+#log_rotation_size = 10MB              # Automatic rotation of logfiles will 
+                                       # happen after that much log output.
+                                       # 0 disables.
+
+# These are relevant when logging to syslog:
+#syslog_facility = 'LOCAL0'
+#syslog_ident = 'postgres'
+
+#silent_mode = off                     # Run server silently.
+                                       # DO NOT USE without syslog or
+                                       # logging_collector
+                                       # (change requires restart)
+
+
+# - When to Log -
+
+#client_min_messages = notice          # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   log
+                                       #   notice
+                                       #   warning
+                                       #   error
+
+#log_min_messages = warning            # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic
+
+#log_min_error_statement = error       # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic (effectively off)
+
+#log_min_duration_statement = -1       # -1 is disabled, 0 logs all statements
+                                       # and their durations, > 0 logs only
+                                       # statements running at least this number
+                                       # of milliseconds
+
+
+# - What to Log -
+
+#debug_print_parse = off
+#debug_print_rewritten = off
+#debug_print_plan = off
+#debug_pretty_print = on
+#log_checkpoints = off
+#log_connections = off
+#log_disconnections = off
+#log_duration = off
+#log_error_verbosity = default         # terse, default, or verbose messages
+#log_hostname = off
+log_line_prefix = '%t '                        # special values:
+                                       #   %a = application name
+                                       #   %u = user name
+                                       #   %d = database name
+                                       #   %r = remote host and port
+                                       #   %h = remote host
+                                       #   %p = process ID
+                                       #   %t = timestamp without milliseconds
+                                       #   %m = timestamp with milliseconds
+                                       #   %i = command tag
+                                       #   %e = SQL state
+                                       #   %c = session ID
+                                       #   %l = session line number
+                                       #   %s = session start timestamp
+                                       #   %v = virtual transaction ID
+                                       #   %x = transaction ID (0 if none)
+                                       #   %q = stop here in non-session
+                                       #        processes
+                                       #   %% = '%'
+                                       # e.g. '<%u%%%d> '
+#log_lock_waits = off                  # log lock waits >= deadlock_timeout
+#log_statement = 'none'                        # none, ddl, mod, all
+#log_temp_files = -1                   # log temporary files equal or larger
+                                       # than the specified size in kilobytes;
+                                       # -1 disables, 0 logs all temp files
+#log_timezone = unknown                        # actually, defaults to TZ environment
+                                       # setting
+
+
+#------------------------------------------------------------------------------
+# RUNTIME STATISTICS
+#------------------------------------------------------------------------------
+
+# - Query/Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#track_functions = none                        # none, pl, all
+#track_activity_query_size = 1024      # (change requires restart)
+#update_process_title = on
+#stats_temp_directory = 'pg_stat_tmp'
+
+
+# - Statistics Monitoring -
+
+#log_parser_stats = off
+#log_planner_stats = off
+#log_executor_stats = off
+#log_statement_stats = off
+
+
+#------------------------------------------------------------------------------
+# AUTOVACUUM PARAMETERS
+#------------------------------------------------------------------------------
+
+#autovacuum = on                       # Enable autovacuum subprocess?  'on' 
+                                       # requires track_counts to also be on.
+#log_autovacuum_min_duration = -1      # -1 disables, 0 logs all actions and
+                                       # their durations, > 0 logs only
+                                       # actions running at least this number
+                                       # of milliseconds.
+#autovacuum_max_workers = 3            # max number of autovacuum subprocesses
+                                       # (change requires restart)
+#autovacuum_naptime = 1min             # time between autovacuum runs
+#autovacuum_vacuum_threshold = 50      # min number of row updates before
+                                       # vacuum
+#autovacuum_analyze_threshold = 50     # min number of row updates before 
+                                       # analyze
+#autovacuum_vacuum_scale_factor = 0.2  # fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
+                                       # (change requires restart)
+#autovacuum_vacuum_cost_delay = 20ms   # default vacuum cost delay for
+                                       # autovacuum, in milliseconds;
+                                       # -1 means use vacuum_cost_delay
+#autovacuum_vacuum_cost_limit = -1     # default vacuum cost limit for
+                                       # autovacuum, -1 means use
+                                       # vacuum_cost_limit
+
+
+#------------------------------------------------------------------------------
+# CLIENT CONNECTION DEFAULTS
+#------------------------------------------------------------------------------
+
+# - Statement Behavior -
+
+#search_path = '"$user",public'                # schema names
+#default_tablespace = ''               # a tablespace name, '' uses the default
+#temp_tablespaces = ''                 # a list of tablespace names, '' uses
+                                       # only default tablespace
+#check_function_bodies = on
+#default_transaction_isolation = 'read committed'
+#default_transaction_read_only = off
+#session_replication_role = 'origin'
+#statement_timeout = 0                 # in milliseconds, 0 is disabled
+#vacuum_freeze_min_age = 50000000
+#vacuum_freeze_table_age = 150000000
+#bytea_output = 'hex'                  # hex, escape
+#xmlbinary = 'base64'
+#xmloption = 'content'
+
+# - Locale and Formatting -
+
+datestyle = 'iso, mdy'
+#intervalstyle = 'postgres'
+#timezone = unknown                    # actually, defaults to TZ environment
+                                       # setting
+#timezone_abbreviations = 'Default'     # Select the set of available time zone
+                                       # abbreviations.  Currently, there are
+                                       #   Default
+                                       #   Australia
+                                       #   India
+                                       # You can create your own file in
+                                       # share/timezonesets/.
+#extra_float_digits = 0                        # min -15, max 3
+#client_encoding = sql_ascii           # actually, defaults to database
+                                       # encoding
+
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'en_US.UTF-8'                    # locale for system error message
+                                       # strings
+lc_monetary = 'en_US.UTF-8'                    # locale for monetary formatting
+lc_numeric = 'en_US.UTF-8'                     # locale for number formatting
+lc_time = 'en_US.UTF-8'                                # locale for time formatting
+
+# default configuration for text search
+default_text_search_config = 'pg_catalog.english'
+
+# - Other Defaults -
+
+#dynamic_library_path = '$libdir'
+#local_preload_libraries = ''
+
+
+#------------------------------------------------------------------------------
+# LOCK MANAGEMENT
+#------------------------------------------------------------------------------
+
+#deadlock_timeout = 1s
+#max_locks_per_transaction = 64                # min 10
+                                       # (change requires restart)
+# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
+# max_locks_per_transaction * (max_connections + max_prepared_transactions)
+# lock table slots.
+
+
+#------------------------------------------------------------------------------
+# VERSION/PLATFORM COMPATIBILITY
+#------------------------------------------------------------------------------
+
+# - Previous PostgreSQL Versions -
+
+#array_nulls = on
+#backslash_quote = safe_encoding       # on, off, or safe_encoding
+#default_with_oids = off
+#escape_string_warning = on
+#lo_compat_privileges = off
+#sql_inheritance = on
+#standard_conforming_strings = off
+#synchronize_seqscans = on
+
+# - Other Platforms and Clients -
+
+#transform_null_equals = off
+
+
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+#custom_variable_classes = ''          # list of custom variable class names
diff --git a/templates/db/9.0/main/start.conf b/templates/db/9.0/main/start.conf
new file mode 100644 (file)
index 0000000..9613e2b
--- /dev/null
@@ -0,0 +1,9 @@
+# Automatic startup configuration
+# auto: automatically start/stop the cluster in the init script
+# manual: do not start/stop in init scripts, but allow manual startup with
+#         pg_ctlcluster
+# disabled: do not allow manual startup with pg_ctlcluster (this can be easily
+#           circumvented and is only meant to be a small protection for
+#           accidents).
+
+auto
diff --git a/templates/db/create_database_9.0.sql b/templates/db/create_database_9.0.sql
new file mode 100644 (file)
index 0000000..b3be0f0
--- /dev/null
@@ -0,0 +1,30 @@
+-- This file is intended to be called by eg_db_config.pl
+
+-- If manually calling:
+-- Connect to the postgres database initially
+-- Specify the database to create as -vdb_name=DATABASE
+-- Specify the postgres contrib directory as -vcontrib_dir=CONTRIBDIR
+-- You can get the contrib directory using pg_config --sharedir and adding a /contrib to it
+
+-- NOTE: This file does not do transactions
+-- This is intentional. Please do not wrap in BEGIN/COMMIT.
+DROP DATABASE IF EXISTS :db_name;
+
+CREATE DATABASE :db_name TEMPLATE template0 ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C';
+
+\connect :db_name
+
+CREATE LANGUAGE plperl;
+CREATE LANGUAGE plperlu;
+
+-- This dance is because :variable/blah doesn't seem to work when doing \i
+-- But it does when doing \set
+-- So we \set to a single variable, then use that single variable with \i
+\set load_file :contrib_dir/tablefunc.sql
+\i :load_file
+\set load_file :contrib_dir/tsearch2.sql
+\i :load_file
+\set load_file :contrib_dir/pgxml.sql
+\i :load_file
+\set load_file :contrib_dir/hstore.sql
+\i :load_file
diff --git a/templates/db/create_database_9.1.sql b/templates/db/create_database_9.1.sql
new file mode 100644 (file)
index 0000000..97739f9
--- /dev/null
@@ -0,0 +1,23 @@
+-- This file is intended to be called by eg_db_config.pl
+
+-- If manually calling:
+-- Connect to the postgres database initially
+-- Specify the database to create as -vdb_name=DATABASE
+-- Specify the postgres contrib directory as -vcontrib_dir=CONTRIBDIR
+-- You can get the contrib directory using pg_config --sharedir and adding a /contrib to it
+
+-- NOTE: This file does not do transactions
+-- This is intentional. Please do not wrap in BEGIN/COMMIT.
+DROP DATABASE IF EXISTS :db_name;
+
+CREATE DATABASE :db_name TEMPLATE template0 ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C';
+
+\connect :db_name
+
+CREATE LANGUAGE plperl;
+CREATE LANGUAGE plperlu;
+
+CREATE EXTENSION tablefunc;
+CREATE EXTENSION tsearch2;
+CREATE EXTENSION xml2;
+CREATE EXTENSION hstore;
diff --git a/templates/db/eg-db-backup.sh b/templates/db/eg-db-backup.sh
new file mode 100755 (executable)
index 0000000..0983604
--- /dev/null
@@ -0,0 +1,113 @@
+#!/bin/bash
+#    Evergreen database snapshot creation and archiving script
+#    Copyright (C) 2008-2010 Equinox Software Inc.
+#    Mike Rylander <mrylander@gmail.com>
+#
+#    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
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+# You will need to edit the variables below to configure this script for
+# use in your production environment.
+#
+# This script must be run as the postgres user, and if snapshot shipping
+# is enabled then the postgres user should be able to log into the remote
+# host as the ARCHIVE_USER over ssh and scp with a passphraseless ssh key.
+#
+
+
+#--------------------- CONFIGURATION BEGIN ------------------------
+# Remove the following line once you have adjusted the configuration
+# below to match your environment.
+#echo "Configuration not complete!" && exit 1;
+
+
+# Where the postgres binaries are installed, particularly psql
+PGBIN=/usr/bin/
+#PGBIN=/usr/lib/postgresql/8.4/bin/
+
+
+# Where the database cluster lives
+PGDATA=/var/lib/postgresql/_PSQL_VERSION/main
+#PGDATA=/EG/postgresql/8.4/main/base/
+
+
+# How to name the database snapshot files. Adjust to taste.
+ARCHIVE_LABEL=`date +_CLUSTERDOMAINNAME-prod-backup-%FT%F`
+
+
+# Local snapshot archiving directory
+ARCHIVE_DIR="/var/backup/$HOSTNAME/snapshot/"
+#ARCHIVE_DIR="/mnt/backup/db07/snapshot/"
+
+# Remote host (IP or resolvable name) to which snapshots should be shipped.
+# Leave empty to disable snapshot shipping.
+ARCHIVE_HOST=
+
+
+# User on the remote snapshot-receiving host.
+ARCHIVE_USER=backup
+
+# Snapshot archiving directory on the remote host, if snapshot shipping is
+# enabled.
+ARCHIVE_DST="/var/backup/$HOSTNAME/snapshot/"
+#ARCHIVE_DST="/storage01/db-backups/"
+#ARCHIVE_DST="/mnt/backup/db07/snapshot/"
+
+# NOTE: the above said "ARCHIVE_DIR" and I changed it to "ARCHIVE_DST" to match the log-shipping code - csharp
+
+#---------------------  CONFIGURATION END  ------------------------
+
+
+
+
+ARCHIVE_FILE=$ARCHIVE_LABEL.cpio.gz
+# Make sure we're not overwriting an existing backup
+if [ -e $ARCHIVE_DIR/$ARCHIVE_FILE ]; then
+        echo "Cannot create backup: $ARCHIVE_DIR/$ARCHIVE_FILE exists";
+        exit;
+fi
+
+
+# Tell PG we're starting the backup
+START_RESULT=`$PGBIN/psql -tc "SELECT pg_start_backup('$ARCHIVE_LABEL') IS NOT NULL;"|grep t`
+if [ "_" == "_$START_RESULT" ]; then
+        echo "Could not start backup labeled $ARCHIVE_LABEL";
+        exit;
+fi
+
+
+# Grab the data we need (just copy it locally) ...
+(cd $PGDATA && find . -depth -print | grep -v pg_xlog | cpio -o | gzip > $ARCHIVE_DIR/$ARCHIVE_FILE)
+
+
+# ... tell PG we're done ...
+STOP_RESULT=`$PGBIN/psql -tc "SELECT pg_stop_backup() IS NOT NULL;"|grep t`
+if [ "_" == "_$STOP_RESULT" ]; then
+        echo "Could not stop backup labeled $ARCHIVE_LABEL";
+        exit;
+fi
+
+echo "Backup of database on $HOSTNAME complete. Archive label: $ARCHIVE_LABEL"
+
+if [ "_$ARCHIVE_HOST" != "_" ]; then
+        # ... then push it over to the backup host
+        scp -q $ARCHIVE_DIR/$ARCHIVE_FILE $ARCHIVE_USER@$ARCHIVE_HOST:$ARCHIVE_DST
+        SCP_RES=$?
+        if [ "$SCP_RES" != "0" ]; then
+                echo "Unable to archive $ARCHIVE_DIR/$ARCHIVE_FILE to $ARCHIVE_USER@$ARCHIVE_HOST:$ARCHIVE_DST!!"
+                exit;
+        fi
+    echo "Remote backup: $ARCHIVE_HOST:$ARCHIVE_DST"
+fi
diff --git a/templates/db/eg-wal-archive.sh b/templates/db/eg-wal-archive.sh
new file mode 100755 (executable)
index 0000000..8ce8de4
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/bash
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+# You will need to edit the variables below to configure this script for
+# use in your production environment.
+#
+# If WAL file shipping is enabled then the postgres user should be able to
+# log into the remote host as the ARCHIVE_USER over ssh and scp with a
+# passphraseless ssh key.
+#
+# In your postgresql.conf, turn on archive_mode (if applicable) and adjust
+# the archive_command thusly:
+#
+#  archive_command = '/location/of/this/script/eg-wal-archive.sh %p %f'
+#
+
+
+#--------------------- CONFIGURATION BEGIN ------------------------
+# Remove the following line once you have adjusted the configuration
+# below to match your environment.
+#echo "Configuration not complete!" && exit 1;
+
+
+# File which, if it exists, pauses WAL archiving
+PAUSE_FILE=/tmp/wal-pause
+
+# Local WAL archiving directory
+#ARCHIVE_DIR="/var/backup/$HOSTNAME/wal/"
+#ARCHIVE_DIR="/tmp/wal-tmp/"
+
+
+# Remote host (IP or resolvable name) to which WAL files should be shipped.
+# Leave empty to disable WAL file shipping.
+ARCHIVE_HOST=
+
+
+# User on the remote WAL-receiving host.
+ARCHIVE_USER=
+
+# Snapshot archiving directory on the remote host, if WAL file shipping is
+# enabled.
+ARCHIVE_DIR="/var/backup/$HOSTNAME/wal/"
+
+#---------------------  CONFIGURATION END  ------------------------
+
+
+
+
+while [ -e $PAUSE_FILE ]; do sleep 1; done
+
+P=$1
+F=$2
+
+if [ -e $ARCHIVE_DIR/$F.bz2 ]; then
+    echo "Cannot archive: $ARCHIVE_DIR/$F.bz2 already exists"
+    logger -p local3.info "Cannot archive: $ARCHIVE_DIR/$F.bz2 already exists"
+    exit 0;
+fi
+
+###cp $P /tmp/$F
+cp $P $ARCHIVE_DIR
+CP_RES=$?
+if [ "$CP_RES" != "0" ]; then
+    echo "Cannot archive: unable to copy WAL file $P to /tmp, cp exit code = $CP_RES"
+    logger -p local3.info "Cannot archive: unable to copy WAL file $P to /tmp, cp exit code = $CP_RES"
+    exit 1;
+fi
+
+
+/bin/bzip2 $ARCHIVE_DIR/$F
+if [ "_$ARCHIVE_HOST" != "_" ]; then
+        scp -q $ARCHIVE_DIR/$F.bz2 $ARCHIVE_USER@$ARCHIVE_HOST:$ARCHIVE_DST
+fi
+
+###mv /tmp/$F.bz2 $ARCHIVE_DIR
+###MV_RES=$?
+###if [ "$MV_RES" != "0" ]; then
+###    echo "Cannot archive: unable to move WAL file $F.bz2 to $ARCHIVE_DIR, mv exit code = $MV_RES"
+###    logger -p local3.info "Cannot archive: unable to move WAL file $F.bz2 to $ARCHIVE_DIR, mv exit code = $MV_RES"
+###    exit 1;
+###fi
+
+
+exit 0
+
diff --git a/templates/db/eg_db_config.pl b/templates/db/eg_db_config.pl
new file mode 100755 (executable)
index 0000000..93c53fa
--- /dev/null
@@ -0,0 +1,385 @@
+#!/usr/bin/perl
+# eg_db_config.pl -- configure Evergreen database settings and create schema
+# vim:noet:ts=4:sw=4:
+#
+# Copyright (C) 2008 Equinox Software, Inc.
+# Copyright (C) 2008-2009 Laurentian University
+# Author: Kevin Beswick <kevinbeswick00@gmail.com>
+# Author: Dan Scott <dscott@laurentian.ca>
+#
+# 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 the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+use strict; use warnings;
+use XML::LibXML;
+use File::Copy;
+use Getopt::Long;
+use File::Spec;
+use File::Basename;
+use DBI;
+
+my ($dbhost, $dbport, $dbname, $dbuser, $dbpw, $help, $admin_user, $admin_pw);
+my $config_file = '';
+my $build_db_sh = '';
+my $offline_file = '';
+my $prefix = '';
+my $sysconfdir = '';
+my $pg_contribdir = '';
+my $create_db_sql = '';
+my $create_db_sql_9_1 = '';
+my @services;
+
+my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+
+# Get the directory for this script
+my $script_dir = dirname($0);
+
+=over
+
+=item update_config() - Puts command line specified settings into xml file
+=cut
+sub update_config {
+       my ($services, $settings) = @_;
+
+       my $parser = XML::LibXML->new();
+       my $opensrf_config = $parser->parse_file($config_file);
+
+       if (@$services) {
+               foreach my $service (@$services) {
+                       foreach my $key (keys %$settings) {
+                               next unless $settings->{$key};
+                               my @node;
+
+                               if ($service eq 'state_store') {
+                                       (@node) = $opensrf_config->findnodes("//state_store/$key/text()");
+                               } else {
+                                       (@node) = $opensrf_config->findnodes("//$service//database/$key/text()");
+                               }
+
+                               foreach (@node) {
+                                       $_->setData($settings->{$key});
+                               }
+                       }
+
+               }
+       }
+
+       my $timestamp = sprintf("%d.%d.%d.%d.%d.%d",
+               $year + 1900, $mon +1, $mday, $hour, $min, $sec);
+       if (copy($config_file, "$config_file.$timestamp")) {
+               print "Backed up original configuration file to '$config_file.$timestamp'\n";
+       } else {
+               print STDERR "Unable to write to '$config_file.$timestamp'; bailed out.\n";
+       }
+
+       $opensrf_config->toFile($config_file) or
+               die "ERROR: Failed to update the configuration file '$config_file'\n";
+}
+
+=item create_offline_config() - Write out the offline config
+=cut
+sub create_offline_config {
+       my ($setup, $settings) = @_;
+
+       open(FH, '>', $setup) or die "Could not write offline database setup to $setup\n";
+
+       print "Writing offline database configuration to $setup\n";
+
+       printf FH "\$main::config{base_dir} = '%s/var/data/offline/';\n", $prefix;
+       printf FH "\$main::config{bootstrap} = '%s/opensrf_core.xml';\n", $sysconfdir;
+
+       printf FH "\$main::config{dsn} = 'dbi:Pg:host=%s;dbname=%s;port=%d';\n",
+               $settings->{host}, $settings->{db}, $settings->{port};
+
+       printf FH "\$main::config{usr} = '%s';\n", $settings->{user};
+       printf FH "\$main::config{pw} = '%s';\n", $settings->{pw};
+
+       close(FH);
+}
+
+=item get_settings() - Extracts database settings from opensrf.xml
+=cut
+sub get_settings {
+       my $settings = shift;
+
+       my $host = "/opensrf/default/apps/open-ils.storage/app_settings/databases/database/host/text()";
+       my $port = "/opensrf/default/apps/open-ils.storage/app_settings/databases/database/port/text()";
+       my $dbname = "/opensrf/default/apps/open-ils.storage/app_settings/databases/database/db/text()";
+       my $user = "/opensrf/default/apps/open-ils.storage/app_settings/databases/database/user/text()";
+       my $pw = "/opensrf/default/apps/open-ils.storage/app_settings/databases/database/pw/text()";
+
+       my $parser = XML::LibXML->new();
+       my $opensrf_config = $parser->parse_file($config_file);
+
+       # If the user passed in settings at the command line,
+       # we don't want to override them
+       $settings->{host} = $settings->{host} || $opensrf_config->findnodes($host);
+       $settings->{port} = $settings->{port} || $opensrf_config->findnodes($port);
+       $settings->{db} = $settings->{db} || $opensrf_config->findnodes($dbname);
+       $settings->{user} = $settings->{user} || $opensrf_config->findnodes($user);
+       $settings->{pw} = $settings->{pw} || $opensrf_config->findnodes($pw);
+}
+
+=item create_database() - Creates the database using create_database.sql
+=cut
+sub create_database {
+       my $settings = shift;
+
+       $ENV{'PGUSER'} = $settings->{user};
+       $ENV{'PGPASSWORD'} = $settings->{pw};
+       $ENV{'PGPORT'} = $settings->{port};
+       $ENV{'PGHOST'} = $settings->{host};
+       my @temp = `psql -d postgres -qtc 'show server_version;' | xargs | cut -c1,3`;
+       chomp $temp[0];
+       my $pgversion = $temp[0];
+       my $cmd;
+       # If it looks like it is 9.1 or greater, use create_database_9_1.sql
+       # Otherwise use create_database.sql
+       if($pgversion >= '91') {
+               $cmd = 'psql -vdb_name=' . $settings->{db} . ' -d postgres -f ' . $create_db_sql_9_1;
+       } else {
+               $cmd = 'psql -vdb_name=' . $settings->{db} . ' -vcontrib_dir=' . $pg_contribdir .
+                       ' -d postgres -f ' . $create_db_sql;
+       }
+       my @output = `$cmd 2>&1`;
+       if(grep(/(ERROR|No such file or directory)/,@output)) {
+               push(@output, "\n------------------------------------------------------------------------------\n",
+                       "There was a problem creating the database.\n",
+                       "See above for more information.\n");
+               if(grep/unsupported language/, @output) {
+                       push(@output, "\nYou may need to install the postgresql plperl package on the database server.\n");
+               }
+               if(grep/No such file or directory/, @output) {
+                       if($pgversion >= '91') {
+                               push(@output, "\nYou may need to install the postgresql contrib package on the database server.\n"); 
+                       } else {
+                               push(@output, "\nYou may need to install the postgresql contrib package on this server.\n");
+                       }
+               }
+               push(@output, "------------------------------------------------------------------------------\n");
+               die(@output);
+       }
+}
+
+=item create_schema() - Creates the database schema by calling build-db.sh
+=cut
+sub create_schema {
+       my $settings = shift;
+
+       chdir(dirname($build_db_sh));
+       my $cmd = File::Spec->catfile('.', basename($build_db_sh)) . " " .
+               $settings->{host} ." ".  $settings->{port} ." ". 
+               $settings->{db} ." ".  $settings->{user} ." ". 
+               $settings->{pw};
+       system($cmd);
+       chdir($script_dir);
+}
+
+=item set_admin_account() - Sets the administrative user's user name and password
+=cut
+sub set_admin_account {
+       my $admin_user = shift;
+       my $admin_pw = shift;
+       my $settings = shift;
+
+       my $dbh = DBI->connect('dbi:Pg:dbname=' . $settings->{db} . 
+               ';host=' . $settings->{host} . ';port=' . $settings->{port} . ';',
+                $settings->{user} . "", $settings->{pw} . "", {AutoCommit => 1}
+       );
+       if ($dbh->err) {
+               print STDERR "Could not connect to database to set admin account. ";
+               print STDERR "Error was " . $dbh->errstr . "\n";
+               return;
+       }
+       my $stmt = $dbh->prepare("UPDATE actor.usr SET usrname = ?, passwd = ? WHERE id = 1");
+       $stmt->execute(($admin_user, $admin_pw));
+       if ($dbh->err) {
+               print STDERR "Failed to set admin account. ";
+               print STDERR "Error was " . $dbh->errstr . "\n";
+               return;
+       }
+}
+
+my $offline;
+my $cdatabase;
+my $cschema;
+my $uconfig;
+my $pgconfig;
+my %settings;
+
+GetOptions("create-schema" => \$cschema, 
+               "create-database" => \$cdatabase,
+               "create-offline" => \$offline,
+               "update-config" => \$uconfig,
+               "config-file=s" => \$config_file,
+               "build-db-file=s" => \$build_db_sh,
+               "pg-contrib-dir=s" => \$pg_contribdir,
+               "create-db-sql=s" => \$create_db_sql,
+               "create-db-sql-9-1=s" => \$create_db_sql_9_1,
+               "pg-config=s" => \$pgconfig,
+               "admin-user=s" => \$admin_user,
+               "admin-password=s" => \$admin_pw,
+               "service=s" => \@services,
+               "user=s" => \$settings{'user'},
+               "password=s" => \$settings{'pw'},
+               "database=s" => \$settings{'db'},
+               "hostname=s" => \$settings{'host'},
+               "port=i" => \$settings{'port'}, 
+               "help" => \$help
+);
+
+if (grep(/^all$/, @services)) {
+       @services = qw/reporter open-ils.cstore open-ils.pcrud open-ils.storage open-ils.reporter-store state_store/;
+}
+
+my $eg_config = File::Spec->catfile($script_dir, '../extras/eg_config');
+
+if (!$config_file) { 
+       my @temp = `$eg_config --sysconfdir`;
+       chomp $temp[0];
+       $sysconfdir = $temp[0];
+       $config_file = File::Spec->catfile($sysconfdir, "opensrf.xml");
+}
+
+if (!$prefix) {
+       my @temp = `$eg_config --prefix`;
+       chomp $temp[0];
+       $prefix = $temp[0];
+}
+
+if (!$build_db_sh) {
+       $build_db_sh = File::Spec->catfile($script_dir, '../sql/Pg/build-db.sh');
+}
+
+if (!$pg_contribdir) {
+       $pgconfig = 'pg_config' if(!$pgconfig);
+       my @temp = `$pgconfig --sharedir`;
+       chomp $temp[0];
+       $pg_contribdir = File::Spec->catdir($temp[0], 'contrib');
+}
+
+if (!$create_db_sql) {
+       $create_db_sql = File::Spec->catfile($script_dir, '../sql/Pg/create_database.sql');
+}
+
+if (!$create_db_sql_9_1) {
+       $create_db_sql_9_1 = File::Spec->catfile($script_dir, '../sql/Pg/create_database_9_1.sql');
+}
+
+if (!$offline_file) {
+       $offline_file = File::Spec->catfile($sysconfdir, 'offline-config.pl');
+}
+
+unless (-e $build_db_sh) { die "Error: $build_db_sh does not exist. \n"; }
+unless (-e $config_file) { die "Error: $config_file does not exist. \n"; }
+
+if ($uconfig) { update_config(\@services, \%settings); }
+
+# Get our settings from the config file
+get_settings(\%settings);
+
+if ($cdatabase) { create_database(\%settings); }
+if ($cschema) { create_schema(\%settings); }
+if ($admin_user && $admin_pw) {
+       set_admin_account($admin_user, $admin_pw, \%settings);
+}
+if ($offline) { create_offline_config($offline_file, \%settings); }
+
+if ((!$cdatabase && !$cschema && !$uconfig && !$offline && !$admin_pw) || $help) {
+       print <<HERE;
+
+SYNOPSIS
+    eg_db_config.pl [OPTION] ... [COMMAND] ... [CONFIG OPTIONS]
+
+DESCRIPTION
+    Creates or recreates the Evergreen database schema based on the settings
+    in the opensrf.xml configuration file.
+
+    Manipulates the configuration file 
+
+OPTIONS
+    --config-file
+        specifies the opensrf.xml file. Defaults to /openils/conf/opensrf.xml
+
+    --build-db-file
+        specifies the script that creates the database schema. Defaults to
+        Open-ILS/src/sql/pg/build-db.sh
+
+    --offline-file
+        specifies the offline database settings file required by the offline
+        data uploader. Defaults to /openils/conf/offline-config.pl
+
+COMMANDS
+    --update-config
+        Configures Evergreen database settings in the file specified by
+        --build-db-file.  
+
+    --create-offline
+        Creates the database setting file required by the offline data uploader
+
+    --create-schema
+        Creates the Evergreen database schema according to the settings in
+        the file specified by --config-file.  
+
+    --create-database
+        Creates the database itself, provided the user and password options
+        represent a superuser.
+
+SERVICE OPTIONS
+    --service
+        Specify "all" or one or more of the following services to update:
+            * reporter
+            * open-ils.cstore
+            * open-ils.pcrud
+            * open-ils.storage
+            * open-ils.reporter-store
+            * state_store
+    
+DATABASE CONFIGURATION OPTIONS
+    --user            username for the database 
+
+    --password        password for the user 
+
+    --database        name of the database 
+
+    --hostname        name or address of the database host 
+
+    --port            port number for database access
+
+    --admin-user      administration user's user name
+
+    --admin-pass      administration user's password
+
+EXAMPLES
+   This script is normally used during the initial installation and
+   configuration process. This creates the database schema, sets
+   the administration user's user name and password, and modifies your
+   configuration files to include the correct database connection
+   information.
+
+   For a single server install, or an install with one web/application
+   server and one database server, you will typically want to invoke this
+   script with a complete set of commands:
+
+   perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
+       --service all --create-schema --create-offline \
+       --user <db-user> --password <db-pass> --hostname localhost --port 5432 \
+       --database evergreen --admin-user <admin-user> --admin-pass <admin-pass> 
+
+   To update the configuration for a single service - for example, if you
+   replicated a database for reporting purposes - just issue the
+   --update-config command with the service identified and the changed
+   database parameters specified:
+
+   perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
+       --service reporter --hostname foobar --password newpass
+
+HERE
+}
diff --git a/templates/db/eg_db_postgres.crontab b/templates/db/eg_db_postgres.crontab
new file mode 100644 (file)
index 0000000..d8affa4
--- /dev/null
@@ -0,0 +1,5 @@
+# m h dom mon dow command
+
+40 22 * * * . /etc/profile && /home/postgres/eg/eg-db-backup.sh
+0 5 * * * for i in `find /var/backup/$HOSTNAME/ -ctime +1`; do rm $i 2>/dev/null; done
+0 5 * * * for i in `find /var/backup/snapshot/ -ctime +1`; do rm $i 2>/dev/null; done
diff --git a/templates/db/eg_db_root.crontab b/templates/db/eg_db_root.crontab
new file mode 100644 (file)
index 0000000..8e3b1f4
--- /dev/null
@@ -0,0 +1,3 @@
+# m h  dom mon dow   command
+
+0 1 * * * /root/eg/snapshots.sh
diff --git a/templates/db/eg_fstab_db b/templates/db/eg_fstab_db
new file mode 100644 (file)
index 0000000..9ad9a32
--- /dev/null
@@ -0,0 +1 @@
+_BACKUP01_IP:/var/backup /var/backup/ nfs rw 0 0
diff --git a/templates/db/pg9_etc_postgresl.tgz b/templates/db/pg9_etc_postgresl.tgz
new file mode 100644 (file)
index 0000000..9ae1b03
Binary files /dev/null and b/templates/db/pg9_etc_postgresl.tgz differ
diff --git a/templates/db/pg_hba.conf b/templates/db/pg_hba.conf
new file mode 100644 (file)
index 0000000..cf1106d
--- /dev/null
@@ -0,0 +1,87 @@
+# PostgreSQL Client Authentication Configuration File
+# ===================================================
+#
+# Refer to the "Client Authentication" section in the
+# PostgreSQL documentation for a complete description
+# of this file.  A short synopsis follows.
+#
+# This file controls: which hosts are allowed to connect, how clients
+# are authenticated, which PostgreSQL user names they can use, which
+# databases they can access.  Records take one of these forms:
+#
+# local      DATABASE  USER  METHOD  [OPTIONS]
+# host       DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTIONS]
+# hostssl    DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTIONS]
+# hostnossl  DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTIONS]
+#
+# (The uppercase items must be replaced by actual values.)
+#
+# The first field is the connection type: "local" is a Unix-domain socket,
+# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
+# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
+#
+# DATABASE can be "all", "sameuser", "samerole", a database name, or
+# a comma-separated list thereof.
+#
+# USER can be "all", a user name, a group name prefixed with "+", or
+# a comma-separated list thereof.  In both the DATABASE and USER fields
+# you can also write a file name prefixed with "@" to include names from
+# a separate file.
+#
+# CIDR-ADDRESS specifies the set of hosts the record matches.
+# It is made up of an IP address and a CIDR mask that is an integer
+# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
+# the number of significant bits in the mask.  Alternatively, you can write
+# an IP address and netmask in separate columns to specify the set of hosts.
+#
+# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi", "krb5",
+# "ident", "pam", "ldap" or "cert".  Note that "password" sends passwords
+# in clear text; "md5" is preferred since it sends encrypted passwords.
+#
+# OPTIONS are a set of options for the authentication in the format
+# NAME=VALUE. The available options depend on the different authentication
+# methods - refer to the "Client Authentication" section in the documentation
+# for a list of which options are available for which authentication methods.
+#
+# Database and user names containing spaces, commas, quotes and other special
+# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
+# "samerole" makes the name lose its special character, and just match a
+# database or username with that name.
+#
+# This file is read on server startup and when the postmaster receives
+# a SIGHUP signal.  If you edit the file on a running system, you have
+# to SIGHUP the postmaster for the changes to take effect.  You can use
+# "pg_ctl reload" to do that.
+
+# Put your actual configuration here
+# ----------------------------------
+#
+# If you want to allow non-local connections, you need to add more
+# "host" records. In that case you will also need to make PostgreSQL listen
+# on a non-local interface via the listen_addresses configuration parameter,
+# or via the -i or -h command line switches.
+#
+
+
+
+
+# DO NOT DISABLE!
+# If you change this first entry you will need to make sure that the
+# database
+# super user can access the database using some other method.
+# Noninteractive
+# access to all databases is required during automatic maintenance
+# (custom daily cronjobs, replication, and similar tasks).
+#
+# Database administrative login by UNIX sockets
+local   all         postgres                          ident
+
+# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
+
+# "local" is for Unix domain socket connections only
+local   all         all                               ident
+# IPv4 local connections:
+host    all         all         127.0.0.1/32          md5
+host    all         all         Priv_NET.0/24         md5
+# IPv6 local connections:
+host    all         all         ::1/128               md5
diff --git a/templates/db/postgresql.conf b/templates/db/postgresql.conf
new file mode 100644 (file)
index 0000000..1fb628d
--- /dev/null
@@ -0,0 +1,572 @@
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+#
+# This file consists of lines of the form:
+#
+#   name = value
+#
+# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
+# "#" anywhere on a line.  The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
+#
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
+#
+# This file is read on server startup and when the server receives a SIGHUP
+# signal.  If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, or use "pg_ctl reload".  Some
+# parameters, which are marked below, require a server shutdown and restart to
+# take effect.
+#
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on".  Some parameters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
+#                MB = megabytes                     s   = seconds
+#                GB = gigabytes                     min = minutes
+#                                                   h   = hours
+#                                                   d   = days
+
+
+#------------------------------------------------------------------------------
+# FILE LOCATIONS
+#------------------------------------------------------------------------------
+
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
+
+data_directory = '/var/lib/postgresql/9.1/main'                # use data in another directory
+                                       # (change requires restart)
+hba_file = '/etc/postgresql/9.1/main/pg_hba.conf'      # host-based authentication file
+                                       # (change requires restart)
+ident_file = '/etc/postgresql/9.1/main/pg_ident.conf'  # ident configuration file
+                                       # (change requires restart)
+
+# If external_pid_file is not explicitly set, no extra PID file is written.
+external_pid_file = '/var/run/postgresql/9.1-main.pid'         # write an extra PID file
+                                       # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONNECTIONS AND AUTHENTICATION
+#------------------------------------------------------------------------------
+
+# - Connection Settings -
+
+listen_addresses = '*'         # what IP address(es) to listen on;
+                                       # comma-separated list of addresses;
+                                       # defaults to 'localhost', '*' = all
+                                       # (change requires restart)
+port = 5432                            # (change requires restart)
+#max_connections = 100                 # (change requires restart)
+# Note:  Increasing max_connections costs ~400 bytes of shared memory per
+# connection slot, plus lock space (see max_locks_per_transaction).
+#superuser_reserved_connections = 3    # (change requires restart)
+unix_socket_directory = '/var/run/postgresql'          # (change requires restart)
+#unix_socket_group = ''                        # (change requires restart)
+#unix_socket_permissions = 0777                # begin with 0 to use octal notation
+                                       # (change requires restart)
+#bonjour = off                         # advertise server via Bonjour
+                                       # (change requires restart)
+#bonjour_name = ''                     # defaults to the computer name
+                                       # (change requires restart)
+
+# - Security and Authentication -
+
+#authentication_timeout = 1min         # 1s-600s
+ssl = true                             # (change requires restart)
+#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
+                                       # (change requires restart)
+#ssl_renegotiation_limit = 512MB       # amount of data between renegotiations
+#password_encryption = on
+#db_user_namespace = off
+
+# Kerberos and GSSAPI
+#krb_server_keyfile = ''
+#krb_srvname = 'postgres'              # (Kerberos only)
+#krb_caseins_users = off
+
+# - TCP Keepalives -
+# see "man 7 tcp" for details
+
+#tcp_keepalives_idle = 0               # TCP_KEEPIDLE, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_interval = 0           # TCP_KEEPINTVL, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_count = 0              # TCP_KEEPCNT;
+                                       # 0 selects the system default
+
+
+#------------------------------------------------------------------------------
+# RESOURCE USAGE (except WAL)
+#------------------------------------------------------------------------------
+
+# - Memory -
+
+#shared_buffers = 32MB                 # min 128kB
+                                       # (change requires restart)
+#temp_buffers = 8MB                    # min 800kB
+#max_prepared_transactions = 0         # zero disables the feature
+                                       # (change requires restart)
+# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
+# per transaction slot, plus lock space (see max_locks_per_transaction).
+# It is not advisable to set max_prepared_transactions nonzero unless you
+# actively intend to use prepared transactions.
+#work_mem = 1MB                                # min 64kB
+#maintenance_work_mem = 16MB           # min 1MB
+#max_stack_depth = 2MB                 # min 100kB
+
+# - Kernel Resource Usage -
+
+#max_files_per_process = 1000          # min 25
+                                       # (change requires restart)
+#shared_preload_libraries = ''         # (change requires restart)
+
+# - Cost-Based Vacuum Delay -
+
+#vacuum_cost_delay = 0ms               # 0-100 milliseconds
+#vacuum_cost_page_hit = 1              # 0-10000 credits
+#vacuum_cost_page_miss = 10            # 0-10000 credits
+#vacuum_cost_page_dirty = 20           # 0-10000 credits
+#vacuum_cost_limit = 200               # 1-10000 credits
+
+# - Background Writer -
+
+#bgwriter_delay = 200ms                        # 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100           # 0-1000 max buffers written/round
+#bgwriter_lru_multiplier = 2.0         # 0-10.0 multipler on buffers scanned/round
+
+# - Asynchronous Behavior -
+
+#effective_io_concurrency = 1          # 1-1000. 0 disables prefetching
+
+
+#------------------------------------------------------------------------------
+# WRITE AHEAD LOG
+#------------------------------------------------------------------------------
+
+# - Settings -
+
+wal_level = archive                    # minimal, archive, or hot_standby
+                                       # (change requires restart)
+#fsync = on                            # turns forced synchronization on or off
+#synchronous_commit = on               # synchronization level; on, off, or local
+#wal_sync_method = fsync               # the default is the first option
+                                       # supported by the operating system:
+                                       #   open_datasync
+                                       #   fdatasync (default on Linux)
+                                       #   fsync
+                                       #   fsync_writethrough
+                                       #   open_sync
+#full_page_writes = on                 # recover from partial page writes
+#wal_buffers = -1                      # min 32kB, -1 sets based on shared_buffers
+                                       # (change requires restart)
+#wal_writer_delay = 200ms              # 1-10000 milliseconds
+
+#commit_delay = 0                      # range 0-100000, in microseconds
+#commit_siblings = 5                   # range 1-1000
+
+# - Checkpoints -
+
+#checkpoint_segments = 3               # in logfile segments, min 1, 16MB each
+#checkpoint_timeout = 5min             # range 30s-1h
+#checkpoint_completion_target = 0.5    # checkpoint target duration, 0.0 - 1.0
+#checkpoint_warning = 30s              # 0 disables
+
+# - Archiving -
+
+archive_mode = on                      # allows archiving to be done
+                               # (change requires restart)
+archive_command = '/home/postgres/eg/eg-wal-archive.sh %p %f'          # command to use to archive a logfile segment
+#archive_timeout = 0           # force a logfile segment switch after this
+                               # number of seconds; 0 disables
+
+
+#------------------------------------------------------------------------------
+# REPLICATION
+#------------------------------------------------------------------------------
+
+# - Master Server -
+
+# These settings are ignored on a standby server
+
+#max_wal_senders = 0           # max number of walsender processes
+                               # (change requires restart)
+#wal_sender_delay = 1s         # walsender cycle time, 1-10000 milliseconds
+#wal_keep_segments = 0         # in logfile segments, 16MB each; 0 disables
+#vacuum_defer_cleanup_age = 0  # number of xacts by which cleanup is delayed
+#replication_timeout = 60s     # in milliseconds; 0 disables
+#synchronous_standby_names = ''        # standby servers that provide sync rep
+                               # comma-separated list of application_name
+                               # from standby(s); '*' = all
+
+# - Standby Servers -
+
+# These settings are ignored on a master server
+
+#hot_standby = off                     # "on" allows queries during recovery
+                                       # (change requires restart)
+#max_standby_archive_delay = 30s       # max delay before canceling queries
+                                       # when reading WAL from archive;
+                                       # -1 allows indefinite delay
+#max_standby_streaming_delay = 30s     # max delay before canceling queries
+                                       # when reading streaming WAL;
+                                       # -1 allows indefinite delay
+#wal_receiver_status_interval = 10s    # send replies at least this often
+                                       # 0 disables
+#hot_standby_feedback = off            # send info from standby to prevent
+                                       # query conflicts
+
+
+#------------------------------------------------------------------------------
+# QUERY TUNING
+#------------------------------------------------------------------------------
+
+# - Planner Method Configuration -
+
+#enable_bitmapscan = on
+#enable_hashagg = on
+#enable_hashjoin = on
+#enable_indexscan = on
+#enable_material = on
+#enable_mergejoin = on
+#enable_nestloop = on
+#enable_seqscan = on
+#enable_sort = on
+#enable_tidscan = on
+
+# - Planner Cost Constants -
+
+#seq_page_cost = 1.0                   # measured on an arbitrary scale
+random_page_cost = 2.0                 # same scale as above
+#cpu_tuple_cost = 0.01                 # same scale as above
+#cpu_index_tuple_cost = 0.005          # same scale as above
+#cpu_operator_cost = 0.0025            # same scale as above
+#effective_cache_size = 128MB
+
+# - Genetic Query Optimizer -
+
+#geqo = on
+#geqo_threshold = 12
+#geqo_effort = 5                       # range 1-10
+#geqo_pool_size = 0                    # selects default based on effort
+#geqo_generations = 0                  # selects default based on effort
+#geqo_selection_bias = 2.0             # range 1.5-2.0
+#geqo_seed = 0.0                       # range 0.0-1.0
+
+# - Other Planner Options -
+
+#default_statistics_target = 100       # range 1-10000
+#constraint_exclusion = partition      # on, off, or partition
+#cursor_tuple_fraction = 0.1           # range 0.0-1.0
+#from_collapse_limit = 8
+#join_collapse_limit = 8               # 1 disables collapsing of explicit
+                                       # JOIN clauses
+
+
+#------------------------------------------------------------------------------
+# ERROR REPORTING AND LOGGING
+#------------------------------------------------------------------------------
+
+# - Where to Log -
+
+log_destination = 'syslog'             # Valid values are combinations of
+                                       # stderr, csvlog, syslog, and eventlog,
+                                       # depending on platform.  csvlog
+                                       # requires logging_collector to be on.
+
+# This is used when logging to stderr:
+#logging_collector = off               # Enable capturing of stderr and csvlog
+                                       # into log files. Required to be on for
+                                       # csvlogs.
+                                       # (change requires restart)
+
+# These are only used if logging_collector is on:
+#log_directory = 'pg_log'              # directory where log files are written,
+                                       # can be absolute or relative to PGDATA
+#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'       # log file name pattern,
+                                       # can include strftime() escapes
+#log_file_mode = 0600                  # creation mode for log files,
+                                       # begin with 0 to use octal notation
+#log_truncate_on_rotation = off                # If on, an existing log file with the
+                                       # same name as the new log file will be
+                                       # truncated rather than appended to.
+                                       # But such truncation only occurs on
+                                       # time-driven rotation, not on restarts
+                                       # or size-driven rotation.  Default is
+                                       # off, meaning append to existing files
+                                       # in all cases.
+#log_rotation_age = 1d                 # Automatic rotation of logfiles will
+                                       # happen after that time.  0 disables.
+#log_rotation_size = 10MB              # Automatic rotation of logfiles will
+                                       # happen after that much log output.
+                                       # 0 disables.
+
+# These are relevant when logging to syslog:
+syslog_facility = 'LOCAL3'
+syslog_ident = 'postgres'
+
+#silent_mode = off                     # Run server silently.
+                                       # DO NOT USE without syslog or
+                                       # logging_collector
+                                       # (change requires restart)
+
+
+# - When to Log -
+
+#client_min_messages = notice          # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   log
+                                       #   notice
+                                       #   warning
+                                       #   error
+
+#log_min_messages = warning            # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic
+
+#log_min_error_statement = error       # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic (effectively off)
+
+log_min_duration_statement = 1000      # -1 is disabled, 0 logs all statements
+                                       # and their durations, > 0 logs only
+                                       # statements running at least this number
+                                       # of milliseconds
+
+
+# - What to Log -
+
+#debug_print_parse = off
+#debug_print_rewritten = off
+#debug_print_plan = off
+#debug_pretty_print = on
+#log_checkpoints = off
+#log_connections = off
+#log_disconnections = off
+#log_duration = off
+#log_error_verbosity = default         # terse, default, or verbose messages
+#log_hostname = off
+log_line_prefix = '%t '                        # special values:
+                                       #   %a = application name
+                                       #   %u = user name
+                                       #   %d = database name
+                                       #   %r = remote host and port
+                                       #   %h = remote host
+                                       #   %p = process ID
+                                       #   %t = timestamp without milliseconds
+                                       #   %m = timestamp with milliseconds
+                                       #   %i = command tag
+                                       #   %e = SQL state
+                                       #   %c = session ID
+                                       #   %l = session line number
+                                       #   %s = session start timestamp
+                                       #   %v = virtual transaction ID
+                                       #   %x = transaction ID (0 if none)
+                                       #   %q = stop here in non-session
+                                       #        processes
+                                       #   %% = '%'
+                                       # e.g. '<%u%%%d> '
+#log_lock_waits = off                  # log lock waits >= deadlock_timeout
+#log_statement = 'none'                        # none, ddl, mod, all
+#log_temp_files = -1                   # log temporary files equal or larger
+                                       # than the specified size in kilobytes;
+                                       # -1 disables, 0 logs all temp files
+#log_timezone = '(defaults to server environment setting)'
+
+
+#------------------------------------------------------------------------------
+# RUNTIME STATISTICS
+#------------------------------------------------------------------------------
+
+# - Query/Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#track_functions = none                        # none, pl, all
+#track_activity_query_size = 1024      # (change requires restart)
+#update_process_title = on
+#stats_temp_directory = 'pg_stat_tmp'
+
+
+# - Statistics Monitoring -
+
+#log_parser_stats = off
+#log_planner_stats = off
+#log_executor_stats = off
+#log_statement_stats = off
+
+
+#------------------------------------------------------------------------------
+# AUTOVACUUM PARAMETERS
+#------------------------------------------------------------------------------
+
+#autovacuum = on                       # Enable autovacuum subprocess?  'on'
+                                       # requires track_counts to also be on.
+#log_autovacuum_min_duration = -1      # -1 disables, 0 logs all actions and
+                                       # their durations, > 0 logs only
+                                       # actions running at least this number
+                                       # of milliseconds.
+#autovacuum_max_workers = 3            # max number of autovacuum subprocesses
+                                       # (change requires restart)
+#autovacuum_naptime = 1min             # time between autovacuum runs
+#autovacuum_vacuum_threshold = 50      # min number of row updates before
+                                       # vacuum
+#autovacuum_analyze_threshold = 50     # min number of row updates before
+                                       # analyze
+#autovacuum_vacuum_scale_factor = 0.2  # fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
+                                       # (change requires restart)
+#autovacuum_vacuum_cost_delay = 20ms   # default vacuum cost delay for
+                                       # autovacuum, in milliseconds;
+                                       # -1 means use vacuum_cost_delay
+#autovacuum_vacuum_cost_limit = -1     # default vacuum cost limit for
+                                       # autovacuum, -1 means use
+                                       # vacuum_cost_limit
+
+
+#------------------------------------------------------------------------------
+# CLIENT CONNECTION DEFAULTS
+#------------------------------------------------------------------------------
+
+# - Statement Behavior -
+
+#search_path = '"$user",public'                # schema names
+#default_tablespace = ''               # a tablespace name, '' uses the default
+#temp_tablespaces = ''                 # a list of tablespace names, '' uses
+                                       # only default tablespace
+#check_function_bodies = on
+#default_transaction_isolation = 'read committed'
+#default_transaction_read_only = off
+#default_transaction_deferrable = off
+#session_replication_role = 'origin'
+#statement_timeout = 0                 # in milliseconds, 0 is disabled
+#vacuum_freeze_min_age = 50000000
+#vacuum_freeze_table_age = 150000000
+#bytea_output = 'hex'                  # hex, escape
+#xmlbinary = 'base64'
+#xmloption = 'content'
+
+# - Locale and Formatting -
+
+datestyle = 'iso, mdy'
+#intervalstyle = 'postgres'
+#timezone = '(defaults to server environment setting)'
+#timezone_abbreviations = 'Default'     # Select the set of available time zone
+                                       # abbreviations.  Currently, there are
+                                       #   Default
+                                       #   Australia
+                                       #   India
+                                       # You can create your own file in
+                                       # share/timezonesets/.
+#extra_float_digits = 0                        # min -15, max 3
+#client_encoding = sql_ascii           # actually, defaults to database
+                                       # encoding
+
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'en_US.UTF-8'                    # locale for system error message
+                                       # strings
+lc_monetary = 'en_US.UTF-8'                    # locale for monetary formatting
+lc_numeric = 'en_US.UTF-8'                     # locale for number formatting
+lc_time = 'en_US.UTF-8'                                # locale for time formatting
+
+# default configuration for text search
+default_text_search_config = 'pg_catalog.english'
+
+# - Other Defaults -
+
+#dynamic_library_path = '$libdir'
+#local_preload_libraries = ''
+
+
+#------------------------------------------------------------------------------
+# LOCK MANAGEMENT
+#------------------------------------------------------------------------------
+
+#deadlock_timeout = 1s
+#max_locks_per_transaction = 64                # min 10
+                                       # (change requires restart)
+# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
+# max_locks_per_transaction * (max_connections + max_prepared_transactions)
+# lock table slots.
+#max_pred_locks_per_transaction = 64   # min 10
+                                       # (change requires restart)
+
+#------------------------------------------------------------------------------
+# VERSION/PLATFORM COMPATIBILITY
+#------------------------------------------------------------------------------
+
+# - Previous PostgreSQL Versions -
+
+#array_nulls = on
+#backslash_quote = safe_encoding       # on, off, or safe_encoding
+#default_with_oids = off
+#escape_string_warning = on
+#lo_compat_privileges = off
+#quote_all_identifiers = off
+#sql_inheritance = on
+#standard_conforming_strings = on
+#synchronize_seqscans = on
+
+# - Other Platforms and Clients -
+
+#transform_null_equals = off
+
+
+#------------------------------------------------------------------------------
+# ERROR HANDLING
+#------------------------------------------------------------------------------
+
+#exit_on_error = off                           # terminate session on any error?
+#restart_after_crash = on                      # reinitialize after backend crash?
+
+
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+#custom_variable_classes = ''          # list of custom variable class names
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+#custom_variable_classes = ''           # list of custom variable class names
+default_statistics_target = 100 # pgtune wizard 2011-04-13
+maintenance_work_mem = 1GB # pgtune wizard 2011-04-13
+constraint_exclusion = on # pgtune wizard 2011-04-13
+checkpoint_completion_target = 0.9 # pgtune wizard 2011-04-13
+effective_cache_size = 88GB # pgtune wizard 2011-04-13
+work_mem = 256MB # pgtune wizard 2011-04-13
+wal_buffers = 8MB # pgtune wizard 2011-04-13
+checkpoint_segments = 64 # pgtune wizard 2011-04-13
+shared_buffers = 8GB # pgtune wizard 2011-04-13
+max_connections = 1000 # pgtune wizard 2011-04-13
+
diff --git a/templates/db/postgresql.conf-8.4 b/templates/db/postgresql.conf-8.4
new file mode 100644 (file)
index 0000000..0e3f70f
--- /dev/null
@@ -0,0 +1,517 @@
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+#
+# This file consists of lines of the form:
+#
+#   name = value
+#
+# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
+# "#" anywhere on a line.  The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
+#
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
+#
+# This file is read on server startup and when the server receives a SIGHUP
+# signal.  If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, or use "pg_ctl reload".  Some
+# parameters, which are marked below, require a server shutdown and restart to
+# take effect.
+#
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on".  Some parameters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
+#                MB = megabytes                     s   = seconds
+#                GB = gigabytes                     min = minutes
+#                                                   h   = hours
+#                                                   d   = days
+
+
+#------------------------------------------------------------------------------
+# FILE LOCATIONS
+#------------------------------------------------------------------------------
+
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
+
+data_directory = '/var/lib/postgresql/8.4/main'                # use data in another directory
+                                       # (change requires restart)
+hba_file = '/etc/postgresql/8.4/main/pg_hba.conf'      # host-based authentication file
+                                       # (change requires restart)
+ident_file = '/etc/postgresql/8.4/main/pg_ident.conf'  # ident configuration file
+                                       # (change requires restart)
+
+# If external_pid_file is not explicitly set, no extra PID file is written.
+external_pid_file = '/var/run/postgresql/8.4-main.pid'         # write an extra PID file
+                                       # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONNECTIONS AND AUTHENTICATION
+#------------------------------------------------------------------------------
+
+# - Connection Settings -
+
+listen_addresses = '*'         # what IP address(es) to listen on;
+                                       # comma-separated list of addresses;
+                                       # defaults to 'localhost', '*' = all
+                                       # (change requires restart)
+port = 5432                            # (change requires restart)
+max_connections = 100                  # (change requires restart)
+# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
+# connection slot, plus lock space (see max_locks_per_transaction).
+#superuser_reserved_connections = 3    # (change requires restart)
+unix_socket_directory = '/var/run/postgresql'          # (change requires restart)
+#unix_socket_group = ''                        # (change requires restart)
+#unix_socket_permissions = 0777                # begin with 0 to use octal notation
+                                       # (change requires restart)
+#bonjour_name = ''                     # defaults to the computer name
+                                       # (change requires restart)
+
+# - Security and Authentication -
+
+#authentication_timeout = 1min         # 1s-600s
+ssl = true                             # (change requires restart)
+#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
+                                       # (change requires restart)
+#ssl_renegotiation_limit = 512MB       # amount of data between renegotiations
+#password_encryption = on
+#db_user_namespace = off
+
+# Kerberos and GSSAPI
+#krb_server_keyfile = ''
+#krb_srvname = 'postgres'              # (Kerberos only)
+#krb_caseins_users = off
+
+# - TCP Keepalives -
+# see "man 7 tcp" for details
+
+#tcp_keepalives_idle = 0               # TCP_KEEPIDLE, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_interval = 0           # TCP_KEEPINTVL, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_count = 0              # TCP_KEEPCNT;
+                                       # 0 selects the system default
+
+
+#------------------------------------------------------------------------------
+# RESOURCE USAGE (except WAL)
+#------------------------------------------------------------------------------
+
+# - Memory -
+
+
+
+#_______Evergreen__Configs
+shared_buffers = 40000                  # min 16 or max_connections*2, 8KB each
+work_mem = 256000                       # min 64, size in KB
+maintenance_work_mem = 128000           # min 1024, size in KB
+
+# - Free Space Map -
+
+
+#max_fsm_pages = 2000000                 # min max_fsm_relations*16, 6 bytes each
+#max_fsm_relations = 1000                # min 100, ~70 bytes each
+
+#______
+
+
+#shared_buffers = 24MB                 # min 128kB
+                                       # (change requires restart)
+#temp_buffers = 8MB                    # min 800kB
+#max_prepared_transactions = 0         # zero disables the feature
+                                       # (change requires restart)
+# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
+# per transaction slot, plus lock space (see max_locks_per_transaction).
+# It is not advisable to set max_prepared_transactions nonzero unless you
+# actively intend to use prepared transactions.
+#work_mem = 1MB                                # min 64kB
+#maintenance_work_mem = 16MB           # min 1MB
+#max_stack_depth = 2MB                 # min 100kB
+
+# - Kernel Resource Usage -
+
+#max_files_per_process = 1000          # min 25
+                                       # (change requires restart)
+#shared_preload_libraries = ''         # (change requires restart)
+
+# - Cost-Based Vacuum Delay -
+
+#vacuum_cost_delay = 0ms               # 0-100 milliseconds
+#vacuum_cost_page_hit = 1              # 0-10000 credits
+#vacuum_cost_page_miss = 10            # 0-10000 credits
+#vacuum_cost_page_dirty = 20           # 0-10000 credits
+#vacuum_cost_limit = 200               # 1-10000 credits
+
+# - Background Writer -
+
+#bgwriter_delay = 200ms                        # 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100           # 0-1000 max buffers written/round
+#bgwriter_lru_multiplier = 2.0         # 0-10.0 multipler on buffers scanned/round
+
+# - Asynchronous Behavior -
+
+#effective_io_concurrency = 1          # 1-1000. 0 disables prefetching
+
+
+#------------------------------------------------------------------------------
+# WRITE AHEAD LOG
+#------------------------------------------------------------------------------
+
+# - Settings -
+
+#fsync = on                            # turns forced synchronization on or off
+#synchronous_commit = on               # immediate fsync at commit
+#wal_sync_method = fsync               # the default is the first option 
+                                       # supported by the operating system:
+                                       #   open_datasync
+                                       #   fdatasync (default on Linux)
+                                       #   fsync
+                                       #   fsync_writethrough
+                                       #   open_sync
+#full_page_writes = on                 # recover from partial page writes
+#wal_buffers = 64kB                    # min 32kB
+                                       # (change requires restart)
+#wal_writer_delay = 200ms              # 1-10000 milliseconds
+
+#commit_delay = 0                      # range 0-100000, in microseconds
+#commit_siblings = 5                   # range 1-1000
+
+# - Checkpoints -
+
+#checkpoint_segments = 3               # in logfile segments, min 1, 16MB each
+#checkpoint_timeout = 5min             # range 30s-1h
+#checkpoint_completion_target = 0.5    # checkpoint target duration, 0.0 - 1.0
+#checkpoint_warning = 30s              # 0 disables
+
+# - Archiving -
+
+#archive_mode = off            # allows archiving to be done
+                               # (change requires restart)
+#archive_command = ''          # command to use to archive a logfile segment
+#archive_timeout = 0           # force a logfile segment switch after this
+                               # number of seconds; 0 disables
+
+
+#------------------------------------------------------------------------------
+# QUERY TUNING
+#------------------------------------------------------------------------------
+
+# - Planner Method Configuration -
+
+#enable_bitmapscan = on
+#enable_hashagg = on
+#enable_hashjoin = on
+#enable_indexscan = on
+#enable_mergejoin = on
+#enable_nestloop = on
+#enable_seqscan = on
+#enable_sort = on
+#enable_tidscan = on
+
+# - Planner Cost Constants -
+
+#seq_page_cost = 1.0                   # measured on an arbitrary scale
+#random_page_cost = 4.0                        # same scale as above
+#cpu_tuple_cost = 0.01                 # same scale as above
+#cpu_index_tuple_cost = 0.005          # same scale as above
+#cpu_operator_cost = 0.0025            # same scale as above
+#effective_cache_size = 128MB
+
+# - Genetic Query Optimizer -
+
+#geqo = on
+#geqo_threshold = 12
+#geqo_effort = 5                       # range 1-10
+#geqo_pool_size = 0                    # selects default based on effort
+#geqo_generations = 0                  # selects default based on effort
+#geqo_selection_bias = 2.0             # range 1.5-2.0
+
+# - Other Planner Options -
+
+#default_statistics_target = 100       # range 1-10000
+#constraint_exclusion = partition      # on, off, or partition
+#cursor_tuple_fraction = 0.1           # range 0.0-1.0
+#from_collapse_limit = 8
+#join_collapse_limit = 8               # 1 disables collapsing of explicit 
+                                       # JOIN clauses
+
+
+#------------------------------------------------------------------------------
+# ERROR REPORTING AND LOGGING
+#------------------------------------------------------------------------------
+
+# - Where to Log -
+
+log_destination = 'syslog'             # Valid values are combinations of
+                                       # stderr, csvlog, syslog and eventlog,
+                                       # depending on platform.  csvlog
+                                       # requires logging_collector to be on.
+
+# This is used when logging to stderr:
+#logging_collector = off               # Enable capturing of stderr and csvlog
+                                       # into log files. Required to be on for
+                                       # csvlogs.
+                                       # (change requires restart)
+
+# These are only used if logging_collector is on:
+#log_directory = 'pg_log'              # directory where log files are written,
+                                       # can be absolute or relative to PGDATA
+#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'       # log file name pattern,
+                                       # can include strftime() escapes
+#log_truncate_on_rotation = off                # If on, an existing log file of the
+                                       # same name as the new log file will be
+                                       # truncated rather than appended to.
+                                       # But such truncation only occurs on
+                                       # time-driven rotation, not on restarts
+                                       # or size-driven rotation.  Default is
+                                       # off, meaning append to existing files
+                                       # in all cases.
+#log_rotation_age = 1d                 # Automatic rotation of logfiles will
+                                       # happen after that time.  0 disables.
+#log_rotation_size = 10MB              # Automatic rotation of logfiles will 
+                                       # happen after that much log output.
+                                       # 0 disables.
+
+# These are relevant when logging to syslog:
+syslog_facility = 'LOCAL3'
+syslog_ident = 'postgres'
+
+#silent_mode = off                     # Run server silently.
+                                       # DO NOT USE without syslog or
+                                       # logging_collector
+                                       # (change requires restart)
+
+
+# - When to Log -
+
+#client_min_messages = notice          # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   log
+                                       #   notice
+                                       #   warning
+                                       #   error
+
+#log_min_messages = warning            # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic
+
+#log_error_verbosity = default         # terse, default, or verbose messages
+
+#log_min_error_statement = error       # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic (effectively off)
+
+#log_min_duration_statement = -1       # -1 is disabled, 0 logs all statements
+                                       # and their durations, > 0 logs only
+                                       # statements running at least this number
+                                       # of milliseconds
+
+
+# - What to Log -
+
+#debug_print_parse = off
+#debug_print_rewritten = off
+#debug_print_plan = off
+#debug_pretty_print = on
+#log_checkpoints = off
+#log_connections = off
+#log_disconnections = off
+#log_duration = off
+#log_hostname = off
+log_line_prefix = '%t '                        # special values:
+                                       #   %u = user name
+                                       #   %d = database name
+                                       #   %r = remote host and port
+                                       #   %h = remote host
+                                       #   %p = process ID
+                                       #   %t = timestamp without milliseconds
+                                       #   %m = timestamp with milliseconds
+                                       #   %i = command tag
+                                       #   %c = session ID
+                                       #   %l = session line number
+                                       #   %s = session start timestamp
+                                       #   %v = virtual transaction ID
+                                       #   %x = transaction ID (0 if none)
+                                       #   %q = stop here in non-session
+                                       #        processes
+                                       #   %% = '%'
+                                       # e.g. '<%u%%%d> '
+#log_lock_waits = off                  # log lock waits >= deadlock_timeout
+#log_statement = 'none'                        # none, ddl, mod, all
+#log_temp_files = -1                   # log temporary files equal or larger
+                                       # than the specified size in kilobytes;
+                                       # -1 disables, 0 logs all temp files
+#log_timezone = unknown                        # actually, defaults to TZ environment
+                                       # setting
+
+
+#------------------------------------------------------------------------------
+# RUNTIME STATISTICS
+#------------------------------------------------------------------------------
+
+# - Query/Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#track_functions = none                        # none, pl, all
+#track_activity_query_size = 1024
+#update_process_title = on
+#stats_temp_directory = 'pg_stat_tmp'
+
+
+# - Statistics Monitoring -
+
+#log_parser_stats = off
+#log_planner_stats = off
+#log_executor_stats = off
+#log_statement_stats = off
+
+
+#------------------------------------------------------------------------------
+# AUTOVACUUM PARAMETERS
+#------------------------------------------------------------------------------
+
+#autovacuum = on                       # Enable autovacuum subprocess?  'on' 
+                                       # requires track_counts to also be on.
+#log_autovacuum_min_duration = -1      # -1 disables, 0 logs all actions and
+                                       # their durations, > 0 logs only
+                                       # actions running at least this number
+                                       # of milliseconds.
+#autovacuum_max_workers = 3            # max number of autovacuum subprocesses
+#autovacuum_naptime = 1min             # time between autovacuum runs
+#autovacuum_vacuum_threshold = 50      # min number of row updates before
+                                       # vacuum
+#autovacuum_analyze_threshold = 50     # min number of row updates before 
+                                       # analyze
+#autovacuum_vacuum_scale_factor = 0.2  # fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
+                                       # (change requires restart)
+#autovacuum_vacuum_cost_delay = 20ms   # default vacuum cost delay for
+                                       # autovacuum, in milliseconds;
+                                       # -1 means use vacuum_cost_delay
+#autovacuum_vacuum_cost_limit = -1     # default vacuum cost limit for
+                                       # autovacuum, -1 means use
+                                       # vacuum_cost_limit
+
+
+#------------------------------------------------------------------------------
+# CLIENT CONNECTION DEFAULTS
+#------------------------------------------------------------------------------
+
+# - Statement Behavior -
+
+#search_path = '"$user",public'                # schema names
+#default_tablespace = ''               # a tablespace name, '' uses the default
+#temp_tablespaces = ''                 # a list of tablespace names, '' uses
+                                       # only default tablespace
+#check_function_bodies = on
+#default_transaction_isolation = 'read committed'
+#default_transaction_read_only = off
+#session_replication_role = 'origin'
+#statement_timeout = 0                 # in milliseconds, 0 is disabled
+#vacuum_freeze_min_age = 50000000
+#vacuum_freeze_table_age = 150000000
+#xmlbinary = 'base64'
+#xmloption = 'content'
+
+# - Locale and Formatting -
+
+datestyle = 'iso, mdy'
+#intervalstyle = 'postgres'
+#timezone = unknown                    # actually, defaults to TZ environment
+                                       # setting
+#timezone_abbreviations = 'Default'     # Select the set of available time zone
+                                       # abbreviations.  Currently, there are
+                                       #   Default
+                                       #   Australia
+                                       #   India
+                                       # You can create your own file in
+                                       # share/timezonesets/.
+#extra_float_digits = 0                        # min -15, max 2
+#client_encoding = sql_ascii           # actually, defaults to database
+                                       # encoding
+
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'en_US.UTF-8'                    # locale for system error message
+                                       # strings
+lc_monetary = 'en_US.UTF-8'                    # locale for monetary formatting
+lc_numeric = 'en_US.UTF-8'                     # locale for number formatting
+lc_time = 'en_US.UTF-8'                                # locale for time formatting
+
+# default configuration for text search
+default_text_search_config = 'pg_catalog.english'
+
+# - Other Defaults -
+
+#dynamic_library_path = '$libdir'
+#local_preload_libraries = ''
+
+
+#------------------------------------------------------------------------------
+# LOCK MANAGEMENT
+#------------------------------------------------------------------------------
+
+#deadlock_timeout = 1s
+#max_locks_per_transaction = 64                # min 10
+                                       # (change requires restart)
+# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
+# max_locks_per_transaction * (max_connections + max_prepared_transactions)
+# lock table slots.
+
+
+#------------------------------------------------------------------------------
+# VERSION/PLATFORM COMPATIBILITY
+#------------------------------------------------------------------------------
+
+# - Previous PostgreSQL Versions -
+
+#add_missing_from = off
+#array_nulls = on
+#backslash_quote = safe_encoding       # on, off, or safe_encoding
+#default_with_oids = off
+#escape_string_warning = on
+#regex_flavor = advanced               # advanced, extended, or basic
+#sql_inheritance = on
+#standard_conforming_strings = off
+#synchronize_seqscans = on
+
+# - Other Platforms and Clients -
+
+#transform_null_equals = off
+
+
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+#custom_variable_classes = ''          # list of custom variable class names
diff --git a/templates/db/postgresql.conf-9.1.0 b/templates/db/postgresql.conf-9.1.0
new file mode 100644 (file)
index 0000000..994677a
--- /dev/null
@@ -0,0 +1,528 @@
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+#
+# This file consists of lines of the form:
+#
+#   name = value
+#
+# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
+# "#" anywhere on a line.  The complete list of parameter names and allowed
+# values can be found in the PostgreSQL documentation.
+#
+# The commented-out settings shown in this file represent the default values.
+# Re-commenting a setting is NOT sufficient to revert it to the default value;
+# you need to reload the server.
+#
+# This file is read on server startup and when the server receives a SIGHUP
+# signal.  If you edit the file on a running system, you have to SIGHUP the
+# server for the changes to take effect, or use "pg_ctl reload".  Some
+# parameters, which are marked below, require a server shutdown and restart to
+# take effect.
+#
+# Any parameter can also be given as a command-line option to the server, e.g.,
+# "postgres -c log_connections=on".  Some parameters can be changed at run time
+# with the "SET" SQL command.
+#
+# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
+#                MB = megabytes                     s   = seconds
+#                GB = gigabytes                     min = minutes
+#                                                   h   = hours
+#                                                   d   = days
+
+
+#------------------------------------------------------------------------------
+# FILE LOCATIONS
+#------------------------------------------------------------------------------
+
+# The default values of these variables are driven from the -D command-line
+# option or PGDATA environment variable, represented here as ConfigDir.
+
+data_directory = '/var/lib/postgresql/9.0/main'                # use data in another directory
+                                       # (change requires restart)
+hba_file = '/etc/postgresql/9.0/main/pg_hba.conf'      # host-based authentication file
+                                       # (change requires restart)
+ident_file = '/etc/postgresql/9.0/main/pg_ident.conf'  # ident configuration file
+                                       # (change requires restart)
+
+# If external_pid_file is not explicitly set, no extra PID file is written.
+external_pid_file = '/var/run/postgresql/9.0-main.pid'         # write an extra PID file
+                                       # (change requires restart)
+
+
+#------------------------------------------------------------------------------
+# CONNECTIONS AND AUTHENTICATION
+#------------------------------------------------------------------------------
+
+# - Connection Settings -
+
+listen_addresses = '*'         # what IP address(es) to listen on;
+                                       # comma-separated list of addresses;
+                                       # defaults to 'localhost', '*' = all
+                                       # (change requires restart)
+port = 5432                            # (change requires restart)
+max_connections = 100                  # (change requires restart)
+# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
+# connection slot, plus lock space (see max_locks_per_transaction).
+#superuser_reserved_connections = 3    # (change requires restart)
+unix_socket_directory = '/var/run/postgresql'          # (change requires restart)
+#unix_socket_group = ''                        # (change requires restart)
+#unix_socket_permissions = 0777                # begin with 0 to use octal notation
+                                       # (change requires restart)
+#bonjour = off                         # advertise server via Bonjour
+                                       # (change requires restart)
+#bonjour_name = ''                     # defaults to the computer name
+                                       # (change requires restart)
+
+# - Security and Authentication -
+
+#authentication_timeout = 1min         # 1s-600s
+ssl = true                             # (change requires restart)
+#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
+                                       # (change requires restart)
+#ssl_renegotiation_limit = 512MB       # amount of data between renegotiations
+#password_encryption = on
+#db_user_namespace = off
+
+# Kerberos and GSSAPI
+#krb_server_keyfile = ''
+#krb_srvname = 'postgres'              # (Kerberos only)
+#krb_caseins_users = off
+
+# - TCP Keepalives -
+# see "man 7 tcp" for details
+
+#tcp_keepalives_idle = 0               # TCP_KEEPIDLE, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_interval = 0           # TCP_KEEPINTVL, in seconds;
+                                       # 0 selects the system default
+#tcp_keepalives_count = 0              # TCP_KEEPCNT;
+                                       # 0 selects the system default
+
+
+#------------------------------------------------------------------------------
+# RESOURCE USAGE (except WAL)
+#------------------------------------------------------------------------------
+
+# - Memory -
+
+shared_buffers = 32MB                  # min 128kB
+                                       # (change requires restart)
+#temp_buffers = 8MB                    # min 800kB
+#max_prepared_transactions = 0         # zero disables the feature
+                                       # (change requires restart)
+# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
+# per transaction slot, plus lock space (see max_locks_per_transaction).
+# It is not advisable to set max_prepared_transactions nonzero unless you
+# actively intend to use prepared transactions.
+work_mem = 256MB                               # min 64kB
+#maintenance_work_mem = 16MB           # min 1MB
+#max_stack_depth = 2MB                 # min 100kB
+
+# - Kernel Resource Usage -
+
+#max_files_per_process = 1000          # min 25
+                                       # (change requires restart)
+#shared_preload_libraries = ''         # (change requires restart)
+
+# - Cost-Based Vacuum Delay -
+
+#vacuum_cost_delay = 0ms               # 0-100 milliseconds
+#vacuum_cost_page_hit = 1              # 0-10000 credits
+#vacuum_cost_page_miss = 10            # 0-10000 credits
+#vacuum_cost_page_dirty = 20           # 0-10000 credits
+#vacuum_cost_limit = 200               # 1-10000 credits
+
+# - Background Writer -
+
+#bgwriter_delay = 200ms                        # 10-10000ms between rounds
+#bgwriter_lru_maxpages = 100           # 0-1000 max buffers written/round
+#bgwriter_lru_multiplier = 2.0         # 0-10.0 multipler on buffers scanned/round
+
+# - Asynchronous Behavior -
+
+#effective_io_concurrency = 1          # 1-1000. 0 disables prefetching
+
+
+#------------------------------------------------------------------------------
+# WRITE AHEAD LOG
+#------------------------------------------------------------------------------
+
+# - Settings -
+
+#wal_level = minimal                   # minimal, archive, or hot_standby
+                                       # (change requires restart)
+#fsync = on                            # turns forced synchronization on or off
+#synchronous_commit = on               # immediate fsync at commit
+#wal_sync_method = fsync               # the default is the first option 
+                                       # supported by the operating system:
+                                       #   open_datasync
+                                       #   fdatasync (default on Linux)
+                                       #   fsync
+                                       #   fsync_writethrough
+                                       #   open_sync
+#full_page_writes = on                 # recover from partial page writes
+#wal_buffers = 64kB                    # min 32kB
+                                       # (change requires restart)
+#wal_writer_delay = 200ms              # 1-10000 milliseconds
+
+#commit_delay = 0                      # range 0-100000, in microseconds
+#commit_siblings = 5                   # range 1-1000
+
+# - Checkpoints -
+
+#checkpoint_segments = 3               # in logfile segments, min 1, 16MB each
+#checkpoint_timeout = 5min             # range 30s-1h
+#checkpoint_completion_target = 0.5    # checkpoint target duration, 0.0 - 1.0
+#checkpoint_warning = 30s              # 0 disables
+
+# - Archiving -
+
+#archive_mode = off            # allows archiving to be done
+                               # (change requires restart)
+#archive_command = ''          # command to use to archive a logfile segment
+#archive_timeout = 0           # force a logfile segment switch after this
+                               # number of seconds; 0 disables
+
+# - Streaming Replication -
+
+#max_wal_senders = 0           # max number of walsender processes
+                               # (change requires restart)
+#wal_sender_delay = 200ms      # walsender cycle time, 1-10000 milliseconds
+#wal_keep_segments = 0         # in logfile segments, 16MB each; 0 disables
+#vacuum_defer_cleanup_age = 0  # number of xacts by which cleanup is delayed
+
+# - Standby Servers -
+
+#hot_standby = off                     # "on" allows queries during recovery
+                                       # (change requires restart)
+#max_standby_archive_delay = 30s       # max delay before canceling queries
+                                       # when reading WAL from archive;
+                                       # -1 allows indefinite delay
+#max_standby_streaming_delay = 30s     # max delay before canceling queries
+                                       # when reading streaming WAL;
+                                       # -1 allows indefinite delay
+
+
+#------------------------------------------------------------------------------
+# QUERY TUNING
+#------------------------------------------------------------------------------
+
+# - Planner Method Configuration -
+
+#enable_bitmapscan = on
+#enable_hashagg = on
+#enable_hashjoin = on
+#enable_indexscan = on
+#enable_material = on
+#enable_mergejoin = on
+#enable_nestloop = on
+#enable_seqscan = on
+#enable_sort = on
+#enable_tidscan = on
+
+# - Planner Cost Constants -
+
+#seq_page_cost = 1.0                   # measured on an arbitrary scale
+random_page_cost = 2.0                 # same scale as above
+#cpu_tuple_cost = 0.01                 # same scale as above
+#cpu_index_tuple_cost = 0.005          # same scale as above
+#cpu_operator_cost = 0.0025            # same scale as above
+#effective_cache_size = 128MB
+
+# - Genetic Query Optimizer -
+
+#geqo = on
+#geqo_threshold = 12
+#geqo_effort = 5                       # range 1-10
+#geqo_pool_size = 0                    # selects default based on effort
+#geqo_generations = 0                  # selects default based on effort
+#geqo_selection_bias = 2.0             # range 1.5-2.0
+#geqo_seed = 0.0                       # range 0.0-1.0
+
+# - Other Planner Options -
+
+default_statistics_target = 110        # range 1-10000
+#constraint_exclusion = partition      # on, off, or partition
+#cursor_tuple_fraction = 0.1           # range 0.0-1.0
+#from_collapse_limit = 8
+#join_collapse_limit = 8               # 1 disables collapsing of explicit 
+                                       # JOIN clauses
+
+
+#------------------------------------------------------------------------------
+# ERROR REPORTING AND LOGGING
+#------------------------------------------------------------------------------
+
+# - Where to Log -
+
+log_destination = 'syslog'             # Valid values are combinations of
+                                       # stderr, csvlog, syslog, and eventlog,
+                                       # depending on platform.  csvlog
+                                       # requires logging_collector to be on.
+
+# This is used when logging to stderr:
+#logging_collector = off               # Enable capturing of stderr and csvlog
+                                       # into log files. Required to be on for
+                                       # csvlogs.
+                                       # (change requires restart)
+
+# These are only used if logging_collector is on:
+#log_directory = 'pg_log'              # directory where log files are written,
+                                       # can be absolute or relative to PGDATA
+#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'       # log file name pattern,
+                                       # can include strftime() escapes
+#log_truncate_on_rotation = off                # If on, an existing log file of the
+                                       # same name as the new log file will be
+                                       # truncated rather than appended to.
+                                       # But such truncation only occurs on
+                                       # time-driven rotation, not on restarts
+                                       # or size-driven rotation.  Default is
+                                       # off, meaning append to existing files
+                                       # in all cases.
+#log_rotation_age = 1d                 # Automatic rotation of logfiles will
+                                       # happen after that time.  0 disables.
+#log_rotation_size = 10MB              # Automatic rotation of logfiles will 
+                                       # happen after that much log output.
+                                       # 0 disables.
+
+# These are relevant when logging to syslog:
+syslog_facility = 'LOCAL3'
+syslog_ident = 'postgres'
+
+#silent_mode = off                     # Run server silently.
+                                       # DO NOT USE without syslog or
+                                       # logging_collector
+                                       # (change requires restart)
+
+
+# - When to Log -
+
+#client_min_messages = notice          # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   log
+                                       #   notice
+                                       #   warning
+                                       #   error
+
+#log_min_messages = warning            # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic
+
+#log_min_error_statement = error       # values in order of decreasing detail:
+                                       #   debug5
+                                       #   debug4
+                                       #   debug3
+                                       #   debug2
+                                       #   debug1
+                                       #   info
+                                       #   notice
+                                       #   warning
+                                       #   error
+                                       #   log
+                                       #   fatal
+                                       #   panic (effectively off)
+
+#log_min_duration_statement = -1       # -1 is disabled, 0 logs all statements
+                                       # and their durations, > 0 logs only
+                                       # statements running at least this number
+                                       # of milliseconds
+
+
+# - What to Log -
+
+#debug_print_parse = off
+#debug_print_rewritten = off
+#debug_print_plan = off
+#debug_pretty_print = on
+#log_checkpoints = off
+#log_connections = off
+#log_disconnections = off
+#log_duration = off
+#log_error_verbosity = default         # terse, default, or verbose messages
+#log_hostname = off
+log_line_prefix = '%t '                        # special values:
+                                       #   %a = application name
+                                       #   %u = user name
+                                       #   %d = database name
+                                       #   %r = remote host and port
+                                       #   %h = remote host
+                                       #   %p = process ID
+                                       #   %t = timestamp without milliseconds
+                                       #   %m = timestamp with milliseconds
+                                       #   %i = command tag
+                                       #   %e = SQL state
+                                       #   %c = session ID
+                                       #   %l = session line number
+                                       #   %s = session start timestamp
+                                       #   %v = virtual transaction ID
+                                       #   %x = transaction ID (0 if none)
+                                       #   %q = stop here in non-session
+                                       #        processes
+                                       #   %% = '%'
+                                       # e.g. '<%u%%%d> '
+#log_lock_waits = off                  # log lock waits >= deadlock_timeout
+#log_statement = 'none'                        # none, ddl, mod, all
+#log_temp_files = -1                   # log temporary files equal or larger
+                                       # than the specified size in kilobytes;
+                                       # -1 disables, 0 logs all temp files
+#log_timezone = unknown                        # actually, defaults to TZ environment
+                                       # setting
+
+
+#------------------------------------------------------------------------------
+# RUNTIME STATISTICS
+#------------------------------------------------------------------------------
+
+# - Query/Index Statistics Collector -
+
+#track_activities = on
+#track_counts = on
+#track_functions = none                        # none, pl, all
+#track_activity_query_size = 1024      # (change requires restart)
+#update_process_title = on
+#stats_temp_directory = 'pg_stat_tmp'
+
+
+# - Statistics Monitoring -
+
+#log_parser_stats = off
+#log_planner_stats = off
+#log_executor_stats = off
+#log_statement_stats = off
+
+
+#------------------------------------------------------------------------------
+# AUTOVACUUM PARAMETERS
+#------------------------------------------------------------------------------
+
+#autovacuum = on                       # Enable autovacuum subprocess?  'on' 
+                                       # requires track_counts to also be on.
+#log_autovacuum_min_duration = -1      # -1 disables, 0 logs all actions and
+                                       # their durations, > 0 logs only
+                                       # actions running at least this number
+                                       # of milliseconds.
+#autovacuum_max_workers = 3            # max number of autovacuum subprocesses
+                                       # (change requires restart)
+#autovacuum_naptime = 1min             # time between autovacuum runs
+#autovacuum_vacuum_threshold = 50      # min number of row updates before
+                                       # vacuum
+#autovacuum_analyze_threshold = 50     # min number of row updates before 
+                                       # analyze
+#autovacuum_vacuum_scale_factor = 0.2  # fraction of table size before vacuum
+#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
+#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
+                                       # (change requires restart)
+#autovacuum_vacuum_cost_delay = 20ms   # default vacuum cost delay for
+                                       # autovacuum, in milliseconds;
+                                       # -1 means use vacuum_cost_delay
+#autovacuum_vacuum_cost_limit = -1     # default vacuum cost limit for
+                                       # autovacuum, -1 means use
+                                       # vacuum_cost_limit
+
+
+#------------------------------------------------------------------------------
+# CLIENT CONNECTION DEFAULTS
+#------------------------------------------------------------------------------
+
+# - Statement Behavior -
+
+#search_path = '"$user",public'                # schema names
+#default_tablespace = ''               # a tablespace name, '' uses the default
+#temp_tablespaces = ''                 # a list of tablespace names, '' uses
+                                       # only default tablespace
+#check_function_bodies = on
+#default_transaction_isolation = 'read committed'
+#default_transaction_read_only = off
+#session_replication_role = 'origin'
+#statement_timeout = 0                 # in milliseconds, 0 is disabled
+#vacuum_freeze_min_age = 50000000
+#vacuum_freeze_table_age = 150000000
+#bytea_output = 'hex'                  # hex, escape
+#xmlbinary = 'base64'
+#xmloption = 'content'
+
+# - Locale and Formatting -
+
+datestyle = 'iso, mdy'
+#intervalstyle = 'postgres'
+#timezone = unknown                    # actually, defaults to TZ environment
+                                       # setting
+#timezone_abbreviations = 'Default'     # Select the set of available time zone
+                                       # abbreviations.  Currently, there are
+                                       #   Default
+                                       #   Australia
+                                       #   India
+                                       # You can create your own file in
+                                       # share/timezonesets/.
+#extra_float_digits = 0                        # min -15, max 3
+#client_encoding = sql_ascii           # actually, defaults to database
+                                       # encoding
+
+# These settings are initialized by initdb, but they can be changed.
+lc_messages = 'en_US.UTF-8'                    # locale for system error message
+                                       # strings
+lc_monetary = 'en_US.UTF-8'                    # locale for monetary formatting
+lc_numeric = 'en_US.UTF-8'                     # locale for number formatting
+lc_time = 'en_US.UTF-8'                                # locale for time formatting
+
+# default configuration for text search
+default_text_search_config = 'pg_catalog.english'
+
+# - Other Defaults -
+
+#dynamic_library_path = '$libdir'
+#local_preload_libraries = ''
+
+
+#------------------------------------------------------------------------------
+# LOCK MANAGEMENT
+#------------------------------------------------------------------------------
+
+#deadlock_timeout = 1s
+#max_locks_per_transaction = 64                # min 10
+                                       # (change requires restart)
+# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
+# max_locks_per_transaction * (max_connections + max_prepared_transactions)
+# lock table slots.
+
+
+#------------------------------------------------------------------------------
+# VERSION/PLATFORM COMPATIBILITY
+#------------------------------------------------------------------------------
+
+# - Previous PostgreSQL Versions -
+
+#array_nulls = on
+#backslash_quote = safe_encoding       # on, off, or safe_encoding
+#default_with_oids = off
+#escape_string_warning = on
+#lo_compat_privileges = off
+#sql_inheritance = on
+#standard_conforming_strings = off
+#synchronize_seqscans = on
+
+# - Other Platforms and Clients -
+
+#transform_null_equals = off
+
+
+#------------------------------------------------------------------------------
+# CUSTOMIZED OPTIONS
+#------------------------------------------------------------------------------
+
+#custom_variable_classes = ''          # list of custom variable class names
diff --git a/templates/db/snapshot.sh b/templates/db/snapshot.sh
new file mode 100755 (executable)
index 0000000..a2ecb0c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+mv /var/backup/$HOSTNAME/snapshot/* /var/backup/snapshot/
+rsync -vaHx /var/backup/db07/wal/ /mnt/backup/db07/wal/
+rsync -vaHx /var/backup/snapshot/ /mnt/backup/db07/snapshot/
diff --git a/templates/debconf-settings b/templates/debconf-settings
new file mode 100755 (executable)
index 0000000..54f0f9a
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/debconf-set-selections
+
+
+opensrf opensrf/fqdn string HOSTNAME.OPENSRF_FQDN
+opensrf opensrf/user_password password OPENSRF_USER_PASSWORD
+opensrf opensrf/verify_user_password password OPENSRF_USER_PASSWORD
+opensrf opensrf/ejabber_password password OPENSRF_USER_PASSWORD
+opensrf opensrf/verify_ejabber_password password OPENSRF_USER_PASSWORD
+evergreen-ils evergreen-ils/eg_db_password password EVERGREEN-ILS_DB_PASSWORD
+evergreen-ils evergreen-ils/verify_eg_db_password password EVERGREEN-ILS_DB_PASSWORD
+evergreen-ils evergreen-ils/evergreen_admin_user string admin EVERGREEN-ILS_ADMIN_USER
+evergreen-ils evergreen-ils/evergreen_admin_password password EVERGREEN-ILS_ADMIN_PASSWORD
+evergreen-ils evergreen-ils/verify_evergreen_admin_password password EVERGREEN-ILS_ADMIN_PASSWORD
diff --git a/templates/debs/evergreen-ils_2.1.1_amd64.deb b/templates/debs/evergreen-ils_2.1.1_amd64.deb
new file mode 100644 (file)
index 0000000..2ab7043
Binary files /dev/null and b/templates/debs/evergreen-ils_2.1.1_amd64.deb differ
diff --git a/templates/debs/libdbi-drivers_0.8.3_amd64.deb b/templates/debs/libdbi-drivers_0.8.3_amd64.deb
new file mode 100644 (file)
index 0000000..4f9ee28
Binary files /dev/null and b/templates/debs/libdbi-drivers_0.8.3_amd64.deb differ
diff --git a/templates/debs/libdbi_0.8.3_amd64.deb b/templates/debs/libdbi_0.8.3_amd64.deb
new file mode 100644 (file)
index 0000000..51082f5
Binary files /dev/null and b/templates/debs/libdbi_0.8.3_amd64.deb differ
diff --git a/templates/debs/opensrf_2.0.1_amd64.deb b/templates/debs/opensrf_2.0.1_amd64.deb
new file mode 100644 (file)
index 0000000..5182b9d
Binary files /dev/null and b/templates/debs/opensrf_2.0.1_amd64.deb differ
diff --git a/templates/debs/spidermonkey-perl_0.20_amd64.deb b/templates/debs/spidermonkey-perl_0.20_amd64.deb
new file mode 100644 (file)
index 0000000..e66f138
Binary files /dev/null and b/templates/debs/spidermonkey-perl_0.20_amd64.deb differ
diff --git a/templates/debs/spidermonkey_1.7.0_amd64.deb b/templates/debs/spidermonkey_1.7.0_amd64.deb
new file mode 100644 (file)
index 0000000..0a61352
Binary files /dev/null and b/templates/debs/spidermonkey_1.7.0_amd64.deb differ
diff --git a/templates/eg-logger-root.crontab b/templates/eg-logger-root.crontab
new file mode 100644 (file)
index 0000000..f5369e9
--- /dev/null
@@ -0,0 +1,14 @@
+# m h  dom mon dow   command
+0 0,6,12,18 * * * /usr/sbin/ntpdate pool.ntp.org
+
+# Archive the files from 3 days ago
+30 0 * * * /root/stats/archive.sh 1
+
+# Bye logs older than 6mo old! (except the access logs... they are kept ;))
+#45 1 * * * find /var/log/evergreen -not -name activity.* -not -name ap_access.* -type f -ctime +180 -exec rm {} \;
+
+MAILTO=pines-tech@list.georgialibraries.org
+30 6 * * * /root/processing_count.sh circ
+31 6 * * * /root/processing_count.sh hold
+
+# 0 * * * * /etc/init.d/syslog-ng restart # why did the do this?
diff --git a/templates/eg_fstab_drone b/templates/eg_fstab_drone
new file mode 100644 (file)
index 0000000..99017de
--- /dev/null
@@ -0,0 +1,3 @@
+## NFS Mounts for Evergreen.
+HEAD_IP:/openils      /openils        nfs     ro,auto 0       0
+UTILITY01_IP:/openils/var/data/offline /openils/var/data/offline/ nfs rw 0 0
diff --git a/templates/eg_fstab_head b/templates/eg_fstab_head
new file mode 100644 (file)
index 0000000..1147224
--- /dev/null
@@ -0,0 +1,3 @@
+## NFS Mounts for Evergreen.
+UTILITY01_IP:/openils/var/data/offline /openils/var/data/offline/ nfs rw 0 0
+REPORTER_OUTPUT_NFS_HOST_IP:/storage/reports-output /openils/var/web/reporter/ nfs rw 0 0
diff --git a/templates/etc_profile b/templates/etc_profile
new file mode 100644 (file)
index 0000000..2d19fda
--- /dev/null
@@ -0,0 +1,7 @@
+# Customizations For Evergreen
+export PERL5LIB=/openils/lib/perl5:$PERL5LIB
+export PATH=/openils/bin:$PATH
+export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH
+export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]% \[\033[00m\]'
+export EDITOR="vim"
+alias ls="ls --color=auto"
diff --git a/templates/exports b/templates/exports
new file mode 100644 (file)
index 0000000..b2daa81
--- /dev/null
@@ -0,0 +1 @@
+### HEAD NFS EXPORTS FILE ###
diff --git a/templates/hosts-footer b/templates/hosts-footer
new file mode 100644 (file)
index 0000000..eddf477
--- /dev/null
@@ -0,0 +1,22 @@
+Priv_NET.101   db01.sampledomain.org db01
+Priv_NET.102   db02.sampledomain.org db02
+Priv_NET.103   db03.sampledomain.org db03
+Priv_NET.111   utility01.sampledomain.org public.utility01.sampledomain.org private.utility01.sampledomain.org utility01
+Priv_NET.121   logger01.sampledomain.org logger01
+Priv_NET.131   sip01.sampledomain.org public.sip01.sampledomain.org private.sip01.sampledomain.org sip01 
+Priv_NET.132   sip02.sampledomain.org public.sip02.sampledomain.org private.sip02.sampledomain.org sip02
+Priv_NET.141   reporter01.sampledomain.org reporter01
+Priv_NET.151   memcache01.sampledomain.org memcache01
+Priv_NET.152   memcache02.sampledomain.org memcache02
+Priv_NET.171   backup01.sampledomain.org backup01
+Priv_NET.201   monitor01.sampledomain.org monitor01
+Priv_NET.211   admin01.sampledomain.org admin01
+
+# The following lines are desirable for IPv6 capable hosts
+::1     localhost ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts
+
diff --git a/templates/hosts-header b/templates/hosts-header
new file mode 100644 (file)
index 0000000..2f53817
--- /dev/null
@@ -0,0 +1,3 @@
+127.0.0.1       localhost
+127.0.1.1       thishost.sampledomain.org       thishost
+#OPENSRF_DEB Addresses
diff --git a/templates/init/eg_database b/templates/init/eg_database
new file mode 100755 (executable)
index 0000000..b600d34
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          eg_postgresql
+# Required-Start:    $local_fs $remote_fs $network $syslog 
+# Required-Stop:     $local_fs $remote_fs $network $syslog 
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# X-Interactive:     true
+# Short-Description: Start/stop OpenSRF Services
+### END INIT INFO
+. /lib/lsb/init-functions
+
+OPENILS_BASE="/openils"
+OPENILS_CORE="${OPENILS_BASE}/conf/opensrf_core.xml"
+SRU_LOG="${OPENILS_BASE}/var/log/sru.log"
+
+PIDFILES="${OPENILS_BASE}/var/run"
+SIP_CONF="${OPENILS_BASE}/conf/oils_sip.xml"
+
+REP_LOCK="${OPENILS_BASE}/var/lock/reporter-LOCK"
+REP_NAME="Clark Kent, waiting for trouble"
+
+sru_name='simple2zoom'
+
+export PATH=$PATH:${OPENILS_BASE}/bin
+
+if [ $(whoami) != 'opensrf' ]; then
+ PERL5LIB='/openils/lib/perl5:$PERL5LIB';
+fi;
+
+start_database() {
+        sleep 1
+       log_daemon_msg "Starting Evergreen Database"
+       /etc/init.d/postgresql start
+       sleep 2
+       log_daemon_msg "Restarting Evergreen OpenSRF:"
+       for HEAD in $(cat /etc/hosts | grep head | awk '{ print $NF }')
+               do
+               echo "Stopping OpenSRF on $HEAD"
+               su - opensrf -c "ssh $HEAD /openils/bin/osrf_ctl.sh -a stop_all"
+               echo "Starting OpenSRF on $HEAD"
+               su - opensrf -c "ssh $HEAD /openils/bin/osrf_ctl.sh -a start_all"
+       done
+}
+
+stop_database() {
+       log_daemon_msg "Stopping Evergreen Database"
+       /etc/init.d/postgresql stop
+       #for HEAD in $(cat /etc/hosts | grep head | awk '{ print $NF }')
+        #        do
+        #        echo "Stopping OpenSRF on $HEAD"
+        #        su - opensrf -c "ssh $HEAD /openils/bin/osrf_ctl.sh -a stop_all"
+        #        echo "Starting OpenSRF on $HEAD"
+        #        su - opensrf -c "ssh $HEAD /openils/bin/osrf_ctl.sh -a start_all"
+        #done
+       sleep 3
+}
+
+
+case "$1" in
+    start)
+        start_database
+    ;;
+    stop)
+        stop_database
+    ;;
+    restart)
+       log_daemon_msg "Restarting Evergreen Database:"
+        stop_database
+       sleep 2
+       log_daemon_msg "Restarting Evergreen OpenSRF:"
+        start_database
+    ;;
+*)
+        echo " * Usage: /etc/init.d/eg_opensrf {start|stop|restart}"
+        exit 1
+    ;;
+esac;
+
+
+
+
+#for HEAD in $(cat /etc/hosts | grep head | awk '{ print $NF }')
+#      do
+#      echo $HEAD
+#done
+
+#su - opensrf -c "ssh  brick01-head /openils/bin/osrf_ctl.sh -a start_all"
+
+#su - opensrf -c "ssh  brick01-head /openils/bin/osrf_ctl.sh -a stop_all"
diff --git a/templates/init/eg_opensrf b/templates/init/eg_opensrf
new file mode 100755 (executable)
index 0000000..3cb8f5c
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          opensrf
+# Required-Start:    $local_fs $remote_fs $network $syslog apache2
+# Required-Stop:     $local_fs $remote_fs $network $syslog 
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# X-Interactive:     true
+# Short-Description: Start/stop OpenSRF Services
+### END INIT INFO
+. /lib/lsb/init-functions
+
+OPENILS_BASE="/openils"
+OPENILS_CORE="${OPENILS_BASE}/conf/opensrf_core.xml"
+SRU_LOG="${OPENILS_BASE}/var/log/sru.log"
+
+PIDFILES="${OPENILS_BASE}/var/run"
+SIP_CONF="${OPENILS_BASE}/conf/oils_sip.xml"
+
+REP_LOCK="${OPENILS_BASE}/var/lock/reporter-LOCK"
+REP_NAME="Clark Kent, waiting for trouble"
+
+sru_name='simple2zoom'
+
+export PATH=$PATH:${OPENILS_BASE}/bin
+
+if [ $(whoami) != 'opensrf' ]; then
+ PERL5LIB='/openils/lib/perl5:$PERL5LIB';
+fi;
+
+start_opensrf() {
+        sleep 3
+       log_daemon_msg "Starting Evergreen OpenSRF:"
+       su - opensrf -c /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin osrf_ctl.sh  -a start_all"
+}
+
+stop_opensrf() {
+       log_daemon_msg "Stopping Evergreen OpenSRF:"
+       su - opensrf -c /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin osrf_ctl.sh  -a stop_all"
+       sleep 3
+       rm $PIDFILES/*.pid
+}
+
+autogen() {
+        echo "Running Autogen Update"
+        sudo -u opensrf /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin autogen.sh -u -c ${OPENILS_CORE}"
+}
+
+
+case "$1" in
+    start)
+        start_opensrf
+    ;;
+    stop)
+        stop_opensrf
+    ;;
+    restart)
+       log_daemon_msg "Restarting Evergreen OpenSRF:"
+        stop_opensrf
+       sleep 2
+        start_opensrf
+    ;;
+    autogen)
+        autogen
+    ;;
+*)
+        echo " * Usage: /etc/init.d/eg_opensrf {start|stop|restart|autogen}"
+        exit 1
+    ;;
+esac;
diff --git a/templates/interfaces b/templates/interfaces
new file mode 100644 (file)
index 0000000..9382b7c
--- /dev/null
@@ -0,0 +1,14 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet static
+       address Priv_IP
+       netmask 255.255.255.0
+       gateway Priv_NET.1
+       # dns-* options are implemented by the resolvconf package, if installed
diff --git a/templates/lvs/apt.list b/templates/lvs/apt.list
new file mode 100644 (file)
index 0000000..dc37c5a
--- /dev/null
@@ -0,0 +1 @@
+ntp
diff --git a/templates/lvs/authkeys b/templates/lvs/authkeys
new file mode 100644 (file)
index 0000000..a564ef4
--- /dev/null
@@ -0,0 +1,26 @@
+#
+#      Authentication file.  Must be mode 600
+#
+#
+#      Must have exactly one auth directive at the front.
+#      auth    send authentication using this method-id
+#
+#      Then, list the method and key that go with that method-id
+#
+#      Available methods: crc sha1, md5.  Crc doesn't need/want a key.
+#
+#      You normally only have one authentication method-id listed in this file
+#
+#      Put more than one to make a smooth transition when changing auth
+#      methods and/or keys.
+#
+#
+#      sha1 is believed to be the "best", md5 next best.
+#
+#      crc adds no security, except from packet corruption.
+#              Use only on physically secure networks.
+#
+auth 1
+1 crc
+#2 sha1 HI!
+#3 md5 Hello!
diff --git a/templates/lvs/ha.cf b/templates/lvs/ha.cf
new file mode 100644 (file)
index 0000000..c09b41b
--- /dev/null
@@ -0,0 +1,11 @@
+logfacility     local0
+keepalive 1
+deadtime 5
+warntime 2
+initdead 10
+baud 19200
+serial /dev/ttyS1
+auto_failback on
+node    lvs01
+node    lvs02
+
diff --git a/templates/lvs/haresources b/templates/lvs/haresources
new file mode 100644 (file)
index 0000000..7e0a9e8
--- /dev/null
@@ -0,0 +1 @@
+lvs01          IPaddr::ClusterPublic_IP/ClusterPublic_CIDR/eth0/ClusterPublic_Bcast IPaddr::Lvs01Private_Shared_IP/24/eth1/lvs01Private_Net.255
diff --git a/templates/lvs/interfaces b/templates/lvs/interfaces
new file mode 100644 (file)
index 0000000..b3544aa
--- /dev/null
@@ -0,0 +1,36 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet static
+       name Public Address
+       address Pub_IP
+       netmask Pub_NETMASK
+       gateway Pub_GATEWAY
+       # dns-* options are implemented by the resolvconf package, if installed
+       
+#auto eth0:0
+iface eth0:0 inet static
+       name LVS Public Shared Address
+       address Cluster_Public_IP
+       netmask Pub_NETMASK
+
+
+
+auto eth1
+iface eth1 inet static
+       name Private Address
+       address Priv_Physical_Address
+       netmask 255.255.255.0
+
+#auto eth1:0
+iface eth1:0 inet static
+        name LVS Private Shared Address
+        address Priv_NET.1
+        netmask 255.255.255.0
+
diff --git a/templates/lvs/iptables-rules.fw b/templates/lvs/iptables-rules.fw
new file mode 100755 (executable)
index 0000000..ebaf121
--- /dev/null
@@ -0,0 +1,122 @@
+#!/bin/bash
+
+## This allows all machines on the private net to get
+## Out to the internet through lvs01
+
+############### General Configration ###############
+## to add more rules see rules section below.
+
+### What is the external interface? eg. eth0
+EXTERNAL_IF="eth0"
+
+### What is the internal interface? eg eth1, eth0:1
+INTERNAL_IF="eth1"
+
+### What is the private network address? eg. Priv_NET.0/24
+PRIVATE_NET="Priv_NET.0/24"
+
+### Log deny packets? YES | NO 
+LOGDENY="YES"
+
+### Block Pings? YES | NO
+BLOCKPINGS="NO"
+
+############# End General Configration ############
+
+## Setup IP Forwarding
+echo "1" > /proc/sys/net/ipv4/ip_forward
+
+
+IPT="/sbin/iptables"
+
+### set firewall mode 
+if echo "$1" | grep -q nolog || [ $LOGDENY = "NO" ]
+       then
+       FW="firewall-nolog"
+               else
+               FW="firewall"
+fi
+
+
+### Flush old rules, delete the firewall chain if it exists
+$IPT -F
+$IPT -F -t nat
+$IPT -X firewall
+$IPT -X firewall-nolog
+
+
+### Setup Default Firewall Chain.  Logs all dropped packets.
+$IPT -N firewall
+$IPT -A firewall -j LOG --log-level info --log-prefix "Firewall-DENY:"
+$IPT -A firewall -j DROP
+
+### Setup Firewall Chain Without Logging.
+$IPT -N firewall-nolog
+$IPT -A firewall-nolog -j DROP
+
+
+### Accept Private network
+$IPT -A INPUT -s "$PRIVATE_NET" -d 0/0 -j ACCEPT
+
+
+######## Port Forwarding ##########
+
+### Nat incoming connections for Evergreen SIP service.
+iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 6001 -j DNAT --to-destination Priv_NET.131-Priv_NET.132:6001
+
+
+####### End Port Forwarding #######
+
+
+### Allow Prvate network to go anywhere
+$IPT -A POSTROUTING -t nat -s "$PRIVATE_NET" -j MASQUERADE
+
+### Accept ourselves Localhost.
+$IPT -A INPUT -s 127.0.0.1/8 -d 127.0.0.1/8 -j ACCEPT
+
+### Set forwarding policy
+$IPT -P FORWARD ACCEPT
+
+### Accept incoming packets related to outgoing packets
+$IPT -A INPUT -p tcp -m state --state RELATED -j ACCEPT
+
+### Accept UDP broadcast packets for public net
+$IPT -A INPUT -p udp -d Pub_BCAST -j ACCEPT
+$IPT -A INPUT -p udp -d 255.255.255.255 -j ACCEPT
+
+### Setup fw mark for lvs
+$IPT -t mangle -A PREROUTING -i $EXTERNAL_IF -p tcp -s 0.0.0.0/0 -d "$PRIVATE_NET" --dport http -j MARK --set-mark 1
+$IPT -t mangle -A PREROUTING -i $EXTERNAL_IF -p tcp -s 0.0.0.0/0 -d "$PRIVATE_NET" --dport https -j MARK --set-mark 1
+
+######### RULES ##########
+
+### Accept DNS, and identd
+$IPT -A INPUT -p udp --source-port 53 -j ACCEPT
+$IPT -A INPUT -p tcp --source-port 113 -j ACCEPT
+$IPT -A INPUT -p tcp --destination-port 113 -j ACCEPT
+
+### Accept HTTP
+$IPT -A INPUT -p tcp --destination-port 80 -j ACCEPT
+
+### Accept HTTPS
+$IPT -A INPUT -p tcp --destination-port 443 -j ACCEPT
+
+### Accept NTP
+$IPT -A INPUT -p udp --source-port 123 -j ACCEPT
+
+### Accept SSH
+$IPT -A INPUT -p tcp --destination-port 22 -j ACCEPT
+# $IPT -A INPUT -p tcp --destination-port 3399 -j ACCEPT #- non standard ssh port
+
+######### END RULES #######
+
+
+### Send specific packets to firewall without logging.
+
+
+### Send everything else on the external interface to the firewall.
+[ "$BLOCKPINGS" = "YES"  ] && $IPT -A INPUT -p icmp -i $EXTERNAL_IF -j $FW 
+$IPT -A INPUT -p tcp --syn -i $EXTERNAL_IF -j $FW
+$IPT -A INPUT -p udp -i $EXTERNAL_IF -j $FW
+
+
diff --git a/templates/lvs/ldirectord.cf b/templates/lvs/ldirectord.cf
new file mode 100644 (file)
index 0000000..5405749
--- /dev/null
@@ -0,0 +1,8 @@
+virtual=168.28.68.57:http
+       real=10.0.1.11:http masq
+       real=10.0.1.21:http masq
+       service=http
+       request="ldirectorping.txt"
+       receive="pong"
+       scheduler=wlc
+
diff --git a/templates/lvs/ldirectord.cf-footer b/templates/lvs/ldirectord.cf-footer
new file mode 100644 (file)
index 0000000..1c4414e
--- /dev/null
@@ -0,0 +1,5 @@
+       fallback=Priv_NET.131:80 masq
+       service=http
+       request="ldirectorping.txt"
+       receive="pong"
+       scheduler=wlc
diff --git a/templates/lvs/main.cf b/templates/lvs/main.cf
new file mode 100644 (file)
index 0000000..efb3298
--- /dev/null
@@ -0,0 +1,40 @@
+# See /usr/share/postfix/main.cf.dist for a commented, more complete version
+
+
+# Debian specific:  Specifying a file name will cause the first
+# line of that file to be used as the name.  The Debian default
+# is /etc/mailname.
+#myorigin = /etc/mailname
+
+smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
+biff = no
+
+# appending .domain is the MUA's job.
+append_dot_mydomain = no
+
+# Uncomment the next line to generate "delayed mail" warnings
+#delay_warning_time = 4h
+
+readme_directory = no
+
+# TLS parameters
+smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
+smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
+smtpd_use_tls=yes
+smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
+smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
+
+# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
+# information on enabling SSL in the smtp client.
+
+myhostname = lvs01.ClusterDomainName
+alias_maps = hash:/etc/aliases
+alias_database = hash:/etc/aliases
+myorigin = /etc/mailname
+mydestination = lvs01.ClusterDomainName, localhost.ClusterDomainName, , localhost
+relayhost = 
+mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 Priv_NET.0/24
+mailbox_command = procmail -a "$EXTENSION"
+mailbox_size_limit = 0
+recipient_delimiter = +
+inet_interfaces = all
diff --git a/templates/lvs/ntp.conf b/templates/lvs/ntp.conf
new file mode 100644 (file)
index 0000000..39529f5
--- /dev/null
@@ -0,0 +1,55 @@
+# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
+
+driftfile /var/lib/ntp/ntp.drift
+
+
+# Enable this if you want statistics to be logged.
+#statsdir /var/log/ntpstats/
+
+statistics loopstats peerstats clockstats
+filegen loopstats file loopstats type day enable
+filegen peerstats file peerstats type day enable
+filegen clockstats file clockstats type day enable
+
+
+# You do need to talk to an NTP server or two (or three).
+#server ntp.your-provider.example
+
+# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
+# pick a different set every time it starts up.  Please consider joining the
+# pool: <http://www.pool.ntp.org/join.html>
+server 0.debian.pool.ntp.org iburst dynamic
+server 1.debian.pool.ntp.org iburst dynamic
+server 2.debian.pool.ntp.org iburst dynamic
+server 3.debian.pool.ntp.org iburst dynamic
+
+
+# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
+# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
+# might also be helpful.
+#
+# Note that "restrict" applies to both servers and clients, so a configuration
+# that might be intended to block requests from certain clients could also end
+# up blocking replies from your own upstream servers.
+
+# By default, exchange time with everybody, but don't allow configuration.
+restrict -4 default kod notrap nomodify nopeer noquery
+restrict -6 default kod notrap nomodify nopeer noquery
+
+# Local users may interrogate the ntp server more closely.
+restrict 127.0.0.1
+restrict ::1
+
+# Clients from this (example!) subnet have unlimited access, but only if
+# cryptographically authenticated.
+#restrict 192.168.123.0 mask 255.255.255.0 notrust
+
+
+# If you want to provide time to your local subnet, change the next line.
+# (Again, the address is an example only.)
+#broadcast 192.168.123.255
+
+# If you want to listen to time broadcasts on your local subnet, de-comment the
+# next lines.  Please do this only if you trust everybody on the network!
+#disable auth
+#broadcastclient
diff --git a/templates/lvs/rc.local b/templates/lvs/rc.local
new file mode 100755 (executable)
index 0000000..c22b5c4
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+#
+# rc.local
+#
+# This script is executed at the end of each multiuser runlevel.
+# Make sure that the script will "exit 0" on success or any other
+# value on error.
+#
+# In order to enable or disable this script just change the execution
+# bits.
+#
+# By default this script does nothing.
+/etc/network/iptables-rules.fw
+
+exit 0
diff --git a/templates/lvs/resolv.conf b/templates/lvs/resolv.conf
new file mode 100644 (file)
index 0000000..5c27567
--- /dev/null
@@ -0,0 +1,4 @@
+search CLUSTER_DOMAIN_NAME
+domain CLUSTER_DOMAIN_NAME
+nameserver 127.0.0.1
+
diff --git a/templates/ntp.conf b/templates/ntp.conf
new file mode 100644 (file)
index 0000000..877e74c
--- /dev/null
@@ -0,0 +1,57 @@
+# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
+
+driftfile /var/lib/ntp/ntp.drift
+
+
+# Enable this if you want statistics to be logged.
+#statsdir /var/log/ntpstats/
+
+statistics loopstats peerstats clockstats
+filegen loopstats file loopstats type day enable
+filegen peerstats file peerstats type day enable
+filegen clockstats file clockstats type day enable
+
+
+# You do need to talk to an NTP server or two (or three).
+#server ntp.your-provider.example
+
+# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
+# pick a different set every time it starts up.  Please consider joining the
+# pool: <http://www.pool.ntp.org/join.html>
+server Cluster_Priv_IP
+server LVS01_Priv_IP
+server LVS02_Priv_IP
+
+
+
+
+
+# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
+# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
+# might also be helpful.
+#
+# Note that "restrict" applies to both servers and clients, so a configuration
+# that might be intended to block requests from certain clients could also end
+# up blocking replies from your own upstream servers.
+
+# By default, exchange time with everybody, but don't allow configuration.
+restrict -4 default kod notrap nomodify nopeer noquery
+restrict -6 default kod notrap nomodify nopeer noquery
+
+# Local users may interrogate the ntp server more closely.
+restrict 127.0.0.1
+restrict ::1
+
+# Clients from this (example!) subnet have unlimited access, but only if
+# cryptographically authenticated.
+#restrict 192.168.123.0 mask 255.255.255.0 notrust
+
+
+# If you want to provide time to your local subnet, change the next line.
+# (Again, the address is an example only.)
+#broadcast 192.168.123.255
+
+# If you want to listen to time broadcasts on your local subnet, de-comment the
+# next lines.  Please do this only if you trust everybody on the network!
+#disable auth
+#broadcastclient
diff --git a/templates/oils_brick.cfg-footer b/templates/oils_brick.cfg-footer
new file mode 100644 (file)
index 0000000..8f1cc64
--- /dev/null
@@ -0,0 +1,12 @@
+# if you use ldirector (or similar), this is the ping file
+export LDIRECTOR_FILE="/$PREFIX/var/web/ldirectorping.txt"
+# ILS sources directory
+export OILS_SRC_DIR=/home/opensrf/current
+# OpenSRF sources directory
+export OSRF_SRC_DIR=/home/opensrf/OpenSRF-1.6.3
+# XUL install prefix
+export XUL_BASE="/$PREFIX/var/web/xul"
+# OpenSRF bootstrap config
+export OSRF_CONFIG="/$PREFIX/conf/opensrf_core.xml"
+# ILS PID directory
+export OSRF_PID_DIR=/var/run/evergreen
diff --git a/templates/oils_brick.cfg-header b/templates/oils_brick.cfg-header
new file mode 100644 (file)
index 0000000..06143d9
--- /dev/null
@@ -0,0 +1,5 @@
+# install prefix
+export PREFIX=/openils
+# this is the lead machine
+export MASTER="Priv_IP"
+# array of drone machines
diff --git a/templates/oils_web.xml b/templates/oils_web.xml
new file mode 100644 (file)
index 0000000..60f1573
--- /dev/null
@@ -0,0 +1,42 @@
+<oils_web>
+
+    <!-- This should match the Apache Directory/Location[Match] configuration path -->
+    <base_path>/eg</base_path>
+
+    <web_dir>/openils/var/web</web_dir>
+
+    <!-- when locating files that don't have explicit handlers defined, assume the
+        files have the following filename extension -->
+    <default_template_extension>tt2</default_template_extension>
+
+    <!-- media_prefix can be a remote server.  
+         E.g. <media_prefix>http://static.example.com/media</media_prefix> -->
+    <media_prefix/>
+
+    <!-- If set to true, all output will be parsed as XML before delivery to the client.  
+        If XML parsing fails, the error message, with HTML included, will be output as text/plain.
+        XML parsing adds overhead, so this should only be used for debugging -->
+    <force_valid_xml>false</force_valid_xml>
+
+    <!-- Where templates can be found.  Paths will be checked in the order entered here.
+         It's possible to override individual or sets of templates by putting them into
+         a path in front of the default template path -->
+    <template_paths>
+        <!-- XXX we should really move these out of the default web root -->
+        <path>/openils/var/web/templates</path>
+    </template_paths>
+
+    <handlers>
+        <!-- add custom handlers here.  These are for templates that live in non-obvious locations.  
+            In other words, if the path + default extension does not map directly to a template file -->
+        <handler path='acq/fund/list' template='acq/financial/list_funds.tt2'/>
+        <handler path='acq/fund/view' template='acq/financial/view_fund.tt2'/>
+        <handler path='acq/funding_source/list' template='acq/financial/list_funding_sources.tt2'/>
+        <handler path='acq/funding_source/view' template='acq/financial/view_funding_source.tt2'/>
+        <handler path='acq/currency_type/list' template='acq/financial/list_currency_types.tt2'/>
+        <handler path='acq/currency_type/view' template='acq/financial/view_currency_type.tt2'/>
+        <handler path='acq/provider/list' template='acq/financial/list_providers.tt2'/>
+        <handler path='acq/provider/view' template='acq/financial/view_provider.tt2'/>
+        <handler path='vandelay/vandelay' template='vandelay/vandelay.tt2' as_xml='true'/>
+    </handlers>
+</oils_web>
diff --git a/templates/opensrf-crontab-old b/templates/opensrf-crontab-old
new file mode 100644 (file)
index 0000000..8a8b788
--- /dev/null
@@ -0,0 +1,45 @@
+# m h  dom mon dow   command
+# Run the hold targeter
+0,15,30,45 * * * * . /etc/profile && /openils/bin/hold_targeter.pl /openils/conf/opensrf_core.xml
+
+# Run the reshelving completer
+59 3 * * * . /etc/profile && /openils/bin/reshelving_complete.srfsh
+
+# Run the hold thawer
+5 0 * * * . /etc/profile && /openils/bin/thaw_expired_frozen_holds.srfsh
+
+# Generate fines
+30 0 * * * . /etc/profile && /openils/bin/fine_generator.pl /openils/conf/opensrf_core.xml /tmp/generate_fines-LOCK
+
+# Run the hard due date updater
+#2 3 * * *   . ~/.bashrc && /openils/bin/update_hard_due_dates.srfsh
+
+# Nightly action/trigger passive hook event generator
+0 4 * * * . /etc/profile && cd /openils/bin && /usr/bin/perl ./action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --process-hooks --run-pending
+
+
+# Run pending A/T events.
+15,45 * * * * . /etc/profile && cd /openils/bin && /usr/bin/perl ./action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --run-pending
+## Hourly
+#0 * * * *   . ~/.bashrc && /openils/bin/action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --process-hooks --granularity hourly
+## Daily
+#5 3 * * *   . ~/.bashrc && /openils/bin/action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --process-hooks --granularity daily
+
+
+# Truncate the srfsh.log
+40 23 * * * echo > /openils/var/log/srfsh.log
+
+
+
+### Pines Configs ###
+
+### Run the heavy collections API calls
+#10 3 * * sun . /etc/profile && cd /home/opensrf/scripts && ./run-collections.sh ###PINES ONLY
+
+### generate overdue notices
+#5 5 * * * . /etc/profile && cd /home/opensrf/current/Evergreen/src/support-scripts/ && ./eg_gen_overdue.sh pines2 home.unique-mgmt.com
+#0 3 * * * . /etc/profile && /home/opensrf/scripts/circ_notices.sh ###PINES ONLY
+
+### create the list of blocked patrons for offline use 
+#30 6 * * * cd /home/opensrf/scripts && ./gen_blocked_list.sh ###PINES ONLY
+
diff --git a/templates/opensrf-rsyslog.conf b/templates/opensrf-rsyslog.conf
new file mode 100644 (file)
index 0000000..3f66597
--- /dev/null
@@ -0,0 +1,60 @@
+# OpenSRF rsyslog configuration file
+# Bill Erickson <berick@esilibrary.com>
+#
+# /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-rsyslog.conf-old b/templates/opensrf-rsyslog.conf-old
new file mode 100644 (file)
index 0000000..c19f361
--- /dev/null
@@ -0,0 +1,50 @@
+# OpenSRF rsyslog configuration file
+# Bill Erickson <berick@esilibrary.com>
+#
+# /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_error,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/ap_error.%$HOUR%.log"
+
+# Selectors ----------------
+# local0 : OpenSRF
+# local1 : OpenSRF "activity"
+# local2 : OpenSRF router
+# local3 : PostgreSQL
+# local6 : Gateway
+# local7 : Apache
+
+local0.* ?osrfsys;msgformat
+local1.* ?activity;msgformat
+local2.* ?router;msgformat
+local3.* ?pg;msgformat
+local6.* ?gateway;msgformat
+local7.* ?ap_access;msgformat
+
+# Warn
+local0.warn ?osrfwarn;msgformat
+local1.warn ?osrfwarn;msgformat
+local2.warn ?osrfwarn;msgformat
+local3.warn ?osrfwarn;msgformat
+local6.warn ?osrfwarn;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
+
diff --git a/templates/opensrf.xml/opensrf.xml-drone b/templates/opensrf.xml/opensrf.xml-drone
new file mode 100644 (file)
index 0000000..fb515f5
--- /dev/null
@@ -0,0 +1,30 @@
+
+<NODE_HOST_NAME.ClusterDomainName>
+            <activeapps>
+                <!-- services hosted on this machine -->
+                <appname>opensrf.math</appname>
+                <appname>opensrf.dbmath</appname>
+                <appname>open-ils.acq</appname>
+                <!-- <appname>open-ils.booking</appname> -->
+                <appname>open-ils.cat</appname>
+                <appname>open-ils.supercat</appname>
+                <appname>open-ils.search</appname>
+                <appname>open-ils.circ</appname>
+                <appname>open-ils.actor</appname>
+                <appname>open-ils.auth</appname>
+                <appname>open-ils.storage</appname>
+                <appname>open-ils.penalty</appname>
+                <appname>open-ils.cstore</appname>
+                <appname>open-ils.collections</appname>
+                <appname>open-ils.ingest</appname>
+                <appname>open-ils.reporter</appname>
+                <appname>open-ils.reporter-store</appname>
+                <!-- <appname>open-ils.resolver</appname> -->
+                <appname>open-ils.permacrud</appname>
+                <appname>open-ils.pcrud</appname>
+                <appname>open-ils.trigger</appname>
+                <appname>open-ils.fielder</appname>
+                <appname>open-ils.vandelay</appname>
+                <appname>open-ils.serial</appname>
+            </activeapps>
+        </NODE_HOST_NAME.ClusterDomainName>
diff --git a/templates/opensrf.xml/opensrf.xml-footer b/templates/opensrf.xml/opensrf.xml-footer
new file mode 100644 (file)
index 0000000..a43156f
--- /dev/null
@@ -0,0 +1,3 @@
+    </hosts>
+
+</opensrf>
diff --git a/templates/opensrf.xml/opensrf.xml-full b/templates/opensrf.xml/opensrf.xml-full
new file mode 100644 (file)
index 0000000..bb94797
--- /dev/null
@@ -0,0 +1,31 @@
+
+<NODE_HOST_NAME.ClusterDomainName>
+            <activeapps>
+                <!-- services hosted on this machine -->
+                <appname>opensrf.settings</appname>
+                <appname>opensrf.math</appname>
+                <appname>opensrf.dbmath</appname>
+                <appname>open-ils.acq</appname>
+                <!-- <appname>open-ils.booking</appname> -->
+                <appname>open-ils.cat</appname>
+                <appname>open-ils.supercat</appname>
+                <appname>open-ils.search</appname>
+                <appname>open-ils.circ</appname>
+                <appname>open-ils.actor</appname>
+                <appname>open-ils.auth</appname>
+                <appname>open-ils.storage</appname>
+                <appname>open-ils.penalty</appname>
+                <appname>open-ils.cstore</appname>
+                <appname>open-ils.collections</appname>
+                <appname>open-ils.ingest</appname>
+                <appname>open-ils.reporter</appname>
+                <appname>open-ils.reporter-store</appname>
+                <!-- <appname>open-ils.resolver</appname> -->
+                <appname>open-ils.permacrud</appname>
+                <appname>open-ils.pcrud</appname>
+                <appname>open-ils.trigger</appname>
+                <appname>open-ils.fielder</appname>
+                <appname>open-ils.vandelay</appname>
+                <appname>open-ils.serial</appname>
+            </activeapps>
+        </NODE_HOST_NAME.ClusterDomainName>
diff --git a/templates/opensrf.xml/opensrf.xml-head b/templates/opensrf.xml/opensrf.xml-head
new file mode 100644 (file)
index 0000000..cc4211c
--- /dev/null
@@ -0,0 +1,7 @@
+<NODE_HOST_NAME.ClusterDomainName>
+            <activeapps>
+                <!-- services hosted on this machine -->
+                <appname>opensrf.settings</appname>
+            </activeapps>
+        </NODE_HOST_NAME.ClusterDomainName>
+
diff --git a/templates/opensrf.xml/opensrf.xml-header b/templates/opensrf.xml/opensrf.xml-header
new file mode 100644 (file)
index 0000000..32aab9f
--- /dev/null
@@ -0,0 +1,1139 @@
+<?xml version="1.0"?>
+<!-- 
+Example opensrf config file for OpenILS
+vim:et:ts=4:sw=4:
+-->
+<opensrf version="0.0.3">
+
+    <default>
+
+        <!-- unless otherwise overidden, use this locale -->
+        <default_locale>en-US</default_locale>
+
+        <dirs>
+            <log>/openils/var/log</log> <!-- unix::server log files -->
+            <sock>/openils/var/lock</sock> <!-- unix::server sock files -->
+            <pid>/openils/var/run</pid>
+            <xsl>/openils/var/xsl</xsl>
+            <script>/openils/var</script>
+            <script_lib>/openils/var</script_lib>
+            <templates>/openils/var/templates</templates>
+        </dirs>
+
+        <!-- global data visibility settings -->
+        <share>
+            <user>
+                <!-- Set to "true" to require patron opt-in for foreign (non-home_ou) transactions -->
+                <opt_in>false</opt_in>
+            </user>
+        </share>
+
+        <IDL>/openils/conf/fm_IDL.xml</IDL> <!-- top level IDL file -->
+        <IDL2js>fm_IDL2js.xsl</IDL2js> <!-- IDL JS XSLT -->
+
+
+        <server_type>prefork</server_type> <!-- net::server type -->
+
+        <ils_events>/openils/var/data/ils_events.xml</ils_events> <!-- ILS events description file -->
+
+        <email_notify> <!-- this will eventually move into the notifications section below... -->
+            <!-- global email notification settings -->
+            <template>/openils/var/data/hold_notification_template.example</template>
+            <smtp_server>ClusterDomainName</smtp_server>
+
+            <!--
+            in most cases, this is overridden by location 
+            specific config settings.  this is just the default
+            -->
+            <sender_address>evergreen@ClusterDomainName</sender_address>
+        </email_notify>
+
+
+      <notifications>
+        <!-- global mail server settings -->
+        <smtp_server>ClusterDomainName</smtp_server>
+        <sender_address>evergreen@ClusterDomainName</sender_address>
+
+        <!-- global telephony (asterisk) settings -->
+        <telephony>
+            <!-- replace all values below when telephony server is configured -->
+            <enabled>0</enabled>
+            <driver>SIP</driver>    <!-- SIP (default) or multi -->
+            <channels>              <!-- explicit list of channels used if multi -->
+                                    <!-- A channel specifies technology/resource -->
+                <channel>Zap/1</channel>
+                <channel>Zap/2</channel>
+                <channel>IAX/user:secret@widgets.biz</channel>
+            </channels>
+            <host>localhost</host>
+            <port>10080</port>
+            <user>evergreen</user>
+            <pw>evergreen</pw>
+            <!--
+                The overall composition of callfiles is determined by the
+                relevant template, but this section can be invoked for callfile
+                configs common to all outbound calls.
+                callfile_lines will be inserted into ALL generated callfiles
+                after the Channel line.  This content mat be overridden
+                (in whole) by the org unit setting callfile_lines.
+                Warning: Invalid syntax may break ALL outbound calls.
+            -->
+            <!-- <callfile_lines>
+                MaxRetries: 3
+                RetryTime: 60
+                WaitTime: 30
+                Archive: 1
+                Extension: 10
+            </callfile_lines> -->
+        </telephony>
+
+        <!-- Overdue notices: DEPRECATED in 2.0 in favour of Action/Trigger Notifications -->
+        <overdue>
+
+            <!-- optionally, you can define a sender address per notice type -->
+            <sender_address>overdue@ClusterDomainName</sender_address>
+
+            <!-- The system can generate an XML file of overdue notices.  This is the
+                directory where they are stored.  Files are named overdue.YYYY-MM-DD.xml -->
+            <notice_dir>/openils/var/data/overdue</notice_dir>
+            <combined_template>/openils/var/data/templates/overdue_combined_xml.example</combined_template>
+
+            <notice>
+                <!-- Notify at 7 days overdue -->
+                <notify_interval>7 days</notify_interval>
+                <!-- Options include always, noemail, and never.  'noemail' means a notice
+                     will be appended to the notice file only if the patron has no valid email address.  -->
+                <file_append>noemail</file_append>
+                <!-- do we attempt email notification? -->
+                <email_notify>false</email_notify>
+                <!-- notice template file -->
+                <email_template>/openils/var/data/templates/overdue_7day.example</email_template>
+            </notice>
+        </overdue>
+
+        <!-- Courtesy notices: DEPRECATED in 2.0 in favour of Action/Trigger Notifications -->
+        <predue>
+            <notice>
+                <!-- All circulations that circulate between 5 and 13 days -->
+                <circ_duration_range>
+                    <from>5 days</from>
+                    <to>13 days</to>
+                </circ_duration_range>
+                <!-- notify at 1 day before the due date -->
+                <notify_interval>1 day</notify_interval>
+                <file_append>false</file_append>
+                <email_notify>false</email_notify>
+                <email_template>/openils/var/data/templates/predue_1day.example</email_template>
+            </notice>
+        </predue>
+      </notifications>
+
+        <!-- Settings for the hold targeter cron job -->
+        <hold_targeter>
+            <!-- number of parallel processes to use during hold targeting;
+                 increasing can speed up (re)targeting a large number of
+                 hold requests, but with diminishing returns after a point;
+                 if increasing this value, it is recommend to do so slowly
+            -->
+            <parallel>4</parallel>
+        </hold_targeter>
+
+        <!-- Settings for the fine generator cron job -->
+        <fine_generator>
+            <!-- number of parallel processes to use during fine generation -->
+            <parallel>4</parallel>
+        </fine_generator>
+        
+        <reporter>
+            <!--
+            Settings for the reporter daemon process 
+            -->
+            <setup>
+                <base_uri>https://ClusterDomainName/reporter/</base_uri>
+                <database>
+                    <driver>Pg</driver>
+                    <host>db03.ClusterDomainName</host>
+                    <port>5432</port>
+                    <db>evergreen</db>
+                    <user>evergreen</user>
+                    <pw>DatabasePassword</pw>
+                </database>
+                <state_store>
+                    <driver>Pg</driver>
+                    <host>db01.ClusterDomainName</host>
+                    <port>5432</port>
+                    <db>evergreen</db>
+                    <user>evergreen</user>
+                    <pw>DatabasePassword</pw>
+                </state_store>
+                <files>
+                    <!-- successful report outputs go here -->
+                    <output_base>/openils/var/web/reporter</output_base>
+                    <success_template>/openils/var/data/report-success</success_template>
+                    <fail_template>/openils/var/data/report-fail</fail_template>
+                </files>
+            </setup>
+        </reporter>
+
+
+
+        <xml-rpc>
+            <!-- XML-RPC gateway.  Do NOT publish unprotected services here -->
+            <allowed_services>
+                <!-- list of published services -->
+                <service>opensrf.math</service>
+                <service>opensrf.dbmath</service>
+                <service>open-ils.cat</service>
+                <service>open-ils.search</service>
+                <service>open-ils.circ</service>
+                <service>open-ils.actor</service>
+                <service>open-ils.auth</service>
+                <service>open-ils.collections</service>
+            </allowed_services>
+        </xml-rpc>
+
+
+        <z3950>
+            <default>oclc</default>
+            <services>
+                
+               <oclc>
+                    <!-- Z3950 settings for OCLC.  Note that OCLC requires username/password -->
+                    <host>zcat.oclc.org</host>
+                    <port>210</port>
+                    <db>OLUCWorldCat</db>
+                    <attrs>
+                        <!--
+                        These are directly from the Bib-1 Attribute Set
+                        http://www.loc.gov/z3950/agency/defns/bib1.html
+                        <code> is the "use attribute", <format> is the "structure attribute"
+                        This just puts some friendly names on the data.
+                        -->
+                        <tcn><code>12</code><format>1</format></tcn>
+                        <isbn><code>7</code><format>6</format></isbn>
+                        <lccn><code>9</code><format>1</format></lccn>
+                        <author><code>1003</code><format>6</format></author>
+                        <title><code>4</code><format>6</format></title>
+                        <issn><code>8</code><format>1</format></issn>
+                        <publisher><code>1018</code><format>6</format></publisher>
+                        <pubdate><code>31</code><format>1</format></pubdate>
+                        <item_type><code>1001</code><format>1</format></item_type>
+                    </attrs>
+                </oclc>
+
+            </services>
+        </z3950>
+
+
+        <added_content>
+            <!-- load the OpenLibrary added content module -->
+            <module>OpenILS::WWW::AddedContent::Syndetic</module>
+           <base_url>http://syndetics.com/index.aspx</base_url>
+            <!--
+            Max number of seconds to wait for an added content request to 
+            return data.  Data not returned within the timeout is considered
+            a failure.
+
+            Note that the pool of Apache processes used by the AddedContent
+            module is the same pool used by core Evergreen processes such as
+            search, circulation, etc. Therefore, the higher you set this
+            timeout value, the more likely you are to run out of available
+            Apache processes resulting in an accidental (or purposeful) denial
+            of service - particularly if the added content server starts
+            responding abnormally slowly.
+
+            The safest option is to disable the AddedContent module completely,
+            but 3 seconds is a compromise between the threat of a denial of
+            service and the enhanced user experience offered by successful added
+            content requests.
+            -->
+            <timeout>1</timeout>
+
+            <!--
+            After added content lookups have been disabled due to too many
+            lookup failures, this is the amount of time to wait before
+            we try again
+            -->
+            <retry_timeout>600</retry_timeout>
+
+            <!--
+            maximum number of consecutive lookup errors a given process can 
+            have before added content lookups are disabled for everyone
+            -->
+            <max_errors>15</max_errors>
+
+            <!-- If a userid is required to access the added content.. -->
+            <userid>evertest</userid>
+
+            <!--
+            Base URL for Amazon added content fetching. Not needed by OpenLibrary
+            <base_url>http://images.amazon.com/images/P/</base_url>
+            -->
+
+            <!--
+            Segregating the details for ContentCafe out for easier use.  At some point, we
+            may want to support multiple services at one time.
+            -->
+            <!-- <ContentCafe>
+                <userid>MY_USER_ID</userid>
+                <password>MY_PASSWORD</password> -->
+
+                <!--
+                If no cover/jacket image exists for a given ISBN, then a value of T here will
+                return an 80x120 pixel image containing the text "No Image Available".  A
+                value of 1 will return a 1x1 pixel image.
+                -->
+                <!-- <return_behavior_on_no_jacket_image>T</return_behavior_on_no_jacket_image>
+            </ContentCafe> -->
+
+            <!--
+            You can add free-form settings here and they will be accessible
+            within the added content module
+            -->
+
+        </added_content>
+
+        <!-- no apps are enabled globally by default -->
+        <activeapps/> 
+
+        <cache>
+            <!-- memcache servers -->
+            <global>
+                <servers>
+                    <server>memcache01_IP:11211</server>
+                   <server>memcache02_IP:11211</server>
+                </servers>
+                <max_cache_time>86400</max_cache_time>
+            </global>
+            <anon>
+                <!-- anonymous cache.  currently, primarily used for web session caching -->
+                <servers>
+                    <server>memcache01_IP:11211</server>
+                   <server>memcache02_IP:11211</server>
+                </servers>
+                <max_cache_time>1800</max_cache_time>
+                <!-- maximum size of a single cache entry / default = 100k-->
+                <max_cache_size>102400</max_cache_size>
+            </anon>
+        </cache>
+
+        <apps>
+            <!-- Acquisitions server -->
+            <open-ils.acq>
+                <!-- how long to wait between stateful requests before the child process re-joins the pool -->
+                <keepalive>5</keepalive>
+                <!-- true if this service support stateless requests -->
+                <stateless>1</stateless>
+                <!-- implementation language -->
+                <language>perl</language>
+                <!-- name of the library that implements this application -->
+                <implementation>OpenILS::Application::Acq</implementation>
+                <!-- maximum OpenSRF REQUEST within a stateful connection -->
+                <max_requests>100</max_requests>
+                <unix_config>
+                    <!--
+                    maximum number of top level requests coming to 
+                    this child before the child is recycled
+                    -->
+                    <max_requests>100</max_requests>
+                    <!-- min children to fork -->
+                    <min_children>1</min_children>
+                    <!-- max possible children to fork -->
+                    <max_children>15</max_children>
+                    <!--
+                    C forking implementation does not support 
+                    min/max idle children, but may in the future
+                    -->
+
+                    <!-- min idle children -->
+                    <min_spare_children>1</min_spare_children>
+                    <!-- max idle children -->
+                    <max_spare_children>5</max_spare_children>
+                    <!-- currently, only Perl uses the following 3 settings -->
+                    <unix_sock>open-ils.acq_unix.sock</unix_sock>
+                    <unix_pid>open-ils.acq_unix.pid</unix_pid>
+                    <unix_log>open-ils.acq_unix.log</unix_log>
+                </unix_config>
+            </open-ils.acq>
+
+            <!-- Authentication server -->
+            <open-ils.auth>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>c</language>
+                <implementation>oils_auth.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <!-- defined app-specific settings here -->
+                    <default_timeout>
+                        <!-- default login timeouts based on login type -->
+                        <opac>420</opac>
+                        <staff>7200</staff>
+                        <temp>300</temp>
+                        <persist>2 weeks</persist>
+                    </default_timeout>
+                    <auth_limits>
+                        <seed>30</seed> <!-- amount of time a seed request is valid for -->
+                        <block_time>90</block_time> <!-- amount of time since last auth or seed request to save failure counts -->
+                        <block_count>10</block_count> <!-- number of failures before blocking access -->
+                    </auth_limits>
+                </app_settings>
+            </open-ils.auth>
+
+            <!-- Generic search server -->
+            <open-ils.search>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Search</implementation>
+                <max_requests>93</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.search_unix.sock</unix_sock>
+                    <unix_pid>open-ils.search_unix.pid</unix_pid>
+                    <unix_log>open-ils.search_unix.log</unix_log>
+
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>search_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <marc_html_xsl>oilsMARC21slim2HTML.xsl</marc_html_xsl>
+                    <marc_html_xsl_slim>oilsMARC21slim2HTMLslim.xsl</marc_html_xsl_slim>
+
+                    <spelling_dictionary>
+                        <!-- 
+                            Optionally configure different dictionaries depending on search context.  
+                            If no dictionaries are defined, the default Aspell dictionary is used.
+                        -->
+                        <!--
+                        <default>/openils/var/data/default_dict.txt</default>
+                        <title>/openils/var/data/title_dict.txt</title>
+                        <author>/openils/var/data/author_dict.txt</author>
+                        <subject>/openils/var/data/subject_dict.txt</subject>
+                        <series>/openils/var/data/series_dict.txt</series>
+                        -->
+                    </spelling_dictionary>
+
+                    <!-- Default to using staged search -->
+                    <use_staged_search>true</use_staged_search>
+
+                    <!--
+                        For staged search, we estimate hits based on inclusion or exclusion.
+
+                        Valid settings:
+                            inclusion - visible ratio on superpage
+                            exclusion - excluded ratio on superpage
+                            delete_adjusted_inclusion - included ratio on superpage, ratio adjusted by deleted count
+                            delete_adjusted_exclusion - excluded ratio on superpage, ratio adjusted by deleted count
+
+                        Under normal circumstances, inclusion is the best strategy, and both delete_adjusted variants
+                        will return the same value +/- 1.  The exclusion strategy is the original, and works well
+                        when there are few deleted or excluded records, in other words, when the superpage is not
+                        sparsely populated with visible records.
+                    -->
+                    <estimation_strategy>inclusion</estimation_strategy>
+
+                    <!--
+                        Evergreen uses a cover density algorithm for calculating relative ranking of matches.  There
+                        are several tuning parameters and options available.  By default, no document length normalization
+                        is applied.  From the Postgres documentation on ts_rank_cd() (the function used by Evergreen):
+
+                            Since a longer document has a greater chance of containing a query term it is reasonable 
+                            to take into account document size, e.g., a hundred-word document with five instances of 
+                            a search word is probably more relevant than a thousand-word document with five instances. 
+                            Both ranking functions take an integer normalization option that specifies whether and how 
+                            a document's length should impact its rank. The integer option controls several behaviors, 
+                            so it is a bit mask: you can specify one or more behaviors using | (for example, 2|4).
+
+                                0 (the default) ignores the document length
+
+                                1 divides the rank by 1 + the logarithm of the document length
+
+                                2 divides the rank by the document length
+
+                                4 divides the rank by the mean harmonic distance between extents (this is implemented only by ts_rank_cd)
+
+                                8 divides the rank by the number of unique words in document
+
+                                16 divides the rank by 1 + the logarithm of the number of unique words in document
+
+                                32 divides the rank by itself + 1
+
+                            If more than one flag bit is specified, the transformations are applied in the order listed.
+
+                            It is important to note that the ranking functions do not use any global information, so it 
+                            is impossible to produce a fair normalization to 1% or 100% as sometimes desired. Normalization 
+                            option 32 (rank/(rank+1)) can be applied to scale all ranks into the range zero to one, but of 
+                            course this is just a cosmetic change; it will not affect the ordering of the search results.
+
+                        In Evergreen, these options are set via search modifiers.  The modifiers are mapped in the
+                        following way:
+
+                            * #CD_logDocumentLength  => 1  :: rank / (1 + LOG(total_word_count))   :: Longer documents slightly less relevant
+                            * #CD_documentLength     => 2  :: rank / total_word_count              :: Longer documents much less relevant
+                            * #CD_meanHarmonic       => 4  :: Word Proximity                       :: Greater matched-word distance is less relevant
+                            * #CD_uniqueWords        => 8  :: rank / unique_word_count             :: Documents with repeated words much less relevant
+                            * #CD_logUniqueWords     => 16 :: rank / (1 + LOG(unique_word_count))  :: Documents with repeated words slightly less relevant
+                            * #CD_selfPlusOne        => 32 :: rank / (1 + rank)                    :: Cosmetic normalization of rank value between 0 and 1
+
+                        Adding one or more of these to the default_CD_modifiers list will cause all searches that use QueryParser to apply them.
+                    -->
+                    <default_CD_modifiers>#CD_documentLength #CD_meanHarmonic #CD_uniqueWords</default_CD_modifiers>
+
+                    <!--
+                        default_preferred_language
+                            Set the global, default preferred languange
+                    -->
+                    <default_preferred_language>eng</default_preferred_language>
+
+                    <!--
+                        default_preferred_language_weight
+                            Set the weight (higher is "better") for the preferred language. Comment out to remove all lanuage weighting by default.
+                    -->
+                    <default_preferred_language_weight>5</default_preferred_language_weight>
+
+                    <!-- Baseline number of records to check for hit estimation. -->
+                    <superpage_size>1000</superpage_size>
+
+                    <!-- How many superpages to consider for searching overall. -->
+                    <max_superpages>10</max_superpages>
+
+                    <!-- zip code database file -->
+                    <!--<zips_file>/openils/var/data/zips.txt</zips_file>-->
+                </app_settings>
+            </open-ils.search>
+
+            <!-- server for accessing user info -->
+            <open-ils.actor>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Actor</implementation>
+                <max_requests>93</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.actor_unix.sock</unix_sock>
+                    <unix_pid>open-ils.actor_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.actor_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>actor_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <!-- set this to 'true' to have barcode search also search patron records by unique ID -->
+                <app_settings>
+                    <id_as_barcode>false</id_as_barcode>
+                </app_settings>
+
+            </open-ils.actor>
+
+<!--
+            <open-ils.booking>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Booking</implementation>
+                <max_requests>199</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.booking_unix.sock</unix_sock>
+                    <unix_pid>open-ils.booking_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.booking_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                </app_settings>
+            </open-ils.booking>
+-->
+
+            <open-ils.cat>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Cat</implementation>
+                <max_requests>199</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.cat_unix.sock</unix_sock>
+                    <unix_pid>open-ils.cat_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.cat_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>cata_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <marctemplates>
+                        <K_book>/openils/var/templates/marc/k_book.xml</K_book>
+                    </marctemplates>
+                </app_settings>
+            </open-ils.cat>
+
+            <open-ils.supercat>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::SuperCat</implementation>
+                <max_requests>199</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.supercat_unix.sock</unix_sock>
+                    <unix_pid>open-ils.supercat_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.supercat_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>supercat_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </open-ils.supercat>
+
+            <!-- server for accessing user info -->
+            <open-ils.trigger>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Trigger</implementation>
+                <max_requests>93</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.trigger_unix.sock</unix_sock>
+                    <unix_pid>open-ils.trigger_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.trigger_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <!-- number of parallel open-ils.trigger processes to use for collection and reaction -->
+                    
+                    <parallel>
+                        <collect>3</collect>
+                        <react>3</react>
+                    </parallel>
+                   
+                </app_settings>
+            </open-ils.trigger>
+
+            <opensrf.math>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>c</language>
+                <implementation>osrf_math.so</implementation>
+                <unix_config>
+                    <unix_sock>opensrf.math_unix.sock</unix_sock>
+                    <unix_pid>opensrf.math_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>opensrf.math_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </opensrf.math>
+
+            <opensrf.dbmath> 
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>c</language>
+                <implementation>osrf_dbmath.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>opensrf.dbmath_unix.log</unix_log>
+                    <unix_sock>opensrf.dbmath_unix.sock</unix_sock>
+                    <unix_pid>opensrf.dbmath_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children> 
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </opensrf.dbmath>
+
+            <open-ils.penalty>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Penalty</implementation>
+                <max_requests>99</max_requests>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.penalty_unix.log</unix_log>
+                    <unix_sock>open-ils.penalty_unix.sock</unix_sock>
+                    <unix_pid>open-ils.penalty_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>penalty_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <patron_penalty>penalty/patron_penalty.js</patron_penalty>
+                    <script_path>/openils/lib/javascript</script_path>
+                    <script_path>/openils/var</script_path>
+                    <script_path>/openils/var/catalog</script_path>
+                </app_settings>
+            </open-ils.penalty>
+
+            <open-ils.circ> 
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Circ</implementation>
+                <max_requests>99</max_requests>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.circ_unix.log</unix_log>
+                    <unix_sock>open-ils.circ_unix.sock</unix_sock>
+                    <unix_pid>open-ils.circ_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>circ_MAX</max_children>
+                    <min_spare_children>1</min_spare_children> 
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <notify_hold>
+                        <email>false</email> <!-- set to false to disable hold notice emails -->
+                    </notify_hold>
+
+                    <!-- circulation policy scripts -->
+                    <script_path>/openils/lib/javascript</script_path>
+                    <script_path>/openils/var</script_path>
+                    <script_path>/openils/var/catalog</script_path>
+                    <legacy_script_support>false</legacy_script_support>
+                    <scripts> 
+                        <circ_permit_patron>circ/circ_permit_patron.js</circ_permit_patron>
+                        <circ_permit_copy>circ/circ_permit_copy.js</circ_permit_copy>
+                        <circ_duration>circ/circ_duration.js</circ_duration>
+                        <circ_recurring_fines>circ/circ_recurring_fines.js</circ_recurring_fines>
+                        <circ_max_fines>circ/circ_max_fines.js</circ_max_fines>
+                        <circ_permit_renew>circ/circ_permit_renew.js</circ_permit_renew>
+                        <circ_permit_hold>circ/circ_permit_hold.js</circ_permit_hold>
+                    </scripts>               
+
+                    <circ_modifiers>
+                        <mod>art</mod>
+                        <mod>atlas</mod>
+                        <mod>audiobook</mod>
+                        <mod>av</mod>
+                        <mod>new-av</mod>
+                        <mod>bestseller</mod>
+                        <mod>bestsellernh</mod>
+                        <mod>book</mod>
+                        <mod>cd</mod>
+                        <mod>dvd</mod>
+                        <mod>dvd-long</mod>
+                        <mod>e-book</mod>
+                        <mod>equipment</mod>
+                        <mod>filmstrip</mod>
+                        <mod>kit</mod>
+                        <mod>magazine</mod>
+                        <mod>map</mod>
+                        <mod>microform</mod>
+                        <mod>music</mod>
+                        <mod>record</mod>
+                        <mod>software</mod>
+                        <mod>softwrlong</mod>
+                        <mod>equip-long</mod>
+                        <mod>talking book</mod>
+                        <mod>toy</mod>
+                        <mod>video</mod>
+                        <mod>video-long</mod>
+                    </circ_modifiers>
+
+                    <billing_types>
+                        <type>Miscellaneous</type>
+                        <type>Overdue materials</type>
+                        <type>Fee for placing a hold</type>
+                        <type>Fee for checking out a book</type>
+                        <type>Fee for library card</type>
+                        <type>Miscellaneous charges</type>
+                        <type>Lost materials</type>
+                        <type>Damaged material</type>
+                        <type>Overdue Reserves charge</type>
+                        <type>Recall overdue</type>
+                        <type>Fee for processing lost library materials</type>
+                        <type>Fee for sending patron bills to collection agency</type>
+                        <type>Fee for interlibrary loan</type>
+                        <type>Fee for copies</type>
+                        <type>Money advanced to pay for telephone use</type>
+                        <type>Deposit fee</type>
+                        <type>Fee for disk</type>
+                        <type>Fee for faxing</type>
+                        <type>Fee for laminating</type>
+                        <type>Fee for room cleaning</type>
+                        <type>Deposit returned; fee refund</type>
+                        <type>Sale items</type>
+                        <type>Fee for lost card</type>
+                        <type>Long overdue items</type>
+                        <type>Lost/Replacement Cassette</type>
+                        <type>Returned Check</type>
+                    </billing_types>
+                </app_settings>
+            </open-ils.circ>
+
+            <open-ils.ingest>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <implementation>OpenILS::Application::Ingest</implementation>
+                <language>perl</language>
+                <max_requests>1000000</max_requests>
+                <unix_config>
+                    <max_requests>1000000</max_requests>
+                    <unix_log>open-ils.ingest-unix.log</unix_log>
+                    <unix_sock>open-ils.ingest-unix.sock</unix_sock>
+                    <unix_pid>open-ils.ingest-unix.pid</unix_pid>
+                    <min_children>5</min_children>
+                    <max_children>ingest_MAX</max_children>
+                    <min_spare_children>2</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <script_path>/openils/lib/javascript/</script_path>
+                    <script_path>/openils/var/catalog/</script_path>
+                    <script_path>/openils/var/web/opac/common/js/</script_path>
+                    <scripts>
+                        <biblio_fingerprint>biblio_fingerprint.js</biblio_fingerprint>
+                        <biblio_descriptor>biblio_descriptor.js</biblio_descriptor>
+                    </scripts>
+                </app_settings>
+            </open-ils.ingest>
+
+            <open-ils.storage>
+                <keepalive>10</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Storage</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.storage_unix.log</unix_log>
+                    <unix_sock>open-ils.storage_unix.sock</unix_sock>
+                    <unix_pid>open-ils.storage_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>storage_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <script_path>/openils/lib/javascript/</script_path>
+                    <script_path>/openils/var/catalog/</script_path>
+                    <scripts>
+                        <biblio_fingerprint>biblio_fingerprint.js</biblio_fingerprint>
+                    </scripts>
+                    <databases>
+                        <driver>Pg</driver>
+                        <database>
+                            <type>master</type>
+                            <weight>2</weight>
+                            <user>evergreen</user>
+                            <host>db01.ClusterDomainName</host>
+                            <port>5432</port>
+                            <pw>DatabasePassword</pw>
+                            <db>evergreen</db>
+                            <client_encoding>UTF-8</client_encoding>
+                        </database>
+                    </databases>
+                </app_settings>
+            </open-ils.storage>
+
+            <open-ils.cstore>
+                <keepalive>6</keepalive>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_cstore.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>cstore_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <max_query_recursion>100</max_query_recursion>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.cstore>
+
+            <open-ils.pcrud>
+                <keepalive>6</keepalive>
+                <migratable>1</migratable>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_pcrud.so</implementation>
+
+                <unix_config>
+                    <unix_log>open-ils.pcrud.log</unix_log>
+                    <unix_sock>open-ils.pcrud.sock</unix_sock>
+                    <unix_pid>open-ils.pcrud.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+
+                <app_settings>
+                    <IDL>/openils/conf/fm_IDL.xml</IDL>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.pcrud>
+
+            <open-ils.qstore>
+                <keepalive>6</keepalive>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_qstore.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.qstore>
+
+            <opensrf.settings>
+                <keepalive>1</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenSRF::Application::Settings</implementation>
+                <max_requests>17</max_requests>
+                <unix_config>
+                    <unix_sock>opensrf.settings_unix.sock</unix_sock>
+                    <unix_pid>opensrf.settings_unix.pid</unix_pid>
+                    <max_requests>300</max_requests>
+                    <unix_log>opensrf.settings_unix.log</unix_log>
+                    <min_children>5</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>3</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </opensrf.settings>
+
+            <open-ils.collections>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Collections</implementation>
+                <max_requests>17</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.collections_unix.sock</unix_sock>
+                    <unix_pid>open-ils.collections_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.collections_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </open-ils.collections>
+
+            <open-ils.reporter>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Reporter</implementation>
+                <max_requests>99</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.reporter_unix.sock</unix_sock>
+                    <unix_pid>open-ils.reporter_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.reporter_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </open-ils.reporter>
+
+            <open-ils.reporter-store>
+                <keepalive>6</keepalive>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_rstore.so</implementation>
+                <unix_config>
+                    <max_requests>400</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.reporter-store>
+
+<!--
+           <open-ils.resolver>
+               <keepalive>3</keepalive>
+               <stateless>1</stateless>
+               <language>perl</language>
+               <implementation>OpenILS::Application::ResolverResolver</implementation>
+               <max_requests>93</max_requests>
+               <unix_config>
+                  <unix_sock>open-ils.resolver_unix.sock</unix_sock>
+                  <unix_pid>open-ils.resolver_unix.pid</unix_pid>
+                  <max_requests>1000</max_requests>
+                  <unix_log>open-ils.resolver_unix.log</unix_log>
+                  <min_children>5</min_children>
+                  <max_children>15</max_children>
+                  <min_spare_children>3</min_spare_children>
+                  <max_spare_children>5</max_spare_children>
+               </unix_config>
+               <app_settings>
+                  <cache_timeout>86400</cache_timeout>
+                  <default_url_base>http://path/to/sfx</default_url_base>
+               </app_settings>
+            </open-ils.resolver>
+-->
+
+            <open-ils.permacrud>
+               <keepalive>3</keepalive>
+               <stateless>1</stateless>
+               <language>perl</language>
+               <implementation>OpenILS::Application::PermaCrud</implementation>
+               <max_requests>17</max_requests>
+               <unix_config>
+                  <unix_sock>open-ils.permacrud_unix.sock</unix_sock>
+                  <unix_pid>open-ils.permacrud_unix.pid</unix_pid>
+                  <max_requests>1000</max_requests>
+                  <unix_log>open-ils.permacrud_unix.log</unix_log>
+                  <min_children>5</min_children>
+                  <max_children>permacrud_MAX</max_children>
+                  <min_spare_children>3</min_spare_children>
+                  <max_spare_children>5</max_spare_children>
+               </unix_config>
+            </open-ils.permacrud>
+
+            <open-ils.fielder>
+               <keepalive>3</keepalive>
+               <stateless>1</stateless>
+               <language>perl</language>
+               <implementation>OpenILS::Application::Fielder</implementation>
+               <max_requests>17</max_requests>
+               <unix_config>
+                  <unix_sock>open-ils.fielder_unix.sock</unix_sock>
+                  <unix_pid>open-ils.fielder_unix.pid</unix_pid>
+                  <max_requests>1000</max_requests>
+                  <unix_log>open-ils.fielder_unix.log</unix_log>
+                  <min_children>5</min_children>
+                  <max_children>fielder_MAX</max_children>
+                  <min_spare_children>3</min_spare_children>
+                  <max_spare_children>5</max_spare_children>
+               </unix_config>
+            </open-ils.fielder>
+
+            <open-ils.vandelay>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Vandelay</implementation>
+                <max_requests>100</max_requests>
+                <unix_config>
+                    <unix_sock>vandelay_unix.sock</unix_sock>
+                    <unix_pid>vandelay_unix.pid</unix_pid>
+                    <unix_log>vandelay_unix.log</unix_log>
+                    <max_requests>100</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>vandelay_MAX</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <databases>
+                        <!-- temporary location for MARC import files.  
+                            Files will be deleted after records are spooled.
+                            *note:  in a multi-brick environment, this will need to
+                            be on a write-able NFS share.  -->
+                        <importer>/openils/var/data/offline/vandelay</importer>
+                    </databases>
+                </app_settings>
+            </open-ils.vandelay>
+
+            <open-ils.serial>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Serial</implementation>
+                <max_requests>17</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.serial_unix.sock</unix_sock>
+                    <unix_pid>open-ils.serial_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.serial_unix.log</unix_log>
+                    <min_children>5</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>3</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                </app_settings>
+            </open-ils.serial>
+
+        </apps>
+    </default>
+
+    <hosts>
+
+            <!-- ^-=- 
+            Should match the fully qualified domain name of the host.
+
+            On Linux, the output of the following command is authoritative:
+            $ perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";'
+
+            To use 'localhost' instead, run osrf_ctl.sh with the -l flag
+            -->
+
diff --git a/templates/opensrf.xml/opensrf.xml-header-old b/templates/opensrf.xml/opensrf.xml-header-old
new file mode 100644 (file)
index 0000000..92b7ed2
--- /dev/null
@@ -0,0 +1,1137 @@
+<?xml version="1.0"?>
+<!-- 
+Example opensrf config file for OpenILS
+vim:et:ts=4:sw=4:
+-->
+<opensrf version="0.0.3">
+
+    <default>
+
+        <!-- unless otherwise overidden, use this locale -->
+        <default_locale>en-US</default_locale>
+
+        <dirs>
+            <log>/openils/var/log</log> <!-- unix::server log files -->
+            <sock>/openils/var/lock</sock> <!-- unix::server sock files -->
+            <pid>/openils/var/run</pid>
+            <xsl>/openils/var/xsl</xsl>
+            <script>/openils/var</script>
+            <script_lib>/openils/var</script_lib>
+            <templates>/openils/var/templates</templates>
+        </dirs>
+
+        <!-- global data visibility settings -->
+        <share>
+            <user>
+                <!-- Set to "true" to require patron opt-in for foreign (non-home_ou) transactions -->
+                <opt_in>false</opt_in>
+            </user>
+        </share>
+
+        <IDL>/openils/conf/fm_IDL.xml</IDL> <!-- top level IDL file -->
+        <IDL2js>fm_IDL2js.xsl</IDL2js> <!-- IDL JS XSLT -->
+
+
+        <server_type>prefork</server_type> <!-- net::server type -->
+
+        <ils_events>/openils/var/data/ils_events.xml</ils_events> <!-- ILS events description file -->
+
+        <email_notify> <!-- this will eventually move into the notifications section below... -->
+            <!-- global email notification settings -->
+            <template>/openils/var/data/hold_notification_template.example</template>
+            <smtp_server>ClusterDomainName</smtp_server>
+
+            <!--
+            in most cases, this is overridden by location 
+            specific config settings.  this is just the default
+            -->
+            <sender_address>evergreen@ClusterDomainName</sender_address>
+        </email_notify>
+
+
+      <notifications>
+        <!-- global mail server settings -->
+        <smtp_server>ClusterDomainName</smtp_server>
+        <sender_address>evergreen@ClusterDomainName</sender_address>
+
+        <!-- global telephony (asterisk) settings -->
+        <telephony>
+            <!-- replace all values below when telephony server is configured -->
+            <enabled>0</enabled>
+            <driver>SIP</driver>    <!-- SIP (default) or multi -->
+            <channels>              <!-- explicit list of channels used if multi -->
+                                    <!-- A channel specifies technology/resource -->
+                <channel>Zap/1</channel>
+                <channel>Zap/2</channel>
+                <channel>IAX/user:secret@widgets.biz</channel>
+            </channels>
+            <host>localhost</host>
+            <port>10080</port>
+            <user>evergreen</user>
+            <pw>evergreen</pw>
+            <!--
+                The overall composition of callfiles is determined by the
+                relevant template, but this section can be invoked for callfile
+                configs common to all outbound calls.
+                callfile_lines will be inserted into ALL generated callfiles
+                after the Channel line.  This content mat be overridden
+                (in whole) by the org unit setting callfile_lines.
+                Warning: Invalid syntax may break ALL outbound calls.
+            -->
+            <!-- <callfile_lines>
+                MaxRetries: 3
+                RetryTime: 60
+                WaitTime: 30
+                Archive: 1
+                Extension: 10
+            </callfile_lines> -->
+        </telephony>
+
+        <!-- Overdue notices: DEPRECATED in 2.0 in favour of Action/Trigger Notifications -->
+        <overdue>
+
+            <!-- optionally, you can define a sender address per notice type -->
+            <sender_address>overdue@ClusterDomainName</sender_address>
+
+            <!-- The system can generate an XML file of overdue notices.  This is the
+                directory where they are stored.  Files are named overdue.YYYY-MM-DD.xml -->
+            <notice_dir>/openils/var/data/overdue</notice_dir>
+            <combined_template>/openils/var/data/templates/overdue_combined_xml.example</combined_template>
+
+            <notice>
+                <!-- Notify at 7 days overdue -->
+                <notify_interval>7 days</notify_interval>
+                <!-- Options include always, noemail, and never.  'noemail' means a notice
+                     will be appended to the notice file only if the patron has no valid email address.  -->
+                <file_append>noemail</file_append>
+                <!-- do we attempt email notification? -->
+                <email_notify>false</email_notify>
+                <!-- notice template file -->
+                <email_template>/openils/var/data/templates/overdue_7day.example</email_template>
+            </notice>
+        </overdue>
+
+        <!-- Courtesy notices: DEPRECATED in 2.0 in favour of Action/Trigger Notifications -->
+        <predue>
+            <notice>
+                <!-- All circulations that circulate between 5 and 13 days -->
+                <circ_duration_range>
+                    <from>5 days</from>
+                    <to>13 days</to>
+                </circ_duration_range>
+                <!-- notify at 1 day before the due date -->
+                <notify_interval>1 day</notify_interval>
+                <file_append>false</file_append>
+                <email_notify>false</email_notify>
+                <email_template>/openils/var/data/templates/predue_1day.example</email_template>
+            </notice>
+        </predue>
+      </notifications>
+
+        <!-- Settings for the hold targeter cron job -->
+        <hold_targeter>
+            <!-- number of parallel processes to use during hold targeting;
+                 increasing can speed up (re)targeting a large number of
+                 hold requests, but with diminishing returns after a point;
+                 if increasing this value, it is recommend to do so slowly
+            -->
+            <parallel>1</parallel>
+        </hold_targeter>
+
+        <!-- Settings for the fine generator cron job -->
+        <fine_generator>
+            <!-- number of parallel processes to use during fine generation -->
+            <parallel>1</parallel>
+        </fine_generator>
+        
+        <reporter>
+            <!--
+            Settings for the reporter daemon process 
+            -->
+            <setup>
+                <base_uri>https://ClusterDomainName/reporter/</base_uri>
+                <database>
+                    <driver>Pg</driver>
+                    <host>db03.ClusterDomainName</host>
+                    <port>5432</port>
+                    <db>evergreen</db>
+                    <user>evergreen</user>
+                    <pw>DatabasePassword</pw>
+                </database>
+                <state_store>
+                    <driver>Pg</driver>
+                    <host>db03.ClusterDomainName</host>
+                    <port>5432</port>
+                    <db>evergreen</db>
+                    <user>evergreen</user>
+                    <pw>DatabasePassword</pw>
+                </state_store>
+                <files>
+                    <!-- successful report outputs go here -->
+                    <output_base>/openils/var/web/reporter</output_base>
+                    <success_template>/openils/var/data/report-success</success_template>
+                    <fail_template>/openils/var/data/report-fail</fail_template>
+                </files>
+            </setup>
+        </reporter>
+
+
+
+        <xml-rpc>
+            <!-- XML-RPC gateway.  Do NOT publish unprotected services here -->
+            <allowed_services>
+                <!-- list of published services -->
+                <service>opensrf.math</service>
+                <service>opensrf.dbmath</service>
+                <service>open-ils.cat</service>
+                <service>open-ils.search</service>
+                <service>open-ils.circ</service>
+                <service>open-ils.actor</service>
+                <service>open-ils.auth</service>
+                <service>open-ils.collections</service>
+            </allowed_services>
+        </xml-rpc>
+
+
+        <z3950>
+            <default>oclc</default>
+            <services>
+                
+               <oclc>
+                    <!-- Z3950 settings for OCLC.  Note that OCLC requires username/password -->
+                    <host>zcat.oclc.org</host>
+                    <port>210</port>
+                    <db>OLUCWorldCat</db>
+                    <attrs>
+                        <!--
+                        These are directly from the Bib-1 Attribute Set
+                        http://www.loc.gov/z3950/agency/defns/bib1.html
+                        <code> is the "use attribute", <format> is the "structure attribute"
+                        This just puts some friendly names on the data.
+                        -->
+                        <tcn><code>12</code><format>1</format></tcn>
+                        <isbn><code>7</code><format>6</format></isbn>
+                        <lccn><code>9</code><format>1</format></lccn>
+                        <author><code>1003</code><format>6</format></author>
+                        <title><code>4</code><format>6</format></title>
+                        <issn><code>8</code><format>1</format></issn>
+                        <publisher><code>1018</code><format>6</format></publisher>
+                        <pubdate><code>31</code><format>1</format></pubdate>
+                        <item_type><code>1001</code><format>1</format></item_type>
+                    </attrs>
+                </oclc>
+
+            </services>
+        </z3950>
+
+
+        <added_content>
+            <!-- load the OpenLibrary added content module -->
+            <module>OpenILS::WWW::AddedContent::Syndetic</module>
+           <base_url>http://syndetics.com/index.aspx</base_url>
+            <!--
+            Max number of seconds to wait for an added content request to 
+            return data.  Data not returned within the timeout is considered
+            a failure.
+
+            Note that the pool of Apache processes used by the AddedContent
+            module is the same pool used by core Evergreen processes such as
+            search, circulation, etc. Therefore, the higher you set this
+            timeout value, the more likely you are to run out of available
+            Apache processes resulting in an accidental (or purposeful) denial
+            of service - particularly if the added content server starts
+            responding abnormally slowly.
+
+            The safest option is to disable the AddedContent module completely,
+            but 3 seconds is a compromise between the threat of a denial of
+            service and the enhanced user experience offered by successful added
+            content requests.
+            -->
+            <timeout>1</timeout>
+
+            <!--
+            After added content lookups have been disabled due to too many
+            lookup failures, this is the amount of time to wait before
+            we try again
+            -->
+            <retry_timeout>600</retry_timeout>
+
+            <!--
+            maximum number of consecutive lookup errors a given process can 
+            have before added content lookups are disabled for everyone
+            -->
+            <max_errors>15</max_errors>
+
+            <!-- If a userid is required to access the added content.. -->
+            <userid>evertest</userid>
+
+            <!--
+            Base URL for Amazon added content fetching. Not needed by OpenLibrary
+            <base_url>http://images.amazon.com/images/P/</base_url>
+            -->
+
+            <!--
+            Segregating the details for ContentCafe out for easier use.  At some point, we
+            may want to support multiple services at one time.
+            -->
+            <!-- <ContentCafe>
+                <userid>MY_USER_ID</userid>
+                <password>MY_PASSWORD</password> -->
+
+                <!--
+                If no cover/jacket image exists for a given ISBN, then a value of T here will
+                return an 80x120 pixel image containing the text "No Image Available".  A
+                value of 1 will return a 1x1 pixel image.
+                -->
+                <!-- <return_behavior_on_no_jacket_image>T</return_behavior_on_no_jacket_image>
+            </ContentCafe> -->
+
+            <!--
+            You can add free-form settings here and they will be accessible
+            within the added content module
+            -->
+
+        </added_content>
+
+        <!-- no apps are enabled globally by default -->
+        <activeapps/> 
+
+        <cache>
+            <!-- memcache servers -->
+            <global>
+                <servers>
+                    <server>memcache01_IP:11211</server>
+                   <server>memcache02_IP:11211</server>
+                </servers>
+                <max_cache_time>86400</max_cache_time>
+            </global>
+            <anon>
+                <!-- anonymous cache.  currently, primarily used for web session caching -->
+                <servers>
+                    <server>memcache01_IP:11211</server>
+                   <server>memcache02_IP:11211</server>
+                </servers>
+                <max_cache_time>1800</max_cache_time>
+                <!-- maximum size of a single cache entry / default = 100k-->
+                <max_cache_size>102400</max_cache_size>
+            </anon>
+        </cache>
+
+        <apps>
+            <!-- Acquisitions server -->
+            <open-ils.acq>
+                <!-- how long to wait between stateful requests before the child process re-joins the pool -->
+                <keepalive>5</keepalive>
+                <!-- true if this service support stateless requests -->
+                <stateless>1</stateless>
+                <!-- implementation language -->
+                <language>perl</language>
+                <!-- name of the library that implements this application -->
+                <implementation>OpenILS::Application::Acq</implementation>
+                <!-- maximum OpenSRF REQUEST within a stateful connection -->
+                <max_requests>100</max_requests>
+                <unix_config>
+                    <!--
+                    maximum number of top level requests coming to 
+                    this child before the child is recycled
+                    -->
+                    <max_requests>100</max_requests>
+                    <!-- min children to fork -->
+                    <min_children>1</min_children>
+                    <!-- max possible children to fork -->
+                    <max_children>15</max_children>
+                    <!--
+                    C forking implementation does not support 
+                    min/max idle children, but may in the future
+                    -->
+
+                    <!-- min idle children -->
+                    <min_spare_children>1</min_spare_children>
+                    <!-- max idle children -->
+                    <max_spare_children>5</max_spare_children>
+                    <!-- currently, only Perl uses the following 3 settings -->
+                    <unix_sock>open-ils.acq_unix.sock</unix_sock>
+                    <unix_pid>open-ils.acq_unix.pid</unix_pid>
+                    <unix_log>open-ils.acq_unix.log</unix_log>
+                </unix_config>
+            </open-ils.acq>
+
+            <!-- Authentication server -->
+            <open-ils.auth>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>c</language>
+                <implementation>oils_auth.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <!-- defined app-specific settings here -->
+                    <default_timeout>
+                        <!-- default login timeouts based on login type -->
+                        <opac>420</opac>
+                        <staff>7200</staff>
+                        <temp>300</temp>
+                        <persist>2 weeks</persist>
+                    </default_timeout>
+                    <auth_limits>
+                        <seed>30</seed> <!-- amount of time a seed request is valid for -->
+                        <block_time>90</block_time> <!-- amount of time since last auth or seed request to save failure counts -->
+                        <block_count>10</block_count> <!-- number of failures before blocking access -->
+                    </auth_limits>
+                </app_settings>
+            </open-ils.auth>
+
+            <!-- Generic search server -->
+            <open-ils.search>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Search</implementation>
+                <max_requests>93</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.search_unix.sock</unix_sock>
+                    <unix_pid>open-ils.search_unix.pid</unix_pid>
+                    <unix_log>open-ils.search_unix.log</unix_log>
+
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <marc_html_xsl>oilsMARC21slim2HTML.xsl</marc_html_xsl>
+                    <marc_html_xsl_slim>oilsMARC21slim2HTMLslim.xsl</marc_html_xsl_slim>
+
+                    <spelling_dictionary>
+                        <!-- 
+                            Optionally configure different dictionaries depending on search context.  
+                            If no dictionaries are defined, the default Aspell dictionary is used.
+                        -->
+                        <!--
+                        <default>/openils/var/data/default_dict.txt</default>
+                        <title>/openils/var/data/title_dict.txt</title>
+                        <author>/openils/var/data/author_dict.txt</author>
+                        <subject>/openils/var/data/subject_dict.txt</subject>
+                        <series>/openils/var/data/series_dict.txt</series>
+                        -->
+                    </spelling_dictionary>
+
+                    <!-- Default to using staged search -->
+                    <use_staged_search>true</use_staged_search>
+
+                    <!--
+                        For staged search, we estimate hits based on inclusion or exclusion.
+
+                        Valid settings:
+                            inclusion - visible ratio on superpage
+                            exclusion - excluded ratio on superpage
+                            delete_adjusted_inclusion - included ratio on superpage, ratio adjusted by deleted count
+                            delete_adjusted_exclusion - excluded ratio on superpage, ratio adjusted by deleted count
+
+                        Under normal circumstances, inclusion is the best strategy, and both delete_adjusted variants
+                        will return the same value +/- 1.  The exclusion strategy is the original, and works well
+                        when there are few deleted or excluded records, in other words, when the superpage is not
+                        sparsely populated with visible records.
+                    -->
+                    <estimation_strategy>inclusion</estimation_strategy>
+
+                    <!--
+                        Evergreen uses a cover density algorithm for calculating relative ranking of matches.  There
+                        are several tuning parameters and options available.  By default, no document length normalization
+                        is applied.  From the Postgres documentation on ts_rank_cd() (the function used by Evergreen):
+
+                            Since a longer document has a greater chance of containing a query term it is reasonable 
+                            to take into account document size, e.g., a hundred-word document with five instances of 
+                            a search word is probably more relevant than a thousand-word document with five instances. 
+                            Both ranking functions take an integer normalization option that specifies whether and how 
+                            a document's length should impact its rank. The integer option controls several behaviors, 
+                            so it is a bit mask: you can specify one or more behaviors using | (for example, 2|4).
+
+                                0 (the default) ignores the document length
+
+                                1 divides the rank by 1 + the logarithm of the document length
+
+                                2 divides the rank by the document length
+
+                                4 divides the rank by the mean harmonic distance between extents (this is implemented only by ts_rank_cd)
+
+                                8 divides the rank by the number of unique words in document
+
+                                16 divides the rank by 1 + the logarithm of the number of unique words in document
+
+                                32 divides the rank by itself + 1
+
+                            If more than one flag bit is specified, the transformations are applied in the order listed.
+
+                            It is important to note that the ranking functions do not use any global information, so it 
+                            is impossible to produce a fair normalization to 1% or 100% as sometimes desired. Normalization 
+                            option 32 (rank/(rank+1)) can be applied to scale all ranks into the range zero to one, but of 
+                            course this is just a cosmetic change; it will not affect the ordering of the search results.
+
+                        In Evergreen, these options are set via search modifiers.  The modifiers are mapped in the
+                        following way:
+
+                            * #CD_logDocumentLength  => 1  :: rank / (1 + LOG(total_word_count))   :: Longer documents slightly less relevant
+                            * #CD_documentLength     => 2  :: rank / total_word_count              :: Longer documents much less relevant
+                            * #CD_meanHarmonic       => 4  :: Word Proximity                       :: Greater matched-word distance is less relevant
+                            * #CD_uniqueWords        => 8  :: rank / unique_word_count             :: Documents with repeated words much less relevant
+                            * #CD_logUniqueWords     => 16 :: rank / (1 + LOG(unique_word_count))  :: Documents with repeated words slightly less relevant
+                            * #CD_selfPlusOne        => 32 :: rank / (1 + rank)                    :: Cosmetic normalization of rank value between 0 and 1
+
+                        Adding one or more of these to the default_CD_modifiers list will cause all searches that use QueryParser to apply them.
+                    -->
+                    <default_CD_modifiers>#CD_documentLength #CD_meanHarmonic #CD_uniqueWords</default_CD_modifiers>
+
+                    <!--
+                        default_preferred_language
+                            Set the global, default preferred languange
+                    -->
+                    <default_preferred_language>eng</default_preferred_language>
+
+                    <!--
+                        default_preferred_language_weight
+                            Set the weight (higher is "better") for the preferred language. Comment out to remove all lanuage weighting by default.
+                    -->
+                    <default_preferred_language_weight>5</default_preferred_language_weight>
+
+                    <!-- Baseline number of records to check for hit estimation. -->
+                    <superpage_size>1000</superpage_size>
+
+                    <!-- How many superpages to consider for searching overall. -->
+                    <max_superpages>10</max_superpages>
+
+                    <!-- zip code database file -->
+                    <!--<zips_file>/openils/var/data/zips.txt</zips_file>-->
+                </app_settings>
+            </open-ils.search>
+
+            <!-- server for accessing user info -->
+            <open-ils.actor>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Actor</implementation>
+                <max_requests>93</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.actor_unix.sock</unix_sock>
+                    <unix_pid>open-ils.actor_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.actor_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <!-- set this to 'true' to have barcode search also search patron records by unique ID -->
+                <app_settings>
+                    <id_as_barcode>false</id_as_barcode>
+                </app_settings>
+
+            </open-ils.actor>
+
+            <open-ils.booking>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Booking</implementation>
+                <max_requests>199</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.booking_unix.sock</unix_sock>
+                    <unix_pid>open-ils.booking_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.booking_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                </app_settings>
+            </open-ils.booking>
+
+            <open-ils.cat>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Cat</implementation>
+                <max_requests>199</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.cat_unix.sock</unix_sock>
+                    <unix_pid>open-ils.cat_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.cat_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <marctemplates>
+                        <K_book>/openils/var/templates/marc/k_book.xml</K_book>
+                    </marctemplates>
+                </app_settings>
+            </open-ils.cat>
+
+            <open-ils.supercat>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::SuperCat</implementation>
+                <max_requests>199</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.supercat_unix.sock</unix_sock>
+                    <unix_pid>open-ils.supercat_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.supercat_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </open-ils.supercat>
+
+            <!-- server for accessing user info -->
+            <open-ils.trigger>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Trigger</implementation>
+                <max_requests>93</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.trigger_unix.sock</unix_sock>
+                    <unix_pid>open-ils.trigger_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.trigger_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <!-- number of parallel open-ils.trigger processes to use for collection and reaction -->
+                    <!--
+                    <parallel>
+                        <collect>3</collect>
+                        <react>3</react>
+                    </parallel>
+                    -->
+                </app_settings>
+            </open-ils.trigger>
+
+            <opensrf.math>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>c</language>
+                <implementation>osrf_math.so</implementation>
+                <unix_config>
+                    <unix_sock>opensrf.math_unix.sock</unix_sock>
+                    <unix_pid>opensrf.math_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>opensrf.math_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </opensrf.math>
+
+            <opensrf.dbmath> 
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>c</language>
+                <implementation>osrf_dbmath.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>opensrf.dbmath_unix.log</unix_log>
+                    <unix_sock>opensrf.dbmath_unix.sock</unix_sock>
+                    <unix_pid>opensrf.dbmath_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children> 
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </opensrf.dbmath>
+
+            <open-ils.penalty>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Penalty</implementation>
+                <max_requests>99</max_requests>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.penalty_unix.log</unix_log>
+                    <unix_sock>open-ils.penalty_unix.sock</unix_sock>
+                    <unix_pid>open-ils.penalty_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <patron_penalty>penalty/patron_penalty.js</patron_penalty>
+                    <script_path>/openils/lib/javascript</script_path>
+                    <script_path>/openils/var</script_path>
+                    <script_path>/openils/var/catalog</script_path>
+                </app_settings>
+            </open-ils.penalty>
+
+            <open-ils.circ> 
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Circ</implementation>
+                <max_requests>99</max_requests>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.circ_unix.log</unix_log>
+                    <unix_sock>open-ils.circ_unix.sock</unix_sock>
+                    <unix_pid>open-ils.circ_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children> 
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <notify_hold>
+                        <email>false</email> <!-- set to false to disable hold notice emails -->
+                    </notify_hold>
+
+                    <!-- circulation policy scripts -->
+                    <script_path>/openils/lib/javascript</script_path>
+                    <script_path>/openils/var</script_path>
+                    <script_path>/openils/var/catalog</script_path>
+                    <legacy_script_support>false</legacy_script_support>
+                    <scripts> 
+                        <circ_permit_patron>circ/circ_permit_patron.js</circ_permit_patron>
+                        <circ_permit_copy>circ/circ_permit_copy.js</circ_permit_copy>
+                        <circ_duration>circ/circ_duration.js</circ_duration>
+                        <circ_recurring_fines>circ/circ_recurring_fines.js</circ_recurring_fines>
+                        <circ_max_fines>circ/circ_max_fines.js</circ_max_fines>
+                        <circ_permit_renew>circ/circ_permit_renew.js</circ_permit_renew>
+                        <circ_permit_hold>circ/circ_permit_hold.js</circ_permit_hold>
+                    </scripts>               
+
+                    <circ_modifiers>
+                        <mod>art</mod>
+                        <mod>atlas</mod>
+                        <mod>audiobook</mod>
+                        <mod>av</mod>
+                        <mod>new-av</mod>
+                        <mod>bestseller</mod>
+                        <mod>bestsellernh</mod>
+                        <mod>book</mod>
+                        <mod>cd</mod>
+                        <mod>dvd</mod>
+                        <mod>dvd-long</mod>
+                        <mod>e-book</mod>
+                        <mod>equipment</mod>
+                        <mod>filmstrip</mod>
+                        <mod>kit</mod>
+                        <mod>magazine</mod>
+                        <mod>map</mod>
+                        <mod>microform</mod>
+                        <mod>music</mod>
+                        <mod>record</mod>
+                        <mod>software</mod>
+                        <mod>softwrlong</mod>
+                        <mod>equip-long</mod>
+                        <mod>talking book</mod>
+                        <mod>toy</mod>
+                        <mod>video</mod>
+                        <mod>video-long</mod>
+                    </circ_modifiers>
+
+                    <billing_types>
+                        <type>Miscellaneous</type>
+                        <type>Overdue materials</type>
+                        <type>Fee for placing a hold</type>
+                        <type>Fee for checking out a book</type>
+                        <type>Fee for library card</type>
+                        <type>Miscellaneous charges</type>
+                        <type>Lost materials</type>
+                        <type>Damaged material</type>
+                        <type>Overdue Reserves charge</type>
+                        <type>Recall overdue</type>
+                        <type>Fee for processing lost library materials</type>
+                        <type>Fee for sending patron bills to collection agency</type>
+                        <type>Fee for interlibrary loan</type>
+                        <type>Fee for copies</type>
+                        <type>Money advanced to pay for telephone use</type>
+                        <type>Deposit fee</type>
+                        <type>Fee for disk</type>
+                        <type>Fee for faxing</type>
+                        <type>Fee for laminating</type>
+                        <type>Fee for room cleaning</type>
+                        <type>Deposit returned; fee refund</type>
+                        <type>Sale items</type>
+                        <type>Fee for lost card</type>
+                        <type>Long overdue items</type>
+                        <type>Lost/Replacement Cassette</type>
+                        <type>Returned Check</type>
+                    </billing_types>
+                </app_settings>
+            </open-ils.circ>
+
+            <open-ils.ingest>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <implementation>OpenILS::Application::Ingest</implementation>
+                <language>perl</language>
+                <max_requests>1000000</max_requests>
+                <unix_config>
+                    <max_requests>1000000</max_requests>
+                    <unix_log>open-ils.ingest-unix.log</unix_log>
+                    <unix_sock>open-ils.ingest-unix.sock</unix_sock>
+                    <unix_pid>open-ils.ingest-unix.pid</unix_pid>
+                    <min_children>5</min_children>
+                    <max_children>20</max_children>
+                    <min_spare_children>2</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <script_path>/openils/lib/javascript/</script_path>
+                    <script_path>/openils/var/catalog/</script_path>
+                    <script_path>/openils/var/web/opac/common/js/</script_path>
+                    <scripts>
+                        <biblio_fingerprint>biblio_fingerprint.js</biblio_fingerprint>
+                        <biblio_descriptor>biblio_descriptor.js</biblio_descriptor>
+                    </scripts>
+                </app_settings>
+            </open-ils.ingest>
+
+            <open-ils.storage>
+                <keepalive>10</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Storage</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.storage_unix.log</unix_log>
+                    <unix_sock>open-ils.storage_unix.sock</unix_sock>
+                    <unix_pid>open-ils.storage_unix.pid</unix_pid>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <script_path>/openils/lib/javascript/</script_path>
+                    <script_path>/openils/var/catalog/</script_path>
+                    <scripts>
+                        <biblio_fingerprint>biblio_fingerprint.js</biblio_fingerprint>
+                    </scripts>
+                    <databases>
+                        <driver>Pg</driver>
+                        <database>
+                            <type>master</type>
+                            <weight>2</weight>
+                            <user>evergreen</user>
+                            <host>db01.ClusterDomainName</host>
+                            <port>5432</port>
+                            <pw>DatabasePassword</pw>
+                            <db>evergreen</db>
+                            <client_encoding>UTF-8</client_encoding>
+                        </database>
+                    </databases>
+                </app_settings>
+            </open-ils.storage>
+
+            <open-ils.cstore>
+                <keepalive>6</keepalive>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_cstore.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <max_query_recursion>100</max_query_recursion>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.cstore>
+
+            <open-ils.pcrud>
+                <keepalive>6</keepalive>
+                <migratable>1</migratable>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_pcrud.so</implementation>
+
+                <unix_config>
+                    <unix_log>open-ils.pcrud.log</unix_log>
+                    <unix_sock>open-ils.pcrud.sock</unix_sock>
+                    <unix_pid>open-ils.pcrud.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+
+                <app_settings>
+                    <IDL>/openils/conf/fm_IDL.xml</IDL>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.pcrud>
+
+            <open-ils.qstore>
+                <keepalive>6</keepalive>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_qstore.so</implementation>
+                <unix_config>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.qstore>
+
+            <opensrf.settings>
+                <keepalive>1</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenSRF::Application::Settings</implementation>
+                <max_requests>17</max_requests>
+                <unix_config>
+                    <unix_sock>opensrf.settings_unix.sock</unix_sock>
+                    <unix_pid>opensrf.settings_unix.pid</unix_pid>
+                    <max_requests>300</max_requests>
+                    <unix_log>opensrf.settings_unix.log</unix_log>
+                    <min_children>5</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>3</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </opensrf.settings>
+
+            <open-ils.collections>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Collections</implementation>
+                <max_requests>17</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.collections_unix.sock</unix_sock>
+                    <unix_pid>open-ils.collections_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.collections_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </open-ils.collections>
+
+            <open-ils.reporter>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Reporter</implementation>
+                <max_requests>99</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.reporter_unix.sock</unix_sock>
+                    <unix_pid>open-ils.reporter_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.reporter_unix.log</unix_log>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+            </open-ils.reporter>
+
+            <open-ils.reporter-store>
+                <keepalive>6</keepalive>
+                <stateless>1</stateless>
+                <language>C</language>
+                <implementation>oils_rstore.so</implementation>
+                <unix_config>
+                    <max_requests>400</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>10</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <driver>pgsql</driver>
+                    <database>
+                        <type>master</type>
+                        <weight>2</weight>
+                        <user>evergreen</user>
+                        <host>db01.ClusterDomainName</host>
+                        <port>5432</port>
+                        <pw>DatabasePassword</pw>
+                        <db>evergreen</db>
+                        <client_encoding>UTF-8</client_encoding>
+                    </database>
+                </app_settings>
+            </open-ils.reporter-store>
+
+<!--
+           <open-ils.resolver>
+               <keepalive>3</keepalive>
+               <stateless>1</stateless>
+               <language>perl</language>
+               <implementation>OpenILS::Application::ResolverResolver</implementation>
+               <max_requests>93</max_requests>
+               <unix_config>
+                  <unix_sock>open-ils.resolver_unix.sock</unix_sock>
+                  <unix_pid>open-ils.resolver_unix.pid</unix_pid>
+                  <max_requests>1000</max_requests>
+                  <unix_log>open-ils.resolver_unix.log</unix_log>
+                  <min_children>5</min_children>
+                  <max_children>15</max_children>
+                  <min_spare_children>3</min_spare_children>
+                  <max_spare_children>5</max_spare_children>
+               </unix_config>
+               <app_settings>
+                  <cache_timeout>86400</cache_timeout>
+                  <default_url_base>http://path/to/sfx</default_url_base>
+               </app_settings>
+            </open-ils.resolver>
+-->
+
+            <open-ils.permacrud>
+               <keepalive>3</keepalive>
+               <stateless>1</stateless>
+               <language>perl</language>
+               <implementation>OpenILS::Application::PermaCrud</implementation>
+               <max_requests>17</max_requests>
+               <unix_config>
+                  <unix_sock>open-ils.permacrud_unix.sock</unix_sock>
+                  <unix_pid>open-ils.permacrud_unix.pid</unix_pid>
+                  <max_requests>1000</max_requests>
+                  <unix_log>open-ils.permacrud_unix.log</unix_log>
+                  <min_children>5</min_children>
+                  <max_children>15</max_children>
+                  <min_spare_children>3</min_spare_children>
+                  <max_spare_children>5</max_spare_children>
+               </unix_config>
+            </open-ils.permacrud>
+
+            <open-ils.fielder>
+               <keepalive>3</keepalive>
+               <stateless>1</stateless>
+               <language>perl</language>
+               <implementation>OpenILS::Application::Fielder</implementation>
+               <max_requests>17</max_requests>
+               <unix_config>
+                  <unix_sock>open-ils.fielder_unix.sock</unix_sock>
+                  <unix_pid>open-ils.fielder_unix.pid</unix_pid>
+                  <max_requests>1000</max_requests>
+                  <unix_log>open-ils.fielder_unix.log</unix_log>
+                  <min_children>5</min_children>
+                  <max_children>15</max_children>
+                  <min_spare_children>3</min_spare_children>
+                  <max_spare_children>5</max_spare_children>
+               </unix_config>
+            </open-ils.fielder>
+
+            <open-ils.vandelay>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Vandelay</implementation>
+                <max_requests>100</max_requests>
+                <unix_config>
+                    <unix_sock>vandelay_unix.sock</unix_sock>
+                    <unix_pid>vandelay_unix.pid</unix_pid>
+                    <unix_log>vandelay_unix.log</unix_log>
+                    <max_requests>100</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                    <databases>
+                        <!-- temporary location for MARC import files.  
+                            Files will be deleted after records are spooled.
+                            *note:  in a multi-brick environment, this will need to
+                            be on a write-able NFS share.  -->
+                        <importer>/openils/var/data/offline/vandelay</importer>
+                    </databases>
+                </app_settings>
+            </open-ils.vandelay>
+
+            <open-ils.serial>
+                <keepalive>3</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Serial</implementation>
+                <max_requests>17</max_requests>
+                <unix_config>
+                    <unix_sock>open-ils.serial_unix.sock</unix_sock>
+                    <unix_pid>open-ils.serial_unix.pid</unix_pid>
+                    <max_requests>1000</max_requests>
+                    <unix_log>open-ils.serial_unix.log</unix_log>
+                    <min_children>5</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>3</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                </app_settings>
+            </open-ils.serial>
+
+        </apps>
+    </default>
+
+    <hosts>
+
+            <!-- ^-=- 
+            Should match the fully qualified domain name of the host.
+
+            On Linux, the output of the following command is authoritative:
+            $ perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";'
+
+            To use 'localhost' instead, run osrf_ctl.sh with the -l flag
+            -->
+
diff --git a/templates/opensrf.xml/version b/templates/opensrf.xml/version
new file mode 100644 (file)
index 0000000..fe5a178
--- /dev/null
@@ -0,0 +1 @@
+updated to 2.1.0 Wed Oct 19 12:54:14 EDT 2011
diff --git a/templates/opensrf_core.xml b/templates/opensrf_core.xml
new file mode 100644 (file)
index 0000000..5a5c8f2
--- /dev/null
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<!-- 
+Example OpenSRF bootstrap configuration file for Evergreen
+-->
+<config>
+  <!-- Options for <loglevel>: 0 None, 1 Error, 2 Warning, 3 Info, 4 debug -->
+  <opensrf>
+    <routers>
+
+      <!-- define the list of routers our services will register with -->
+      <router>
+        <!-- 
+          This is the public router.  On this router, we only register
+          applications which should be accessible to everyone on the OpenSRF
+          network
+        -->
+        <name>router</name>
+        <domain>public.Brick_head_Fqdn</domain>
+
+        <services>
+          <service>opensrf.math</service>
+          <service>open-ils.actor</service>
+          <service>open-ils.acq</service>
+          <service>open-ils.auth</service>
+          <!-- <service>open-ils.booking</service> -->
+          <service>open-ils.cat</service>
+          <service>open-ils.circ</service>
+          <service>open-ils.collections</service>
+          <service>open-ils.fielder</service>
+          <service>open-ils.pcrud</service>
+          <service>open-ils.permacrud</service>
+          <service>open-ils.reporter</service>
+          <!-- <service>open-ils.resolver</service> -->
+          <service>open-ils.search</service>
+          <service>open-ils.supercat</service>
+          <service>open-ils.vandelay</service>
+          <service>open-ils.serial</service>
+        </services>
+      </router>
+
+      <router>
+        <!--
+          This is the private router.  All applications must register with 
+          this router, so no explicit <services> section is required
+        -->
+        <name>router</name>
+        <domain>private.Brick_head_Fqdn</domain>
+      </router>
+    </routers>
+
+    <!-- Our domain should match that of the private router -->
+    <domain>private.Brick_head_Fqdn</domain>
+    <username>opensrf</username>
+    <passwd>OpenSRF_Password</passwd>
+    <port>5222</port>
+
+    <!-- 
+      Name of the router used on our private domain.  
+      This should match one of the <name> of the private router above.
+     -->
+    <router_name>router</router_name>
+
+    <!-- <logfile>/openils/var/log/osrfsys.log</logfile> -->
+      <logfile>syslog</logfile>
+      <syslog>local0</syslog>
+      <actlog>local1</actlog>
+    <loglevel>3</loglevel>
+    <settings_config>/openils/conf/opensrf.xml</settings_config>
+  </opensrf>
+  <!-- 
+    The section between <gateway>...</gateway> is a standard OpenSRF C
+    stack configuration file
+  -->
+  <gateway>
+    <client>true</client>
+    <router_name>router</router_name>
+
+    <!-- The gateway connects to the public domain for security -->
+    <domain>public.Brick_head_Fqdn</domain>
+
+    <!-- This section will be soon deprecated for multi-domain mode... -->
+    <services>
+      <service>opensrf.math</service>
+      <service>opensrf.dbmath</service>
+      <service>open-ils.cat</service>
+      <service>open-ils.search</service>
+      <service>open-ils.circ</service>
+      <service>open-ils.actor</service>
+      <service>open-ils.auth</service>
+      <service>open-ils.collections</service>
+      <service>open-ils.reporter</service>
+    </services>
+
+    <!-- jabber login info -->
+    <username>opensrf</username>
+    <passwd>OpenSRF_Password</passwd>
+    <port>5222</port>
+    <loglevel>3</loglevel>
+    <!-- <logfile>/openils/var/log/gateway.log</logfile> -->
+      <logfile>syslog</logfile>
+      <syslog>local6</syslog>
+      <actlog>local1</actlog>
+  </gateway>
+  <!-- ======================================================================================== -->
+  <routers>
+    <router>
+      <!-- public router -->
+      <trusted_domains>
+        <!-- 
+          Allow private services to register with this router 
+          and public client to send requests to this router. 
+        -->
+        <server>private.Brick_head_Fqdn</server>
+
+        <!-- 
+          Also allow private clients to send to the router so it
+          can receive error messages
+        -->
+        <client>private.Brick_head_Fqdn</client>
+        <client>public.Brick_head_Fqdn</client>
+
+      </trusted_domains>
+      <transport>
+        <server>public.Brick_head_Fqdn</server>
+        <port>5222</port>
+        <unixpath>/openils/var/sock/unix_sock</unixpath>
+        <username>router</username>
+        <password>OpenSRF_Password</password>
+        <resource>router</resource>
+        <connect_timeout>10</connect_timeout>
+        <max_reconnect_attempts>5</max_reconnect_attempts>
+      </transport>
+      <!-- <logfile>/openils/var/log/router-public.log</logfile> -->
+        <logfile>syslog</logfile>
+        <syslog>local2</syslog>
+      <loglevel>2</loglevel>
+    </router>
+    <router>
+      <!-- private router -->
+      <trusted_domains>
+        <server>private.Brick_head_Fqdn</server>
+        <!-- 
+          Only clients on the private domain can send requests to this router
+         -->
+        <client>private.Brick_head_Fqdn</client>
+      </trusted_domains>
+      <transport>
+        <server>private.Brick_head_Fqdn</server>
+        <port>5222</port>
+        <username>router</username>
+        <password>OpenSRF_Password</password>
+        <resource>router</resource>
+        <connect_timeout>10</connect_timeout>
+        <max_reconnect_attempts>5</max_reconnect_attempts>
+      </transport>
+      <!-- <logfile>/openils/var/log/router-private.log</logfile> -->
+        <logfile>syslog</logfile>
+        <syslog>local2</syslog>
+      <loglevel>2</loglevel>
+    </router>
+  </routers>
+  <!-- ======================================================================================== -->
+</config>
diff --git a/templates/resolv.conf b/templates/resolv.conf
new file mode 100644 (file)
index 0000000..93a95b3
--- /dev/null
@@ -0,0 +1,6 @@
+search CLUSTER_DOMAIN_NAME
+domain CLUSTER_DOMAIN_NAME
+nameserver Cluster_Priv_IP
+nameserver LVS01_Priv_IP
+nameserver LVS02_Priv_IP
+
diff --git a/templates/rsyslog.conf b/templates/rsyslog.conf
new file mode 100644 (file)
index 0000000..0c88790
--- /dev/null
@@ -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/setup-drone.sh b/templates/setup-drone.sh
new file mode 100755 (executable)
index 0000000..cf3d0d3
--- /dev/null
@@ -0,0 +1,215 @@
+#!/bin/bash
+
+#TODO: export GenaSYS version to install logs.
+
+WD=$(dirname $(readlink -f $0))
+EG_VER="_EGVER"
+VERSION="_GENVER"
+
+### Setup colors.
+## Normal colors.
+ESC_SEQ="\x1b["
+COL_RESET=$ESC_SEQ"39;49;00m"
+COL_RED=$ESC_SEQ"0;31m"
+COL_GREEN=$ESC_SEQ"0;32m"
+COL_YELLOW=$ESC_SEQ"0;33m"
+COL_BLUE=$ESC_SEQ"0;34m"
+COL_MAGENTA=$ESC_SEQ"0;35m"
+COL_CYAN=$ESC_SEQ"0;36m"
+
+## Bright colors.
+COL_BR_RED=$ESC_SEQ"1;31m"
+COL_BR_GREEN=$ESC_SEQ"1;32m"
+COL_BR_YELLOW=$ESC_SEQ"1;33m"
+COL_BR_BLUE=$ESC_SEQ"1;34m"
+COL_BR_MAGENTA=$ESC_SEQ"1;35m"
+COL_BR_CYAN=$ESC_SEQ"1;36m"
+
+if [ "$(id -u)" != "0" ] # Check if we are root
+        then 
+        echo "You must be root to setup Evergreen $EG_VER"
+        exit 1
+fi
+
+if [ ! -e drone_file.tar.gz ] # Check if config files exist
+        then
+        echo "FATAL! drone_file.tar.gz is missing or "
+        echo " is not in this directory"
+        echo "cannot continue without it"
+        echo " exiting..."
+        echo
+        exit 2
+fi
+
+if [ ! -d debs ] # Check if debs exist
+        then
+        echo "FATAL! debs folder is missing or "
+        echo " is not in this directory"
+        echo "cannot continue without it"
+        echo " exiting..."
+        echo
+        exit 3
+fi
+
+INSTALL_LOG="/var/log/genasys_install.log"
+if [ -e $INSTALL_LOG ]
+        then
+        echo
+        echo "This program has been previously"
+        echo "executed on this system"  
+        if [ -e .osrf_node ]
+                then
+                if [ ! -e debconf-settings ]
+                        then
+                        echo
+                        echo "The credentials file has been deleted"
+                        echo "on the previous run extracting credentials file."
+                        echo "Please re-extracting the credentials file"
+                        if ! ../setup_tar_file.tar.gz -C . setup_tar_file/debconf-settings
+                                then
+                                echo
+                                echo "failed to re-extract credentials file"
+                                echo "cannot continue without it."
+                                exit 4
+                        fi
+                fi
+        fi
+fi
+
+echo "Evergreen Drone configurator"
+echo
+echo "This host MUST have working internet access and DNS configured"
+echo "to continue!!"
+echo
+echo "This will reconfigure this system as a drone for Evergreen $EG_VER"
+echo "Are you sure you want to do this?"
+read -p "Press [Enter] to continue [Ctrl-C] to cancel"
+echo
+echo "You MUST REBOOT this system for the changes to TAKE EFFECT."
+echo "Starting Setup....."
+sleep 5
+echo
+
+echo $(date) >> "$INSTALL_LOG"
+echo "Setting Hostname"
+sleep 2
+echo "drone_file" > /etc/hostname
+tar zxvf drone_file_etc-hosts.tar.gz -C /
+sed -i 's/^domain.*/domain CLUSTER_DOMAINNAME/g' /etc/resolv.conf
+sed -i 's/^search.*/search CLUSTER_DOMAINNAME/g' /etc/resolv.conf
+/etc/init.d/hostname.sh
+
+echo "deb http://backports.debian.org/debian-backports squeeze-backports main contrib" > /etc/apt/sources.list.d/backports.list;PKG_SET=$?
+
+InstallDebs () { # install included debian packages
+# add new cpan stuff thats not listed as a dependency but it is.
+PERL_MM_USE_DEFAULT=1 cpan Net::IP
+PERL_MM_USE_DEFAULT=1 cpan Business::CreditCard::Object
+# setup simpleserver manually because it broken in cpan
+if [ -e Net-Z3950-SimpleServer-1.12.tar.gz ]
+        then
+        echo
+        echo "Setting up Net-Z3950-SimpleServer manually"
+        echo "because its broken in cpan."
+        echo
+        sleep 2
+        apt-get update && apt-get install -y make libyaz-dev
+       # add new cpan stuff thats not listed as a dependency but it is.
+       PERL_MM_USE_DEFAULT=1 cpan Net::IP
+       PERL_MM_USE_DEFAULT=1 cpan Business::CreditCard::Object
+        tar zxvf Net-Z3950-SimpleServer-1.12.tar.gz && \
+        cd Net-Z3950-SimpleServer-1.12 && \
+        perl Makefile.PL && \
+        make &&
+        make install
+        cd $WD 
+                else
+                echo
+                echo "Could NOT find Net-Z3950-SimpleServer-1.12.tar.gz"
+                echo "You will need to install it manually."
+                sleep 4
+fi
+# install debs
+./debconf-settings && \
+rm debconf-settings && \
+cd debs && \
+apt-get update && \
+gdebi --n opensrf*.deb && \
+gdebi --n libdbi_*.deb && \
+gdebi --n libdbi-drivers*.deb && \
+gdebi --n spidermonkey_*.deb && \
+gdebi --n spidermonkey-perl*.deb && \
+gdebi --n evergreen-ils*.deb
+cd ..
+chown -R opensrf:opensrf /openils
+}
+
+
+if [ -e drone_file_apt.list ]
+        then
+       echo "Installing Depdencies"
+        sleep 2
+       apt-get update
+       [ "$PKG_SET" = "0" ] && aptitude -t squeeze-backports -yq install libpq5 libpq-dev postgresql-client-9.0
+        apt-get update && apt-get -y install $(cat drone_file_apt.list)
+fi
+
+if [ -e debconf-settings ]
+        then
+       echo "Installing OpenSRF and Evergreen"
+        sleep 2
+        if ! dpkg -l | grep -q evergreen-ils
+                then
+                InstallDebs
+                        else
+                        echo  "Evergreen debs are already installed." 
+                        read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
+                        if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
+                                then 
+                                InstallDebs
+                        fi
+        fi
+fi
+
+echo "Installing system files"
+sleep 2
+tar zxvf drone_file.tar.gz -C /
+
+echo "Setting up fstab for drones"
+sleep 2
+cat /etc/eg_fstab_drone >> /etc/fstab
+
+echo "Setting up logging to loghost"
+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
+fi
+
+AutoGen () { # Run autogen
+echo "Restarting OpenSRF..."
+echo
+sleep 1
+/etc/init.d/opensrf restart
+echo "Running autogen..."
+echo
+sleep 1
+/etc/init.d/opensrf autogen
+echo "Restarting OpenSRF again..."
+echo
+sleep 1
+/etc/init.d/opensrf restart
+}
+
+echo
+echo "Done! This system is now a drone"
+echo hostname for this drone is $(cat /etc/hostname)
+
+echo
+echo "Please reboot this node for the changes to take effect."
+
diff --git a/templates/setup-head.sh b/templates/setup-head.sh
new file mode 100755 (executable)
index 0000000..5989204
--- /dev/null
@@ -0,0 +1,366 @@
+#!/bin/bash
+
+#TODO: export GenaSYS version to install log.
+
+### Setup aliases for root because debian fails to do so.
+#echo "# Evergreen modifications below" >> /root/.bashrc
+#echo "alias ls='ls --color -F'" >> /root/.bashrc
+
+WD=$(dirname $(readlink -f $0))
+EG_VER="_EGVER"
+VERSION="_GENVER"
+
+### Setup colors.
+## Normal colors.
+ESC_SEQ="\x1b["
+COL_RESET=$ESC_SEQ"39;49;00m"
+COL_RED=$ESC_SEQ"0;31m"
+COL_GREEN=$ESC_SEQ"0;32m"
+COL_YELLOW=$ESC_SEQ"0;33m"
+COL_BLUE=$ESC_SEQ"0;34m"
+COL_MAGENTA=$ESC_SEQ"0;35m"
+COL_CYAN=$ESC_SEQ"0;36m"
+
+## Bright colors.
+COL_BR_RED=$ESC_SEQ"1;31m"
+COL_BR_GREEN=$ESC_SEQ"1;32m"
+COL_BR_YELLOW=$ESC_SEQ"1;33m"
+COL_BR_BLUE=$ESC_SEQ"1;34m"
+COL_BR_MAGENTA=$ESC_SEQ"1;35m"
+COL_BR_CYAN=$ESC_SEQ"1;36m"
+
+
+if [ "$(id -u)" != "0" ] # Check if we are root.
+       then 
+       echo "You must be root to setup Evergreen $EG_VER"
+       exit 1
+fi
+
+if [ ! -e head_file.tar.gz ] # Check if config files exist.
+        then
+        echo "FATAL! head_file.tar.gz is missing or "
+        echo " is not in this directory"
+        echo "cannot continue without it"
+        echo " exiting..."
+        echo
+        exit 2
+fi
+
+if [ ! -d debs ] # Check if debs exist.
+       then
+       echo "FATAL! debs folder is missing or "
+        echo " is not in this directory"
+        echo "cannot continue without it"
+        echo " exiting..."
+        echo
+        exit 3
+fi
+
+Prep_DB_8_4 () { #Prepare the database schema
+eg_db_config.pl --update-config \
+ --service all --create-schema --create-offline \
+ --user EG_DB_USER --password EG_DB_PASSWORD --hostname db01.CLUSTER_DOMAINNAME --port 5432 \
+ --database evergreen --admin-user EG_ADMIN_USER --admin-pass EG_ADMIN_PASS
+
+}
+
+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 \
+ --database evergreen --admin-user EG_ADMIN_USER --admin-pass EG_ADMIN_PASS
+
+}
+
+
+INSTALL_LOG="/var/log/genasys_install.log"
+if [ -e $INSTALL_LOG ]
+        then
+        echo
+        echo "This program has been previously"
+        echo "executed on this system"  
+        if [ -e .osrf_node ]
+                then
+                if [ ! -e debconf-settings ]
+                        then
+                        echo
+                        echo "The credentials file has been deleted"
+                        echo "on the previous run extracting credentials file."
+                        echo "Please wait re-extracting the credentials file"
+                        if ! tar zxvf ../setup_head_file.tar.gz -C . setup_head_file/debconf-settings
+                                then
+                                echo
+                                echo "failed to re-extract credentials file"
+                                echo "cannot continue without it."
+                                exit 4
+                        fi
+                fi
+        fi
+fi
+
+echo "Evergreen Head Configurator"
+echo
+echo "This host MUST have working internet access and DNS configured"
+echo "to continue!!"
+echo
+echo "This will reconfigure this system as a head for Evergreen $EG_VER"
+echo "Are you sure you want to do this?"
+read -p "Press [Enter] to continue [Ctrl-C] to cancel"
+echo
+echo "You MUST REBOOT this system for the changes to TAKE EFFECT."
+echo "Starting Setup....."
+sleep 5
+echo
+
+echo $(date) >> "$INSTALL_LOG"
+
+THISHOST="head_file"
+if [ "$THISHOST" = "brick01-head" ]
+       then
+       echo
+       echo "WARNING ** You are setting up the first brick head of the cluster"
+       echo "The network connection will be severed while setting up this host"
+       echo "Please make sure you are running this locally at a console."
+       read -p "Press [Enter] to coninue or [Ctrl]-[c] to quit"
+fi
+
+
+echo "Setting Hostname"
+sleep 2
+echo "head_file" > /etc/hostname
+tar zxvf head_file_etc-hosts.tar.gz -C /
+sed -i 's/^domain.*/domain CLUSTER_DOMAINNAME/g' /etc/resolv.conf
+sed -i 's/^search.*/search CLUSTER_DOMAINNAME/g' /etc/resolv.conf
+/etc/init.d/hostname.sh
+
+echo "deb http://backports.debian.org/debian-backports squeeze-backports main contrib" > /etc/apt/sources.list.d/backports.list;PKG_SET=$?
+
+
+InstallDebs () { # install included debian packages
+# setup simpleserver manually because it broken in cpan
+if [ -e Net-Z3950-SimpleServer-1.12.tar.gz ]
+        then
+        echo
+        echo "Setting up Net-Z3950-SimpleServer manually"
+        echo "because its broken in cpan."
+        echo
+        sleep 2
+        apt-get update && apt-get -y install make libyaz-dev
+       # add new cpan stuff thats not listed as a dependency but it is.
+       PERL_MM_USE_DEFAULT=1 cpan Net::IP
+       PERL_MM_USE_DEFAULT=1 cpan Business::CreditCard::Object
+        tar zxvf Net-Z3950-SimpleServer-1.12.tar.gz && \
+        cd Net-Z3950-SimpleServer-1.12 && \
+        perl Makefile.PL && \
+        make &&
+        make install
+        cd $WD 
+                else
+                echo
+                echo "Could NOT find Net-Z3950-SimpleServer-1.12.tar.gz"
+                echo "You will need to install it manually."
+                sleep 4
+fi
+# install debs
+echo
+echo installing the debs now...
+#tar zxvf head_file.tar.gz -C /etc/apache2 etc/apache2/eg_vhost.conf
+./debconf-settings && \
+rm debconf-settings && \
+cd debs && \
+apt-get update && \
+gdebi --n opensrf*.deb && \
+gdebi --n libdbi_*.deb && \
+gdebi --n libdbi-drivers*.deb && \
+gdebi --n spidermonkey_*.deb && \
+gdebi --n spidermonkey-perl*.deb && \
+gdebi --n evergreen-ils*.deb
+cd ..
+chown -R opensrf:opensrf /openils
+}
+
+
+if [ -e head_file_apt.list ]
+        then
+       echo "Installing Depdencies"
+        sleep 2
+       apt-get update
+       [ "$PKG_SET" = "0" ] && aptitude -t squeeze-backports -yq install libpq5 libpq-dev postgresql-client-9.1
+        apt-get update && apt-get -y install  $(cat head_file_apt.list)
+fi
+
+if [ -e debconf-settings ]
+        then
+       echo "Installing OpenSRF and Evergreen"
+       sleep 2
+        if ! dpkg -l | grep -q evergreen-ils
+                then
+                InstallDebs
+                        else
+                        echo  "Evergreen debs are already installed." 
+                        read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
+                        if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
+                                then
+                                InstallDebs
+                        fi
+        fi
+fi
+
+tar zxvf head_file.tar.gz -C /
+chown -R opensrf:opensrf /openils
+
+# Setup apache2
+a2enmod perl
+a2enmod expires
+a2enmod include
+a2enmod proxy
+a2enmod proxy_http
+a2enmod rewrite
+a2enmod deflate
+
+if [ -e /etc/apache2/sites-enabled/000-default ]
+       then 
+       rm /etc/apache2/sites-enabled/000-default
+fi
+sed -i 's^NameVirtualHost^#NameVirtualHost^g' /etc/apache2/ports.conf
+
+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
+}
+
+sed -i 's/APACHE_RUN_USER=www-data/APACHE_RUN_USER=opensrf/g' /etc/apache2/envvars
+
+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
+fi
+
+# Setup database schema... We do this from the head of the first brick.
+if cat /etc/hostname|grep -q brick01-head
+        then
+       while true; do
+       echo
+       echo "If this is a new installation the database"
+       echo "needs to be prepared for Evergreen from this host."
+       echo 
+       read -p "Prepare the database for Evergreen? [y|n]" POPULATE_DATABASE
+               case $POPULATE_DATABASE in
+               [Yy]* ) echo $yn; break;;
+               [Nn]* ) break;;
+               * ) echo "Please answer yes or no.";;
+               esac
+       done    
+       if [ "$POPULATE_DATABASE" == "y" ] || [ "$POPULATE_DATABASE" == "Y" ]
+               then
+               echo
+               echo "Populating the database"
+               ifconfig eth0 Brick01_Head_IP netmask 255.255.255.0
+               echo
+               echo "Configuring database for Evergreen"
+               echo
+               sleep 2
+                       if ! ping -c2 db01.CLUSTER_DOMAINNAME
+                               then
+                               echo
+                               echo "WARNING. Do not continue until db is up..."
+                               echo
+                               echo "Cannot ping db01.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"
+                               read -p "THEN come back and press [Enter] to continue"
+                               chown -R opensrf:opensrf /openils
+                               Prep_DB_9_X
+                                       else
+                                       chown -R opensrf:opensrf /openils
+                                       Prep_DB_9_X
+                       fi
+        fi
+fi
+
+#
+
+if ! grep -q "NFS Mounts for Evergreen" /etc/fstab 
+       then
+       if [ -e /etc/eg_fstab_head ];then
+               cp -f /etc/fstab /etc/fstab-orig.genasys
+               cat /etc/eg_fstab_head >> /etc/fstab
+       fi
+               else 
+               if [ -e /etc/eg_fstab_head ];then
+                       cp -f /etc/fstab-orig.genasys /etc/fstab
+                       cat /etc/eg_fstab_head >> /etc/fstab
+               fi
+               
+fi
+if [ -e /openils/conf/.oils_brick.cfg ] 
+       then
+       cp /openils/conf/.oils_brick.cfg /home/opensrf/.oils_brick.cfg
+               else
+               echo 
+               echo ".oils_brick.cfg not found. Please create manually"
+               sleep 5
+fi     
+
+#create opensrf offline configuraton.
+su - opensrf -c "/openils/bin/eg_db_config.pl --create-offline"
+
+#setup ldiretor ping file
+echo "pong" > /openils/var/web/ldirectorping.txt-
+chown opensrf:opensrf /openils/var/web/ldirectorping.txt-
+
+if [ -e lib_ips.txt ]
+       echo
+       echo "Enabling lib_ips.txt.."
+       then
+       cp -f lib_ips.txt /openils/conf 
+       chown opensrf:opensrf /openils/conf/lib_ips.txt
+       sed -i 's^#OpenILS::WWW::Redirect^OpenILS::WWW::Redirect^g' /etc/apache2/startup.pl 
+       sed -i 's^#use OpenILS::WWW::Redirect^use OpenILS::WWW::Redirect^g' /etc/apache2/startup.pl
+       sed -i 's+RedirectMatch 301 ^/$ /opac/en-US/skin/default/xml/index.xml+#RedirectMatch 301 ^/$ /opac/en-US/skin/default/xml/index.xml+g' /etc/apache2/eg_vhost.conf
+       sed -i 's+#<LocationMatch ^/$>+<LocationMatch ^/$>+g' /etc/apache2/eg_vhost.conf
+       sed -i 's^#    SetHandler perl-script^    SetHandler perl-script^g' /etc/apache2/eg_vhost.conf
+       sed -i 's^#    PerlHandler OpenILS::WWW::Redirect^    PerlHandler OpenILS::WWW::Redirect^g' /etc/apache2/eg_vhost.conf
+       sed -i 's^#    Options +ExecCGI^    Options +ExecCGI^g' /etc/apache2/eg_vhost.conf
+       sed -i 's^#    PerlSendHeader On^    PerlSendHeader On^g' /etc/apache2/eg_vhost.conf
+       sed -i 's^#    allow from all^    allow from all^g' /etc/apache2/eg_vhost.conf
+       sed -i 's^#</LocationMatch>^</LocationMatch>^g' /etc/apache2/eg_vhost.conf
+fi
+
+
+AutoGen() { #Run Autogen
+echo "Restarting OpenSRF..."
+echo
+sleep 1
+/etc/init.d/opensrf restart
+echo "Running autogen..."
+echo
+sleep 1
+/etc/init.d/opensrf autogen
+echo "Restarting OpenSRF again..."
+echo
+sleep 1
+/etc/init.d/opensrf restart
+}
+
+
+echo
+echo
+echo "Done! This system is now a head"
+echo hostname for this head is $(cat /etc/hostname)
+
+echo 
+echo "This file contains senstive information."
+echo "Secure it or delete it when done."
+
+echo
+echo "Please reboot this node for the changes to take effect."
diff --git a/templates/setup.sh b/templates/setup.sh
new file mode 100755 (executable)
index 0000000..1d21522
--- /dev/null
@@ -0,0 +1,514 @@
+#!/bin/bash
+
+###TODO: export GenaSYS version to install logs.
+
+WD=$(dirname $(readlink -f $0))
+EG_VER="_EGVER"
+VERSION="_GENVER"
+
+### Setup colors.
+### Normal colors.
+ESC_SEQ="\x1b["
+COL_RESET=$ESC_SEQ"39;49;00m"
+COL_RED=$ESC_SEQ"0;31m"
+COL_GREEN=$ESC_SEQ"0;32m"
+COL_YELLOW=$ESC_SEQ"0;33m"
+COL_BLUE=$ESC_SEQ"0;34m"
+COL_MAGENTA=$ESC_SEQ"0;35m"
+COL_CYAN=$ESC_SEQ"0;36m"
+
+### Bright colors.
+COL_BR_RED=$ESC_SEQ"1;31m"
+COL_BR_GREEN=$ESC_SEQ"1;32m"
+COL_BR_YELLOW=$ESC_SEQ"1;33m"
+COL_BR_BLUE=$ESC_SEQ"1;34m"
+COL_BR_MAGENTA=$ESC_SEQ"1;35m"
+COL_BR_CYAN=$ESC_SEQ"1;36m"
+
+
+### Setup aliases for root because debian fails to do so.
+echo "# Evergreen modifications below" >> /root/.bashrc
+echo "alias ls='ls --color -F'" >> /root/.bashrc
+
+if [ "$(id -u)" != "0" ] ### Check if we are root.
+       then 
+       echo "You must be root to setup Evergreen $EG_VER"
+       exit 1
+fi
+
+if [ ! -e tar_file.tar.gz ] ### Check if config files exist.
+        then
+        echo "FATAL! tar_file.tar.gz is missing or "
+        echo " is not in this directory"
+        echo "cannot continue without it"
+        echo " exiting..."
+        echo
+        exit 2
+fi
+
+### Check if install log exists.
+INSTALL_LOG="/var/log/genasys_install.log"
+if [ -e $INSTALL_LOG ]
+       then
+       echo
+       echo "This program has been previously"
+       echo "executed on this system"  
+       if [ -e .osrf_node ]
+               then
+               if [ ! -e debconf-settings ] ### Check if the file debconf-settings exits and warn if not
+                       then
+                       echo
+                       echo "The credentials file has been deleted"
+                       echo "on the previous run extracting credentials file."
+                       echo "Re-extracting the credentials file"
+                       if ! tar zxvf ../setup_tar_file.tar.gz -C . setup_tar_file/debconf-settings
+                               then
+                               echo
+                               echo "failed to re-extract credentials file"
+                               echo "cannot continue without it."
+                               exit 3
+                       fi
+               fi
+       fi
+fi
+
+echo
+echo -e $COL_GREEN"GenaSYS $VERSION"$COL_RESET
+echo "Evergreen Node Configurator"
+echo
+echo "This host MUST have working internet access and DNS configured"
+echo "to continue!!"
+echo
+echo "This will reconfigure this system for Evergreen $EG_VER"
+echo "Are you sure you want to do this?"
+read -p "Press [Enter] to continue [Ctrl-C] to cancel"
+echo
+echo "You MUST REBOOT this system for the changes to TAKE EFFECT."
+echo "Starting Setup....."
+sleep 5
+echo
+
+### Set hostname.
+echo "Setting Hostname"
+sleep 2
+echo "tar_file" > /etc/hostname
+/etc/init.d/hostname.sh
+
+### xtract /etc/hosts files.
+tar zxvf tar_file_etc-hosts.tar.gz -C /
+
+### Fixup /etc/resolv.conf
+sed -i 's/^domain.*/domain CLUSTER_DOMAINNAME/g' /etc/resolv.conf
+sed -i 's/^search.*/search CLUSTER_DOMAINNAME/g' /etc/resolv.conf
+
+### Add backports.
+echo "deb http://backports.debian.org/debian-backports squeeze-backports main contrib" > /etc/apt/sources.list.d/backports.list;PKG_SET=$?
+
+
+if cat /etc/hostname | grep "sip\|utility" ### Check if this is a non-brick OpenSRF node.
+        then
+        if [ ! -d debs ] ### Check if debs exist.
+                then
+               OSRF_NODE="1"
+                echo "FATAL! debs folder is missing or "
+                echo " is not in this directory"
+                echo "cannot continue without it"
+                echo "exiting..."
+                echo
+                exit 4
+        fi
+fi
+
+
+InstallDebs () { ### install included debian packages
+### setup simpleserver manually because it broken in cpan
+if [ -e Net-Z3950-SimpleServer-1.12.tar.gz ]
+       then
+       echo
+       echo "Setting up Net-Z3950-SimpleServer manually"
+       echo "because its broken in cpan."
+       echo
+       sleep 2
+       apt-get update && apt-get -y install make libyaz-dev
+       ### add new cpan stuff thats not listed as a dependency but it is.
+       PERL_MM_USE_DEFAULT=1 cpan Net::IP
+       PERL_MM_USE_DEFAULT=1 cpan Business::CreditCard::Object
+       tar zxvf Net-Z3950-SimpleServer-1.12.tar.gz && \
+       cd Net-Z3950-SimpleServer-1.12 && \
+       perl Makefile.PL && \
+       make &&
+       make install 
+       cd $WD
+               else
+               echo
+               echo "Could NOT find Net-Z3950-SimpleServer-1.12.tar.gz"
+               echo "You will need to install it manually."
+               sleep 4
+fi
+
+### install debs
+./debconf-settings && \
+rm debconf-settings && \
+cd debs && \
+apt-get update && \
+gdebi --n opensrf*.deb && \
+gdebi --n libdbi_*.deb && \
+gdebi --n libdbi-drivers*.deb && \
+gdebi --n spidermonkey_*.deb && \
+gdebi --n spidermonkey-perl*.deb && \
+gdebi --n evergreen-ils*.deb
+cd ..
+chown -R opensrf:opensrf /openils
+}
+
+Install_DB_Deps() { ### Install Additional Database dependencies.
+aptitude -y install gcc libxml-libxml-perl libxml-libxslt-perl && \
+PERL_MM_USE_DEFAULT=1 cpan Business::ISBN && \
+PERL_MM_USE_DEFAULT=1 cpan JSON::XS && \
+PERL_MM_USE_DEFAULT=1 cpan Library::CallNumber::LC && \
+PERL_MM_USE_DEFAULT=1 cpan MARC::Record && \
+PERL_MM_USE_DEFAULT=1 cpan UUID::Tiny && \
+PERL_MM_USE_DEFAULT=1 cpan MARC::File::XML 
+}
+
+
+Init_DB_8_4() { ### Initialize the database
+### Check if database exists.
+if su - postgres -c "createdb -T template0 --lc-ctype=C --lc-collate=C -E UNICODE evergreen" > /dev/null 2>&1
+        then
+                echo "Setting up the evergreen database"
+                su - postgres -c "createlang plperl evergreen"
+                su - postgres -c "createlang plperlu evergreen"
+                su - postgres -c "createlang plpgsql evergreen"
+                su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/tablefunc.sql evergreen"
+                su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/tsearch2.sql evergreen"
+                su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/pgxml.sql evergreen"
+        else
+                echo "evergreen database already exists! not doing anything."
+fi
+}
+
+Init_DB_9() { ### Initialize the database.
+### Check if database exists.
+if su - postgres -c "createdb -T template0 --lc-ctype=C --lc-collate=C -E UNICODE evergreen" > /dev/null 2>&1
+        then
+                echo "Setting up the evergreen database"
+               chown postgres:postgres create_database.sql
+               su postgres -c "psql -vdb_name=evergreen -vcontrib_dir=`pg_config --sharedir`/contrib -f create_database.sql"
+        else
+                echo "evergreen database already exists! not doing anything."
+fi
+}
+
+
+Add_EG_DB_User() { ### Add the database user for Evergreen.
+if [ `su - postgres -c "psql -A -t -c \"select count(*) from pg_roles where rolname='evergreen'\""` = "0" ]
+        then
+               echo "Database user evergreen doesn't exist! Creating..."
+                chown postgres.postgres create_db_user.sql
+                su postgres -c "psql -f create_db_user.sql"
+                rm create_db_user.sql
+                echo "Set db user's password"
+
+fi
+}
+
+### Update Install log.
+echo $(date) >> "$INSTALL_LOG"
+echo "$EG_VER" >> "$INSTALL_LOG"
+echo "$VERSION" >> "$INSTALL_LOG"
+
+
+### Install dependencies
+if [ -e tar_file_apt.list ]
+       then
+       echo "Installing Depdencies"
+       sleep 2
+       apt-get update && apt-get -y install $(cat tar_file_apt.list)
+fi
+
+### Install Opensrf and Evergreen debs
+if [ -e debconf-settings ]
+        then
+       echo "Installing OpenSRF and Evergreen"
+       echo
+        sleep 2
+       if ! dpkg -l | grep -q evergreen-ils
+               then
+               apt-get update
+               [ "$PKG_SET" = "0" ] && aptitude -t squeeze-backports -yq install libpq5 libpq-dev postgresql-client-9.1
+               InstallDebs
+                       else
+                       echo  "Evergreen debs are already installed." 
+                       read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
+                       if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
+                               then 
+                               InstallDebs
+                       fi
+       fi
+fi
+
+
+### Setup LVS servers
+if cat /etc/hostname|grep -q lvs0; then
+echo "Setting up lvs servers"
+echo "CONFIG_FILE=/etc/ha.d/ldirectord.cf" >> /etc/default/ldirectord
+cat > named_options.txt << EOF
+
+logging {
+category lame-servers {null; };
+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 ! 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           
+               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
+
+fi
+}
+
+### Setup DB #and repoter
+if cat /etc/hostname|grep -q db0 #|| cat /etc/hostname|grep -q reporter0
+        then
+        if [ -e /etc/sysctl.d ]
+                then
+               echo
+               echo "Setting up database server"
+               sleep 2
+               if [ "$PKG_SET" = "0" ] 
+                       then
+                       apt-get update
+                       if ! aptitude -t squeeze-backports -yq install postgresql-9.1 postgresql-contrib-9.1 postgresql-plperl-9.1 postgresql-server-dev-9.1
+                               then
+                               echo
+                               echo "Failed to setup PostgreSQL... Cannot continue"
+                               exit 5
+                       fi
+                               else
+                               echo
+                               echo "Failed to set the backports repository for installing Postgresql"
+                               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
+               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
+
+        fi
+fi
+
+### Setup Memcache to use 6GB or Memory.
+if cat /etc/hostname|grep -q memcache0
+        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
+fi
+
+### Setup Utility
+if cat /etc/hostname|grep -q utility0; then
+       if ! grep "Customizations For Evergreen" /etc/profile
+       then
+       echo
+       echo "Setting up Utility server tar_file"
+       sleep 2
+chown -R opensrf:opensrf /openils
+
+cat > utility_options.txt << EOF
+
+# Customizations For Evergreen
+export PERL5LIB=/openils/lib/perl5:$PERL5LIB
+export PATH=/openils/bin:$PATH
+export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH
+export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]% \[\033[00m\]'
+export EDITOR="vim"
+alias ls="ls --color=auto"
+EOF
+
+       cat utility_options.txt >> /etc/profile
+       fi
+
+       if [ -e /home/opensrf ]
+               then
+               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
+                       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
+               fi
+       fi
+fi
+
+AutoGen () { ### Run Autogen # this is currently defunct.
+if [ "$OSRF_NODE" = "1" ]
+       then
+       echo "Restarting OpenSRF..."
+       echo
+       sleep 1
+       /etc/init.d/opensrf restart
+       echo "Running autogen..."
+       echo
+       sleep 1
+       /etc/init.d/opensrf autogen
+       echo "Restarting OpenSRF again..."
+       echo
+       sleep 1
+       /etc/init.d/opensrf restart 
+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)
+
+echo
+echo "Please reboot this node for the changes to take effect."
+
+### Setup SIP
+if cat /etc/hostname | grep -q "sip0"
+       then
+       chown -R opensrf:opensrf /opt/SIPServer
+       chown -R opensrf:opensrf /openils
+       echo 
+       echo -e $COL_BR_YELLOW"IMPORTANT **"$COL_GREEN
+        echo "To complete the setup of the SIP service"
+        echo "there are some manual steps that must be taken."
+        echo "First, reboot this host then login and continue the steps in the docs"
+        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
+                       update-rc.d oils_sip defaults
+                               else
+                               echo
+                               echo "/etc/init.d/oils_sip not found"
+                               echo "SIP Server will not start on boot"
+               fi
+       a2dissite eg.conf && a2ensite default
+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
+fi
+
+### Setup offline for all OpenSRF nodes.
+if [ "$OSRF_NODE" = "1" ]
+       then 
+       su - opensrf -c eg_db_config.pl --create-offline
+fi
+
+### Display LVS Notes.
+if cat /etc/hostname | grep -q "lvs0"
+       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
+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
+       cat bashrc-options.txt >> /root/.bashrc
+fi
+
+
diff --git a/templates/setup_brick_to_drone_sshkeys.sh b/templates/setup_brick_to_drone_sshkeys.sh
new file mode 100755 (executable)
index 0000000..ea35d41
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+OPENSRF_HOME="/home/opensrf"
+PUB_KEY="${OPENSRF_HOME}/.ssh/id_rsa.pub"
+
+echo
+echo
+echo
+echo "_______Evergreen Brick SSH Key Configuration________"
+echo
+echo "This will generate a ssh key for this head $(hostname) and"
+echo "copy it to all the drones assigned to this brick."
+echo
+echo "(0) This must be run on the head of each brick"
+echo "(1) The user opensrf *MUST* exist on this head and all the drones for this brick"
+echo "(2) The hostnames for all the drones in this brick *MUST* be resolvable on this head."
+echo "(3) All the drones for this brick *MUST* be reachable with SSH from this head."
+echo
+
+read -p "Press [ENTER] to continue or [Ctrl-C] to quit" CONTINUE
+
+if cat /etc/passwd |grep -q opensrf
+       then
+       if [ ! -e "$PUB_KEY" ]
+               then
+               echo "Generating Key for this head"
+               echo "Leave passphrase blank. just"
+               echo "press [Enter] when prompted."
+               echo
+               sleep 3
+               su - opensrf -c "ssh-keygen -t rsa"
+                       else
+                       echo
+                       echo "Using existing public key"
+                       sleep 1
+                       echo
+       fi
+       
+       for NODE in $(cat brick_drones.txt)
+               do
+               echo
+               echo Setting up SSH keys for OpenSRF node: $NODE
+               echo
+               su - opensrf -c "ssh-copy-id -i $PUB_KEY opensrf@$NODE"
+       done
+               else
+               echo "user opensrf does not exist create the user"
+               echo "before running this program."
+fi
diff --git a/templates/setup_sshkeys.sh b/templates/setup_sshkeys.sh
new file mode 100755 (executable)
index 0000000..56aeaf5
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+OPENSRF_HOME="/home/opensrf"
+PUB_KEY="${OPENSRF_HOME}/.ssh/id_rsa.pub"
+
+echo
+echo
+echo
+echo "_______Evergreen Multi-host SSH Key Configuration________"
+echo
+echo "This will generate a ssh key for this host $(hostname) and"
+echo "copy it to all hosts running OpenSRF in this cluster."
+echo
+echo "(1) The user opensrf *MUST* exist on all the target nodes including this one."
+echo "(2) The hostnames for all the nodes in the cluster *MUST* be resolvable on this host."
+echo "(3) All the nodes *MUST* be reachable with SSH from this host."
+echo
+
+read -p "Press [ENTER] to continue or [Ctrl-C] to quit" CONTINUE
+
+if cat /etc/passwd |grep -q opensrf
+       then
+       if [ ! -e "$PUB_KEY" ]
+               then
+               echo "Generating Key for this host"
+               echo "Leave passphrase blank. just"
+               echo "press [Enter] when prompted."
+               echo
+               sleep 3
+               su - opensrf -c "ssh-keygen -t rsa"
+                       else
+                       echo
+                       echo "Using existing public key"
+                       sleep 1
+                       echo
+       fi
+       
+       for NODE in $(cat opensrf_nodes.txt)
+               do
+               echo
+               echo Setting up SSH keys for OpenSRF node: $NODE
+               echo
+               su - opensrf -c "ssh-copy-id -i $PUB_KEY opensrf@$NODE"
+       done
+               else
+               echo "user opensrf does not exist create the user"
+               echo "before running this program."
+fi
diff --git a/templates/utility/circ_notices.sh b/templates/utility/circ_notices.sh
new file mode 100755 (executable)
index 0000000..14c78fc
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+# ---------------------------------------------------------------
+# This file runs the overdue generation script.
+# If today is Monday, it runs the script for Sat/Sun/Mon, 
+# otherwise it runs once per day.
+# ---------------------------------------------------------------
+
+DATE=$(date +%Y-%m-%d);
+DAY=$(date +%u);
+XML_FILE="/openils/var/data/overdue/overdue.$DATE.xml";
+EMAIL_FILE="/openils/var/data/overdue/combined_email.$DATE.txt";
+PREMAIL_FILE="/openils/var/data/overdue/predue_email.$DATE.txt";
+REMOTE_HOST="sftp.unique-mgmt.com:incoming/"
+SCP_USER="pines"
+
+[ $(whoami) != "opensrf" ] && echo "Must be run as opensrf" && exit 1;
+source /etc/profile;
+
+cd /openils/bin/
+
+ARGS="0"
+
+# PREDUES + EMAIL
+./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types predue --use-email-outfile $PREMAIL_FILE --send-email --days-back $ARGS;
+
+[ $DAY == 6 -o $DAY == 7 ] && exit 0; # don't run overdues on saturday or sunday
+if [ $DAY == 1 ]; then ARGS="0,1,2"; fi; # If today is monday, run for sat/sun/mon
+
+# ALL, NO EMAIL
+#./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types overdue,predue --use-email-outfile $EMAIL_FILE --generate-global-templates --days-back $ARGS > $XML_FILE;
+
+# OVERDUES, NO EMAIL
+#./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types overdue --use-email-outfile /dev/null --generate-global-templates --days-back $ARGS > $XML_FILE;
+
+# ALL + EMAIL
+#./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types overdue,predue --use-email-outfile $EMAIL_FILE --generate-global-templates --send-email --days-back $ARGS > $XML_FILE;
+
+
+# --- overdues first, then predues
+
+# OVERDUES + EMAIL
+#./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types overdue --use-email-outfile $EMAIL_FILE --generate-global-templates --send-email --days-back $ARGS > $XML_FILE;
+./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types overdue --use-email-outfile $EMAIL_FILE --generate-global-templates --days-back $ARGS > $XML_FILE;
+
+# PREDUES + EMAIL
+#./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types predue --use-email-outfile $EMAIL_FILE --send-email --days-back $ARGS;
+
+#scp $XML_FILE home.unique-mgmt.com:~/
+scp $XML_FILE $SCP_USER@$REMOTE_HOST 
+
diff --git a/templates/utility/circ_notices_overdue_nomail.sh b/templates/utility/circ_notices_overdue_nomail.sh
new file mode 100755 (executable)
index 0000000..e66bd1e
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+# ---------------------------------------------------------------
+# This file runs the overdue generation script.
+# If today is Monday, it runs the script for Sat/Sun/Mon, 
+# otherwise it runs once per day.
+# ---------------------------------------------------------------
+
+DATE=$(date +%Y-%m-%d);
+DAY=$(date +%u);
+XML_FILE="/openils/var/data/overdue/overdue.$DATE.xml";
+EMAIL_FILE="/openils/var/data/overdue/combined_email.$DATE.txt";
+
+[ $(whoami) != "opensrf" ] && echo "Must be run as opensrf" && exit 1;
+source /etc/profile;
+
+ARGS="0"
+[ $DAY == 6 -o $DAY == 7 ] && exit 0; # don't run on saturday or sunday
+if [ $DAY == 1 ]; then ARGS="0,1,2"; fi; # If today is monday, run for sat/sun/mon
+
+cd /openils/bin/
+
+# OVERDUES, NO EMAIL
+./generate_circ_notices.pl --osrf_config /openils/conf/opensrf_core.xml --notice-types overdue --generate-global-templates --days-back $ARGS > $XML_FILE;
+
+scp $XML_FILE home.unique-mgmt.com:~/
diff --git a/templates/utility/gen_blocked_list.sh b/templates/utility/gen_blocked_list.sh
new file mode 100755 (executable)
index 0000000..10a6df2
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+. /etc/profile
+cd /home/opensrf/scripts;\
+
+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"
+
+
+#/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
+
+for host in $HEADS; do
+    scp "$FILE" "opensrf@$host:/openils/var/web/standalone/list.txt";
+done;
diff --git a/templates/utility/opensrf-crontab b/templates/utility/opensrf-crontab
new file mode 100644 (file)
index 0000000..2739a2c
--- /dev/null
@@ -0,0 +1,45 @@
+# m h  dom mon dow   command
+# Run the hold targeter
+0,15,30,45 * * * * . /etc/profile && /openils/bin/hold_targeter.pl /openils/conf/opensrf_core.xml
+
+# Run the reshelving completer
+59 3 * * * . /etc/profile && /openils/bin/reshelving_complete.srfsh
+
+# Run the hold thawer
+5 0 * * * . /etc/profile && /openils/bin/thaw_expired_frozen_holds.srfsh
+
+# Generate fines
+30 0 * * * . /etc/profile && /openils/bin/fine_generator.pl /openils/conf/opensrf_core.xml /tmp/generate_fines-LOCK
+
+# Run the hard due date updater
+2 3 * * *   . /etc/profile && /openils/bin/update_hard_due_dates.srfsh
+
+# Nightly action/trigger passive hook event generator
+0 4 * * * . /etc/profile && cd /openils/bin && /usr/bin/perl ./action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --process-hooks --run-pending
+
+
+# Run pending A/T events.
+15,45 * * * * . /etc/profile && cd /openils/bin && /usr/bin/perl ./action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --run-pending
+## Hourly
+0 * * * *   . /etc/profile && /openils/bin/action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --process-hooks --granularity hourly --run-pending 
+## Daily
+5 3 * * *   . /etc/profile && /openils/bin/action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --process-hooks --granularity daily --run-pending
+## Hold Emails
+20,55 * * * * . /etc/profile && cd /openils/bin && /usr/bin/perl ./action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --run-pending --granularity Holds --granularity-only
+
+
+# Truncate the srfsh.log
+40 23 * * * echo > /openils/var/log/srfsh.log
+
+
+
+### Pines Configs ### Uncomment below if running Pines.
+
+### Run the heavy collections API calls
+#10 3 * * sun . /etc/profile && cd /home/opensrf/eg && ./run-collections.sh ###PINES ONLY
+
+### generate overdue notices
+#0 3 * * * . /etc/profile && /home/opensrf/eg/circ_notices.sh ###PINES ONLY
+
+### create the list of blocked patrons for offline use 
+#30 6 * * * cd /home/opensrf/eg && ./gen_blocked_list.sh ###PINES ONLY
diff --git a/templates/utility/run-collections.sh b/templates/utility/run-collections.sh
new file mode 100755 (executable)
index 0000000..6fb6aec
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+DATE=$(date +%Y-%m-%d);
+DIR="collections-$DATE"
+LIBS="ARL ECGR NCLS HALL OHOOP HCLS LEE RML SJRLS TLLS DCPL STRL ROCK HOU CRLS SHRL TCPLS TRRL CPRL WORTH PMRLS CLAYTN"
+USRNAME="berick_circ1"
+PASSWD="demo12321"
+REMOTE_HOST="pines@sftp.unique-mgmt.com:incoming/"
+
+cd ums;
+mkdir $DIR
+
+for lib in $LIBS; do
+    ./run-calls.pl /openils/conf/opensrf_core.xml $USRNAME $PASSWD $lib
+    mv data-$lib $DIR/
+done;
+
+tar cvf $DIR.tar $DIR
+gzip $DIR.tar
+
+echo "scping $DIR.tar.gz...";
+scp $DIR.tar.gz $REMOTE_HOST
+