[open-ils-commits] r1358 - ESI-Examples/trunk/tools/eg_dev_squeeze_installer (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 14 08:49:31 EDT 2011


Author: erickson
Date: 2011-04-14 08:49:30 -0400 (Thu, 14 Apr 2011)
New Revision: 1358

Modified:
   ESI-Examples/trunk/tools/eg_dev_squeeze_installer/eg_dev_squeeze_installer.sh
   ESI-Examples/trunk/tools/eg_dev_squeeze_installer/opensrf-rsyslog.conf
Log:
updated to install PG 9

forcably fixed PG encoding/locale issues;
cleanup and other minor fixes

Modified: ESI-Examples/trunk/tools/eg_dev_squeeze_installer/eg_dev_squeeze_installer.sh
===================================================================
--- ESI-Examples/trunk/tools/eg_dev_squeeze_installer/eg_dev_squeeze_installer.sh	2011-04-14 02:20:00 UTC (rev 1357)
+++ ESI-Examples/trunk/tools/eg_dev_squeeze_installer/eg_dev_squeeze_installer.sh	2011-04-14 12:49:30 UTC (rev 1358)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # -----------------------------------------------------------------------
-# Copyright (C) 2009  Equinox Software Inc.
-# Bill Erickson <erickson at esilibrary.com>
+# Copyright (C) 2009-2011  Equinox Software Inc.
+# Bill Erickson <berick at esilibrary.com>
 # 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -15,7 +15,7 @@
 # -----------------------------------------------------------------------
 
 DOJO_VERSION='1.3.3';
-PG_VERSION='8.4'; # TODO: Postgres 9.0
+PG_VERSION='9.0'; # TODO: Postgres 9.0
 
 # -----------------------------------------------------------------------
 # Change to suit...
@@ -27,51 +27,36 @@
 ADMIN_PASS='demo123';
 # -----------------------------------------------------------------------
 
+if [ ! "$(grep 'squeeze-backports' /etc/apt/sources.list)" ]; then
+    echo "Please add the following to /etc/apt/sources.list:"
+    echo "deb http://www.backports.org/debian squeeze-backports main contrib non-free"
+    exit;
+fi;
 
 # And they're off...
 BASE_DIR=$PWD
 
-# Make sure the system is configured to use UTF-8.  Otherwise, Postges setup will fail
-if [[ ! $LANG =~ "UTF-8" ]]; then
-    cat <<EOF
-    Your system locale is not configured to use UTF-8.  This will cause problems with the PostgreSQL installation.  
-    
-    Do these steps (replace en_US with your locale):
-
-    1. edit /etc/locale-gen and uncomment this line:
-    en_US.UTF-8 UTF-8
-
-    2. edit /etc/default/locale and set the follow variable:
-    LANG=en_US.UTF-8
-
-    3. run locale-gen
-    4. log out
-    5. log in
-    6. Re-run this script
-EOF
-    exit;
-fi;
-
-
 # Install some essential tools
 apt-get update; 
 apt-get -yq dist-upgrade;
 apt-get -yq install vim build-essential psmisc automake ntpdate subversion rsyslog; 
 
-# XXX: For some reason, when PG is installed with Makefile.install, the initial DB cluster templates 
-# are created with Encoding SQL_ASCII, even though all locale settings (locale, $LANG, etc.) indicate UTF-8.
-# This could be a Squeeze oddity or something going on in this script.
-# Forcing the PG install manually up front avoids the problem.  Go figure.
-apt-get -yq install "postgresql-$PG_VERSION"
-echo "Created PG cluster with databases:"
-su - postgres sh -c "psql -l"
+# Install PG
+apt-get -yq -t squeeze-backports install postgresql-$PG_VERSION postgresql-client-$PG_VERSION postgresql-contrib-$PG_VERSION postgresql-plperl-$PG_VERSION libpq-dev
+# note: using LC_ALL=C above results in template encoding of SQL_ASCII
+echo ""
+echo "This will drop and rebuild Postgres $PG_VERSION cluster 'main'.  Control-c this script if you don't want to lose data.  Enter to continue."
+echo ""
+read X;
+pg_dropcluster --stop $PG_VERSION main
+pg_createcluster --start --encoding=UTF-8 --locale=C $PG_VERSION main
 
 ntpdate pool.ntp.org 
 cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/
 ldconfig;
 
 # Configure rsyslog and restart
-cp $BASE_DIR/opensrf-rsyslog.conf
+cp $BASE_DIR/opensrf-rsyslog.conf /etc/rsyslog.d/evergreen.conf
 /etc/init.d/rsyslog restart
 
 # Create opensrf user and set up environment
@@ -102,9 +87,15 @@
 wget 'http://svn.open-ils.org/trac/ILS/export/HEAD/trunk/Open-ILS/src/extras/Makefile.install' -O Makefile.install.ils
 make -f Makefile.install.osrf debian-squeeze
 make -f Makefile.install.ils  debian-squeeze
-make -f Makefile.install.ils  install_pgsql_server_debs_84
 
+# Class-DBI-Frozen fails some tests.  force install
+cd /root/.cpan/build/Class-DBI-Frozen-301-3.0.1-*;
+perl Makefile.PL
+make;
+make install;
+cd -;
 
+
 # Patch Ejabberd and register users
 if [ ! "$(grep 'public.localhost' /etc/ejabberd/ejabberd.cfg)" ]; then
     cd /etc/ejabberd/
@@ -174,6 +165,7 @@
 createlang plpgsql  evergreen;
 psql -f /usr/share/postgresql/$PG_VERSION/contrib/tablefunc.sql evergreen;
 psql -f /usr/share/postgresql/$PG_VERSION/contrib/tsearch2.sql  evergreen;
+psql -f /usr/share/postgresql/$PG_VERSION/contrib/hstore.sql  evergreen;
 psql -f /usr/share/postgresql/$PG_VERSION/contrib/pgxml.sql     evergreen;"
 su - postgres sh -c "$PG_COMMAND"
 echo -e "\n\nPlease enter a password for the evergreen database user.  If you do not want to edit configs, use \"evergreen\"\n"
@@ -219,27 +211,6 @@
 fi
 
 cat <<EOF
-
-# -----------------------------------------------------------------------
-Notes on upgrading to Postgres 9
-# -----------------------------------------------------------------------
-# stop evergreen and disconnect all db clients
-# Add to /etc/apt/sources.list:
-deb http://www.backports.org/debian squeeze-backports main contrib non-free
-$ apt-get update
-$ pg_dump [db connect args] [db name] > evergreen-backup.sql # backup db (optional)
-$ apt-get -t squeeze-backports install postgresql-9.0 postgresql-client-9.0 postgresql-contrib-9.0 postgresql-plperl-9.0
-$ pg_dropcluster --stop 9.0 main
-$ pg_upgradecluster 8.4 main
-# All done, test with psql
-evergreen=# select version();
-...
-evergreen=# select count(*) from biblio.record_entry;
-...
-# Looks good.  Restart Evergreen/Apache
-$ pg_dropcluster 8.4 main # optional
-# -----------------------------------------------------------------------
-
 * Start services
 
 su - opensrf

Modified: ESI-Examples/trunk/tools/eg_dev_squeeze_installer/opensrf-rsyslog.conf
===================================================================
--- ESI-Examples/trunk/tools/eg_dev_squeeze_installer/opensrf-rsyslog.conf	2011-04-14 02:20:00 UTC (rev 1357)
+++ ESI-Examples/trunk/tools/eg_dev_squeeze_installer/opensrf-rsyslog.conf	2011-04-14 12:49:30 UTC (rev 1358)
@@ -2,7 +2,10 @@
 # Bill Erickson <berick at esilibrary.com>
 # 
 # /etc/rsyslog.d/opensrf-rsyslog.conf
+#
 
+$EscapeControlCharactersOnReceive off
+
 # Message format templates
 # TIMESTAMP:::date-pgsql == YYYY-MM-DD HH:MM:SS
 $template msgformat,"%TIMESTAMP:::date-pgsql% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n"



More information about the open-ils-commits mailing list