From f71c78940cd3e442fbe1e259fd47df75e5e25ff9 Mon Sep 17 00:00:00 2001 From: Josh Stompro Date: Thu, 18 Jun 2015 14:03:22 -0500 Subject: [PATCH] Added Debian Jessie installer based on wheezy installer. Added new ejabberd config patch file for new format. Added a seperate script for only installing opensrf. Signed-off-by: Josh Stompro --- installer/jessie/README | 29 ++ installer/jessie/eg_jessie_installer.sh | 592 ++++++++++++++++++++++++++++++++ installer/jessie/eg_jessie_opensrf.sh | 589 +++++++++++++++++++++++++++++++ installer/jessie/ejabberd.EG.patch | 55 +++ installer/jessie/evergreen.ld.conf | 3 + installer/jessie/installer_installer.sh | 7 + 6 files changed, 1275 insertions(+) create mode 100644 installer/jessie/README create mode 100755 installer/jessie/eg_jessie_installer.sh create mode 100755 installer/jessie/eg_jessie_opensrf.sh create mode 100644 installer/jessie/ejabberd.EG.patch create mode 100644 installer/jessie/evergreen.ld.conf create mode 100755 installer/jessie/installer_installer.sh diff --git a/installer/jessie/README b/installer/jessie/README new file mode 100644 index 000000000..8da9aac78 --- /dev/null +++ b/installer/jessie/README @@ -0,0 +1,29 @@ +Author: Bill Erickson +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 Jessie. + +WARNING: This is for development and evaluation purposes only. Use at own risk. + +Evergreen Install Steps: + 1. Install Debian + 2. Put these files on the server + 3. Run the script as root and do what it says + +OpenSRF only install: + The eg_jessie_opensrf.sh script will stop after installing OpenSRF. + If you want to test installing the release tarballs, or want to customize + your version of Master, but don't want to go through the OpenSRF install + use this command. diff --git a/installer/jessie/eg_jessie_installer.sh b/installer/jessie/eg_jessie_installer.sh new file mode 100755 index 000000000..c4b82858b --- /dev/null +++ b/installer/jessie/eg_jessie_installer.sh @@ -0,0 +1,592 @@ +#!/bin/bash +# ----------------------------------------------------------------------- +# Copyright (C) 2009-2012 Equinox Software Inc. +# Bill Erickson +# +# 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. +# ----------------------------------------------------------------------- + +while getopts ayst option +do + case "${option}" + in + a) AUTOSTART=1;; + y) YES=1;; + s) SAMPLEDATA=--load-all-sample;; + t) LIVETEST=1;; + esac +done + +function my_init { + date + init_variables + configure_cpan + build_essentials + setting_up_opensrf_env + cloning_git_repos + opensrf_prereqs + evergreen_prereqs + evergreen_db_prereqs + setting_ldconfig_and_rsyslog_and_hosts_and_ejabberd + build_opensrf + test_opensrf_build + install_opensrf + build_evergreen + test_evergreen_build + test_and_build_eg_browser_client + install_evergreen + configure_database + configure_apache + if [ $AUTOSTART ]; then + start_evergreen + if [ $LIVETEST ]; then + test_evergreen_live + fi + fi +} + +function init_variables { + echo _.-~= initializing installer + date + # ----------------------------------------------------------------------- + # Handling passed arguments to the script + # ----------------------------------------------------------------------- + export DOJO_VERSION='1.3.3'; + export PATH=/openils/bin:$PATH + export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH + export BASE_DIR=$PWD + echo AUTOSTART=${AUTOSTART} + echo YES=${YES} + echo SAMPLEDATA=${SAMPLEDATA} + echo LIVETEST=${LIVETEST} + echo DOJO_VERSION=${DOJO_VERSION} + echo PATH=${PATH} + echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + echo BASE_DIR=${BASE_DIR} + # ----------------------------------------------------------------------- + # Change to suit... + # ----------------------------------------------------------------------- + # If you change the jabber password, you will need to + # edit opensrf_core.xml and srfsh.xml accordingly + export JABBER_PASSWORD='password' + export ADMIN_USER='admin'; + export ADMIN_PASS='demo123'; + # ----------------------------------------------------------------------- + # You can override these like so: + # EVERGREEN_BRANCH='master' ./eg_jessie_installer.sh + # ----------------------------------------------------------------------- + OPENSRF_REPO='git://git.evergreen-ils.org/OpenSRF.git' + OPENSRF_BRANCH='master' + EVERGREEN_REPO='git://git.evergreen-ils.org/Evergreen.git' + EVERGREEN_BRANCH='master' + echo OPENSRF_REPO=${OPENSRF_REPO} + echo OPENSRF_BRANCH=${OPENSRF_BRANCH} + echo EVERGREEN_REPO=${EVERGREEN_REPO} + echo EVERGREEN_BRANCH=${EVERGREEN_BRANCH} + OPENSRF_PREREQ_TARGET=debian-jessie + EVERGREEN_PREREQ_TARGET=debian-jessie + EVERGREEN_DB_PREREQ_TARGET=postgres-server-debian-jessie + echo OPENSRF_PREREQ_TARGET=${OPENSRF_PREREQ_TARGET} + echo EVERGREEN_PREREQ_TARGET=${EVERGREEN_PREREQ_TARGET} + echo EVERGREEN_DB_PREREQ_TARGET=${EVERGREEN_DB_PREREQ_TARGET} + + export NODEJS_REPO='https://github.com/joyent/node.git' + export NODEJS_VERSION='v0.10.35' + echo "NODEJS_REPO=$NODEJS_REPO" + echo "NODEJS_VERSION=$NODEJS_VERSION" + + echo End of intializing installer =~-._ +} + + +function configure_cpan { + echo _.-~= configure CPAN + date + # ----------------------------------------------------------------------- + # force CPAN to load by installing something that should already be installed + if [ $YES ]; then + yes | cpan Fcntl + else + cpan Fcntl + fi + echo Return Value = $? + # CPAN follow pre-reqs? + if [ ! "$(echo 'o conf prerequisites_policy' | cpan | grep follow)" ]; then + if [ $YES ]; then + + echo "setting cpan prerequisites_policy to follow" + echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan + + else + + 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; + fi; + echo End of configure CPAN =~-._ +} + +function build_essentials { + echo _.-~= Installing some build essentials + date + # Install some essential tools + apt-get update \ + && apt-get -yq dist-upgrade \ + && apt-get -yq install build-essential automake git psmisc ntp rsyslog; + echo Return Value = $? + + if [ $LIVETEST ]; then + cpan TAP::Parser::SourceHandler::pgTAP + echo Return Value = $? + fi; + echo End of Installing some build essentials =~-._ +} + +function setting_up_opensrf_env { + echo _.-~= creating opensrf user and environment + date + # Create opensrf user and set up environment + if [ ! "$(grep ^opensrf: /etc/passwd)" ]; then + useradd -m -s /bin/bash opensrf + echo Return Value = $? + echo 'export PATH=/openils/bin:$PATH' >> /home/opensrf/.bashrc + echo 'export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH' >> /home/opensrf/.bashrc + fi; + echo end of creating opensrf user and environment =~-._ +} + +function cloning_git_repos { + echo _.-~= cloning git repositories + date + OSRF_COMMAND=" + cd /home/opensrf; + git clone --depth 1 --branch $OPENSRF_BRANCH $OPENSRF_REPO OpenSRF; + git clone --depth 1 --branch $EVERGREEN_BRANCH $EVERGREEN_REPO Evergreen; + " + rm -rf /home/opensrf/Evergreen /home/opensrf/OpenSRF + su - opensrf sh -c "$OSRF_COMMAND"; + echo Return Value = $? + + # Show tips + cd /home/opensrf/OpenSRF/ + echo 'Tip of OpenSRF:' `git log --format=oneline | head -1` + cd /home/opensrf/Evergreen/ + echo 'Tip of Evergreen:' `git log --format=oneline | head -1` + + echo End of cloning git repositories =~-._ +} + +function opensrf_prereqs { + echo _.-~= Installing OpenSRF pre-requisites + date + # Install pre-reqs + mkdir -p /usr/src/evergreen; + cd /usr/src/evergreen; + if [ $YES ]; then + yes | make -f /home/opensrf/OpenSRF/src/extras/Makefile.install ${OPENSRF_PREREQ_TARGET} + else + make -f /home/opensrf/OpenSRF/src/extras/Makefile.install ${OPENSRF_PREREQ_TARGET} + fi; + echo Return Value = $? + echo End of Installing OpenSRF pre-requisites =~-._ +} + +function evergreen_prereqs { + echo _.-~= Installing Evergreen pre-requisites + date + if [ $YES ]; then + yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_PREREQ_TARGET} + else + make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_PREREQ_TARGET} + fi; + echo Return Value = $? + echo End of Installing Evergreen pre-requisites =~-._ +} + +function evergreen_db_prereqs { + echo _.-~= Installing Evergreen database pre-requisites + date + if [ $YES ]; then + yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_DB_PREREQ_TARGET} + else + make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_DB_PREREQ_TARGET} + fi; + echo Return Value = $? + echo End of Installing Evergreen database pre-requisites =~-._ +} + +function setting_ldconfig_and_rsyslog_and_hosts_and_ejabberd { + echo _.-~= setting ld.so.conf and rsyslog and /etc/hosts and ejabberd + date + cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/ + ldconfig; + echo Return Value = $? + # Configure rsyslog and restart + cp /home/opensrf/Evergreen/Open-ILS/examples/evergreen-rsyslog.conf /etc/rsyslog.d/evergreen.conf + /etc/init.d/rsyslog restart + echo Return Value = $? + if [ ! "$(grep 'public.localhost' /etc/hosts)" ]; then + + if [ $YES ]; then + echo 'Adding public.localhost and private.localhost to /etc/hosts' + echo '127.0.1.2 public.localhost public' >> /etc/hosts + echo '127.0.1.3 private.localhost private' >> /etc/hosts + else + + cat < /dev/null | sort + echo End of system information =~-._ + date +} + +my_init + + diff --git a/installer/jessie/eg_jessie_opensrf.sh b/installer/jessie/eg_jessie_opensrf.sh new file mode 100755 index 000000000..13e4110bc --- /dev/null +++ b/installer/jessie/eg_jessie_opensrf.sh @@ -0,0 +1,589 @@ +#!/bin/bash +# ----------------------------------------------------------------------- +# Copyright (C) 2009-2012 Equinox Software Inc. +# Bill Erickson +# +# 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. +# ----------------------------------------------------------------------- + +while getopts ayst option +do + case "${option}" + in + a) AUTOSTART=1;; + y) YES=1;; + s) SAMPLEDATA=--load-all-sample;; + t) LIVETEST=1;; + esac +done + +function my_init { + date + init_variables + configure_cpan + build_essentials + setting_up_opensrf_env + cloning_git_repos + opensrf_prereqs +# evergreen_prereqs +# evergreen_db_prereqs + setting_ldconfig_and_rsyslog_and_hosts_and_ejabberd + build_opensrf + test_opensrf_build + install_opensrf +# build_evergreen +# test_evergreen_build +# test_and_build_eg_browser_client +# install_evergreen +# configure_database +# configure_apache + if [ $AUTOSTART ]; then + start_evergreen + if [ $LIVETEST ]; then + test_evergreen_live + fi + fi +} + +function init_variables { + echo _.-~= initializing installer + date + # ----------------------------------------------------------------------- + # Handling passed arguments to the script + # ----------------------------------------------------------------------- + export DOJO_VERSION='1.3.3'; + export PATH=/openils/bin:$PATH + export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH + export BASE_DIR=$PWD + echo AUTOSTART=${AUTOSTART} + echo YES=${YES} + echo SAMPLEDATA=${SAMPLEDATA} + echo LIVETEST=${LIVETEST} + echo DOJO_VERSION=${DOJO_VERSION} + echo PATH=${PATH} + echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + echo BASE_DIR=${BASE_DIR} + # ----------------------------------------------------------------------- + # Change to suit... + # ----------------------------------------------------------------------- + # If you change the jabber password, you will need to + # edit opensrf_core.xml and srfsh.xml accordingly + export JABBER_PASSWORD='password' + export ADMIN_USER='admin'; + export ADMIN_PASS='demo123'; + # ----------------------------------------------------------------------- + # You can override these like so: + # EVERGREEN_BRANCH='master' ./eg_jessie_installer.sh + # ----------------------------------------------------------------------- + OPENSRF_REPO='git://git.evergreen-ils.org/OpenSRF.git' + OPENSRF_BRANCH='master' + EVERGREEN_REPO='git://git.evergreen-ils.org/Evergreen.git' + EVERGREEN_BRANCH='master' + echo OPENSRF_REPO=${OPENSRF_REPO} + echo OPENSRF_BRANCH=${OPENSRF_BRANCH} + echo EVERGREEN_REPO=${EVERGREEN_REPO} + echo EVERGREEN_BRANCH=${EVERGREEN_BRANCH} + OPENSRF_PREREQ_TARGET=debian-jessie + EVERGREEN_PREREQ_TARGET=debian-jessie + EVERGREEN_DB_PREREQ_TARGET=postgres-server-debian-jessie + echo OPENSRF_PREREQ_TARGET=${OPENSRF_PREREQ_TARGET} + echo EVERGREEN_PREREQ_TARGET=${EVERGREEN_PREREQ_TARGET} + echo EVERGREEN_DB_PREREQ_TARGET=${EVERGREEN_DB_PREREQ_TARGET} + + export NODEJS_REPO='https://github.com/joyent/node.git' + export NODEJS_VERSION='v0.10.35' + echo "NODEJS_REPO=$NODEJS_REPO" + echo "NODEJS_VERSION=$NODEJS_VERSION" + + echo End of intializing installer =~-._ +} + + +function configure_cpan { + echo _.-~= configure CPAN + date + # ----------------------------------------------------------------------- + # force CPAN to load by installing something that should already be installed + if [ $YES ]; then + yes | cpan Fcntl + else + cpan Fcntl + fi + echo Return Value = $? + # CPAN follow pre-reqs? + if [ ! "$(echo 'o conf prerequisites_policy' | cpan | grep follow)" ]; then + if [ $YES ]; then + + echo "setting cpan prerequisites_policy to follow" + echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan + + else + + 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; + fi; + echo End of configure CPAN =~-._ +} + +function build_essentials { + echo _.-~= Installing some build essentials + date + # Install some essential tools + apt-get update \ + && apt-get -yq dist-upgrade \ + && apt-get -yq install build-essential automake git psmisc ntp rsyslog; + echo Return Value = $? + + if [ $LIVETEST ]; then + cpan TAP::Parser::SourceHandler::pgTAP + echo Return Value = $? + fi; + echo End of Installing some build essentials =~-._ +} + +function setting_up_opensrf_env { + echo _.-~= creating opensrf user and environment + date + # Create opensrf user and set up environment + if [ ! "$(grep ^opensrf: /etc/passwd)" ]; then + useradd -m -s /bin/bash opensrf + echo Return Value = $? + echo 'export PATH=/openils/bin:$PATH' >> /home/opensrf/.bashrc + echo 'export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH' >> /home/opensrf/.bashrc + fi; + echo end of creating opensrf user and environment =~-._ +} + +function cloning_git_repos { + echo _.-~= cloning git repositories + date + OSRF_COMMAND=" + cd /home/opensrf; + git clone --depth 1 --branch $OPENSRF_BRANCH $OPENSRF_REPO OpenSRF; + " + rm -rf /home/opensrf/Evergreen /home/opensrf/OpenSRF + su - opensrf sh -c "$OSRF_COMMAND"; + echo Return Value = $? + + # Show tips + cd /home/opensrf/OpenSRF/ + echo 'Tip of OpenSRF:' `git log --format=oneline | head -1` + + echo End of cloning git repositories =~-._ +} + +function opensrf_prereqs { + echo _.-~= Installing OpenSRF pre-requisites + date + # Install pre-reqs + mkdir -p /usr/src/evergreen; + cd /usr/src/evergreen; + if [ $YES ]; then + yes | make -f /home/opensrf/OpenSRF/src/extras/Makefile.install ${OPENSRF_PREREQ_TARGET} + else + make -f /home/opensrf/OpenSRF/src/extras/Makefile.install ${OPENSRF_PREREQ_TARGET} + fi; + echo Return Value = $? + echo End of Installing OpenSRF pre-requisites =~-._ +} + +function evergreen_prereqs { + echo _.-~= Installing Evergreen pre-requisites + date + if [ $YES ]; then + yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_PREREQ_TARGET} + else + make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_PREREQ_TARGET} + fi; + echo Return Value = $? + echo End of Installing Evergreen pre-requisites =~-._ +} + +function evergreen_db_prereqs { + echo _.-~= Installing Evergreen database pre-requisites + date + if [ $YES ]; then + yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_DB_PREREQ_TARGET} + else + make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_DB_PREREQ_TARGET} + fi; + echo Return Value = $? + echo End of Installing Evergreen database pre-requisites =~-._ +} + +function setting_ldconfig_and_rsyslog_and_hosts_and_ejabberd { + echo _.-~= setting ld.so.conf and rsyslog and /etc/hosts and ejabberd + date + cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/ + ldconfig; + echo Return Value = $? + # Configure rsyslog and restart + cp /home/opensrf/Evergreen/Open-ILS/examples/evergreen-rsyslog.conf /etc/rsyslog.d/evergreen.conf + /etc/init.d/rsyslog restart + echo Return Value = $? + if [ ! "$(grep 'public.localhost' /etc/hosts)" ]; then + + if [ $YES ]; then + echo 'Adding public.localhost and private.localhost to /etc/hosts' + echo '127.0.1.2 public.localhost public' >> /etc/hosts + echo '127.0.1.3 private.localhost private' >> /etc/hosts + else + + cat < /dev/null | sort + echo End of system information =~-._ + date +} + +my_init + + diff --git a/installer/jessie/ejabberd.EG.patch b/installer/jessie/ejabberd.EG.patch new file mode 100644 index 000000000..959e02fb6 --- /dev/null +++ b/installer/jessie/ejabberd.EG.patch @@ -0,0 +1,55 @@ +--- ejabberd.yml.orig 2015-05-22 11:19:26.000000000 -0500 ++++ ejabberd.yml 2015-05-22 11:14:58.000000000 -0500 +@@ -73,6 +73,8 @@ + ## + hosts: + - "localhost" ++ - "private.localhost" ++ - "public.localhost" + + ## + ## route_subdomains: Delegate subdomains to other XMPP servers. +@@ -106,7 +108,7 @@ + protocol_options: + - "no_sslv3" + ## - "no_tlsv1" +- max_stanza_size: 65536 ++ max_stanza_size: 2000000 + shaper: c2s_shaper + access: c2s + - +@@ -352,12 +354,12 @@ + ## + ## The "normal" shaper limits traffic speed to 1000 B/s + ## +- normal: 1000 ++ normal: 500000 + + ## + ## The "fast" shaper limits traffic speed to 50000 B/s + ## +- fast: 50000 ++ fast: 500000 + + ## + ## This option specifies the maximum number of elements in the queue +@@ -432,7 +434,7 @@ + access: + ## Maximum number of simultaneous sessions allowed for a single user: + max_user_sessions: +- all: 10 ++ all: 10000 + ## Maximum number of offline messages that users can have: + max_user_offline_messages: + admin: 5000 +@@ -559,8 +561,8 @@ + access_persistent: muc_create + access_admin: muc_admin + ## mod_muc_log: {} +- mod_offline: +- access_max_user_messages: max_user_offline_messages ++ ##mod_offline: ++ ## access_max_user_messages: max_user_offline_messages + mod_ping: {} + ## mod_pres_counter: + ## count: 5 diff --git a/installer/jessie/evergreen.ld.conf b/installer/jessie/evergreen.ld.conf new file mode 100644 index 000000000..07233fc95 --- /dev/null +++ b/installer/jessie/evergreen.ld.conf @@ -0,0 +1,3 @@ +/openils/lib +/usr/local/lib +/usr/local/lib/dbd diff --git a/installer/jessie/installer_installer.sh b/installer/jessie/installer_installer.sh new file mode 100755 index 000000000..c353e8b4b --- /dev/null +++ b/installer/jessie/installer_installer.sh @@ -0,0 +1,7 @@ +#!/bin/bash +sudo apt-get -q -y install git-core +git clone git://git.evergreen-ils.org/working/random.git +cd random/ +git checkout -b wheezy origin/collab/phasefx/wheezy_installer +cd installer/jessie +time sudo ./eg_jessie_installer.sh -y -a -s -t -- 2.11.0