Debian squeeze evergreen installer script
authorBill Erickson <berick@esilibrary.com>
Mon, 18 Jun 2012 14:55:16 +0000 (10:55 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 18 Jun 2012 16:05:55 +0000 (12:05 -0400)
Mostly there, but still has some work to do.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
installer/wheezy/README [new file with mode: 0644]
installer/wheezy/eg_wheezy_installer.sh [new file with mode: 0755]
installer/wheezy/ejabberd.EG.patch [new file with mode: 0644]
installer/wheezy/evergreen-rsyslog.conf [new file with mode: 0644]
installer/wheezy/evergreen.ld.conf [new file with mode: 0644]

diff --git a/installer/wheezy/README b/installer/wheezy/README
new file mode 100644 (file)
index 0000000..8d2af64
--- /dev/null
@@ -0,0 +1,28 @@
+Author: Bill Erickson <berick@esilibrary.com>
+Copyright: (C) 2009-2012 Equinox Software Inc.
+
+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.
+
+----------------------------------------------------------
+
+Mostly automated "master" install of OpenSRF and Evergreen on Debian.
+
+WARNING: This is for development and evaluation purposes only.  Use at own risk.
+
+Steps:
+    1. Install Debian
+    2. Put these files on the server
+    3. Run the script as root and do what it says
+
+
+
+
+
diff --git a/installer/wheezy/eg_wheezy_installer.sh b/installer/wheezy/eg_wheezy_installer.sh
new file mode 100755 (executable)
index 0000000..9320a7b
--- /dev/null
@@ -0,0 +1,222 @@
+#!/bin/bash
+# -----------------------------------------------------------------------
+# Copyright (C) 2009-2012  Equinox Software Inc.
+# Bill Erickson <berick@esilibrary.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.
+# -----------------------------------------------------------------------
+
+DOJO_VERSION='1.3.3';
+
+# -----------------------------------------------------------------------
+# Change to suit...
+# -----------------------------------------------------------------------
+# If you change the jabber password, you will need to 
+# edit opensrf_core.xml and srfsh.xml accordingly
+JABBER_PASSWORD='password'
+ADMIN_USER='admin';
+ADMIN_PASS='demo123';
+# -----------------------------------------------------------------------
+
+# -----------------------------------------------------------------------
+# force CPAN to load by installing something that should already be installed
+cpan Fcntl
+
+# CPAN follow pre-reqs?
+if [ ! "$(echo 'o conf prerequisites_policy' | cpan | grep follow)" ]; then
+    echo '
+
+-----------------------------------------------------------------------
+The install will go faster if CPAN is configured to automatically install 
+prerequisites.  You can revert the action later with:
+
+echo -e "o conf prerequisites_policy ask\n o conf commit" | cpan 
+'
+    while true; do
+        echo -n 'Automatically install prereqs? [Y/n] ';
+        read X;
+        [ "$X" == 'n' -o "$X" == "N" ] && break;
+        if [ "$X" == 'y' -o "$X" == 'Y' ]; then
+            echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan
+            break;
+        fi;
+    done;
+fi;
+# -----------------------------------------------------------------------
+
+
+# And they're off...
+BASE_DIR=$PWD
+
+# Install some essential tools
+apt-get update; 
+apt-get -yq dist-upgrade;
+apt-get -yq install build-essential automake git psmisc ntp rsyslog;
+
+
+cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/
+ldconfig;
+
+# Configure rsyslog and restart
+cp $BASE_DIR/evergreen-rsyslog.conf /etc/rsyslog.d/evergreen.conf
+/etc/init.d/rsyslog restart
+
+# Create opensrf user and set up environment
+if [ ! "$(grep ^opensrf: /etc/passwd)" ]; then
+    useradd -m -s /bin/bash opensrf
+    echo 'export PATH=/openils/bin:$PATH
+export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH' >> /home/opensrf/.bashrc
+fi;
+
+OSRF_COMMAND='
+cd /home/opensrf;
+git clone git://git.evergreen-ils.org/OpenSRF.git;
+git clone git://git.evergreen-ils.org/Evergreen.git;
+'
+su - opensrf sh -c "$OSRF_COMMAND";
+
+# Install pre-reqs
+mkdir -p /usr/src/evergreen; 
+cd /usr/src/evergreen;
+make -f /home/opensrf/OpenSRF/src/extras/Makefile.install debian-squeeze # XXX s/squeeze/wheezy/ when possible
+make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install debian-wheezy install_pgsql_server_debs_91
+
+# Patch Ejabberd and register users
+if [ ! "$(grep 'public.localhost' /etc/ejabberd/ejabberd.cfg)" ]; then
+    cd /etc/ejabberd/
+    /etc/init.d/ejabberd stop;
+    killall beam epmd; # just in case
+    cp ejabberd.cfg /root/ejabberd.cfg.orig
+    patch -p0 < $BASE_DIR/ejabberd.EG.patch
+    chown ejabberd:ejabberd ejabberd.cfg
+    /etc/init.d/ejabberd start
+    sleep 2;
+    ejabberdctl register router  private.localhost $JABBER_PASSWORD
+    ejabberdctl register opensrf private.localhost $JABBER_PASSWORD
+    ejabberdctl register router  public.localhost  $JABBER_PASSWORD
+    ejabberdctl register opensrf public.localhost  $JABBER_PASSWORD
+fi;
+
+
+
+# Build and install OpenSRF
+OSRF_COMMAND='
+cd /home/opensrf/OpenSRF;
+autoreconf -i;
+./configure --prefix=/openils --sysconfdir=/openils/conf;
+make;'
+
+su - opensrf sh -c "$OSRF_COMMAND"
+cd /home/opensrf/OpenSRF;
+make install
+
+# Build and install the ILS
+OSRF_COMMAND='
+cd /home/opensrf/Evergreen;
+autoreconf -i;
+./configure --prefix=/openils --sysconfdir=/openils/conf;
+make;'
+
+su - opensrf sh -c "$OSRF_COMMAND"
+cd /home/opensrf/Evergreen
+make install
+
+cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml
+cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
+
+# fetch and install Dojo
+cd /tmp;
+wget "http://download.dojotoolkit.org/release-$DOJO_VERSION/dojo-release-$DOJO_VERSION.tar.gz";
+tar -zxf dojo-release-$DOJO_VERSION.tar.gz;
+cp -r dojo-release-$DOJO_VERSION/* /openils/var/web/js/dojo/;
+
+# give it all to opensrf
+chown -R opensrf:opensrf /openils
+
+# copy srfsh config into place
+cp /openils/conf/srfsh.xml.example /home/opensrf/.srfsh.xml;
+chown opensrf:opensrf /home/opensrf/.srfsh.xml;
+
+echo -e "\n\nPlease enter a password for the evergreen database user.\n  If you do not want to edit configs, use \"evergreen\"\n"
+su - postgres sh -c 'createuser -P -s evergreen;'
+
+# Apply the DB schema
+cd /home/opensrf/Evergreen
+perl Open-ILS/src/support-scripts/eg_db_config.pl \
+    --create-database       \
+    --create-schema         \
+    --create-offline        \
+    --update-config         \
+    --service all           \
+    --user evergreen        \
+    --password evergreen    \
+    --hostname localhost    \
+    --database evergreen    \
+    --admin-user $ADMIN_USER \
+    --admin-pass $ADMIN_PASS;
+
+# Copy apache configs into place and create SSL cert
+cp Open-ILS/examples/apache/eg.conf       /etc/apache2/sites-available/
+cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/
+cp Open-ILS/examples/apache/startup.pl    /etc/apache2/
+
+mkdir -p /etc/apache2/ssl;
+if [ ! -f /etc/apache2/ssl/server.key ] ; then
+    echo -e "\n\nConfiguring a new temporary SSL certificate....\n";
+    openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key
+else
+    echo -e "\nkeeping existing ssl/server.key file\n";
+fi
+
+a2enmod ssl  
+a2enmod rewrite
+a2enmod expires 
+a2dissite 000-default
+a2ensite eg.conf
+
+
+if [ ! "$(grep 'public.localhost' /etc/hosts)" ]; then
+    cat <<EOF
+
+* Add these lines to /etc/hosts.
+
+127.0.1.2   public.localhost    public
+127.0.1.3   private.localhost   private
+
+EOF
+
+else
+    echo "INFO: /etc/hosts already has public.localhost line";
+fi
+
+cat <<EOF
+* Start services
+
+su - opensrf
+osrf_ctl.sh -l -a start_router;
+osrf_ctl.sh -l -a start_perl   && sleep 10;
+osrf_ctl.sh -l -a start_c      && sleep  3;
+/openils/bin/autogen.sh /openils/conf/opensrf_core.xml;
+
+* Test the system
+
+# as opensrf user
+echo "request open-ils.cstore open-ils.cstore.direct.actor.user.retrieve 1" | srfsh
+
+* Now finish configuring Apache
+
+1. s/www-data/opensrf/g in envvars
+2. KeepAliveTimeout 1 in apache2.conf
+
+
+EOF
+
+
diff --git a/installer/wheezy/ejabberd.EG.patch b/installer/wheezy/ejabberd.EG.patch
new file mode 100644 (file)
index 0000000..d011b5f
--- /dev/null
@@ -0,0 +1,62 @@
+--- ejabberd.cfg       2010-08-13 16:03:40.000000000 -0400
++++ /tmp/ejabberd.cfg.orig     2010-08-13 16:07:13.000000000 -0400
+@@ -58,7 +58,7 @@
+ {acl, admin, {user, "", "localhost"}}.
+ %% Hostname
+-{hosts, ["localhost"]}.
++{hosts, ["public.localhost", "private.localhost"]}.
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@@ -115,7 +115,7 @@
+   {5222, ejabberd_c2s, [
+                       {access, c2s},
+                       {shaper, c2s_shaper},
+-                      {max_stanza_size, 65536},
++                      {max_stanza_size, 200000},
+                         %%zlib,
+                       starttls, {certfile, "/etc/ejabberd/ejabberd.pem"}
+                      ]},
+@@ -133,7 +133,7 @@
+   {5269, ejabberd_s2s_in, [
+                          {shaper, s2s_shaper},
+-                         {max_stanza_size, 131072}
++                         {max_stanza_size, 200000}
+                         ]},
+   %% External MUC jabber-muc
+@@ -406,12 +406,12 @@
+ %%
+ %% The "normal" shaper limits traffic speed to 1.000 B/s
+ %%
+-{shaper, normal, {maxrate, 1000}}.
++{shaper, normal, {maxrate, 500000}}.
+ %%
+ %% The "fast" shaper limits traffic speed to 50.000 B/s
+ %%
+-{shaper, fast, {maxrate, 50000}}.
++{shaper, normal, {maxrate, 500000}}.
+ %%%   ====================
+@@ -457,7 +457,7 @@
+ %%%   ACCESS RULES
+ %% Define the maximum number of time a single user is allowed to connect:
+-{access, max_user_sessions, [{10, all}]}.
++{access, max_user_sessions, [{5000, all}]}.
+ %% Maximum number of offline messages that users can have:
+ {access, max_user_offline_messages, [{5000, admin}, {100, all}]}. 
+@@ -581,7 +581,7 @@
+                 {max_users, 500}
+                ]},
+   %%{mod_muc_log,[]},
+-  {mod_offline,  [{access_max_user_messages, max_user_offline_messages}]},
++  %%{mod_offline,  [{access_max_user_messages, max_user_offline_messages}]},
+   {mod_privacy,  []},
+   {mod_private,  []},
+   {mod_proxy65,  [
diff --git a/installer/wheezy/evergreen-rsyslog.conf b/installer/wheezy/evergreen-rsyslog.conf
new file mode 100644 (file)
index 0000000..f8cdb21
--- /dev/null
@@ -0,0 +1,46 @@
+# OpenSRF rsyslog configuration file
+# Bill Erickson <berick@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"
+
+# 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"
+
+# Selectors ----------------
+# local0 : OpenSRF
+# local1 : OpenSRF "activity"
+# local2 : OpenSRF router
+# local6 : Apache
+
+local0.* ?osrfsys;msgformat
+local1.* ?activity;msgformat
+local2.* ?router:msgformat
+local3.* ?pg:msgformat
+local6.* ?gateway;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
diff --git a/installer/wheezy/evergreen.ld.conf b/installer/wheezy/evergreen.ld.conf
new file mode 100644 (file)
index 0000000..07233fc
--- /dev/null
@@ -0,0 +1,3 @@
+/openils/lib
+/usr/local/lib
+/usr/local/lib/dbd