install-osrf.sh: set ejabberd host correctly during registration on prod
[sitka/sitka-tools.git] / deployment / update-osrf-eg.sh
CommitLineData
f7c3cb5f
JD
1#!/bin/bash
2HOSTNAME="nonprod"
3DEFAULT_USER="sitkastaff"
4INSTALL_USER="opensrf"
5#EGRELEASE="Evergreen-ILS-2.12.beta"
6#BUILDDIR="/home/${INSTALL_USER}/${EGRELEASE}"
7BUILDDIR="/home/${INSTALL_USER}/evergreen"
8INSTALLDIR="/srv/openils"
9BRANCH="production/sitka_2_12_tpac"
10STAMP_ID="rel_2_12_1"
11ALT_STAMP_IDS="2_12_1 rel_2_12_0 2_12_0 rel_2_12_beta 2_12_beta"
12VERSION="2.12.1.sitka.0"
13SITKACONF="/home/${DEFAULT_USER}/sysadmin"
14SITKACONF_BRANCH="master"
15SITKATOOLS="/root/sitka-tools"
16
17THISHOST=`hostname -s`
18
19suwrap() {
20 su -s /bin/bash -c "source ~/.bashrc ; $1" $2
21}
22
23# as DEFAULT_USER
24if [ ! -d "/home/sitkastaff/sysadmin" ]
25then
26 # this will fail unless DEFAULT_USER has read access to the repo
27 su -c "cd /home/sitkastaff && git clone git+ssh://git@git.sitka.bclibraries.ca/sitka-infra/sysadmin" sitkastaff
28fi
29su -c "cd /home/sitkastaff/sysadmin && git fetch origin && git checkout master && git pull" sitkastaff
30if [ ! -d "home/sitkastaff/opensrf/.git" ] ; then
31 su -c "cd /home/sitkastaff && git clone git://git.evergreen-ils.org/OpenSRF.git opensrf" sitkastaff
32fi
33su -c "cd home/sitkastaff/opensrf && git fetch origin && git checkout rel_2_5 && git pull" sitkastaff
34
35# as root
36echo "Installing OpenSRF prerequisites for Ubuntu..."
37cd home/sitkastaff/opensrf && make -f src/extras/Makefile.install ubuntu-trusty
38
39# as DEFAULT_USER
40echo "Configuring and building OpenSRF..."
41su -c "cd home/sitkastaff/opensrf && autoreconf -i" sitkastaff
42su -c "cd home/sitkastaff/opensrf && ./configure --prefix=/srv/openils --sysconfdir=/srv/openils/conf --with-websockets-port=443" sitkastaff
43su -c "cd home/sitkastaff/opensrf && make" sitkastaff
44
45# as root
46echo "Installing OpenSRF..."
47cd home/sitkastaff/opensrf && make install
48
49# as root
50echo "ldconfig stuff..."
51echo "/srv/openils/lib" > /etc/ld.so.conf.d/opensrf.conf
52ldconfig
53
54#!/bin/bash
55# IMPORTANT! This script assumes you have already installed OpenSRF.
56
57THISHOST=`hostname -s`
58
59# checkout EG source
60if [ ! -d "${BUILDDIR}" ]
61then
62 suwrap "cd /home/${INSTALL_USER} && git clone git://git.sitka.bclibraries.ca/sitka/evergreen evergreen" ${INSTALL_USER}
63fi
64suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${INSTALL_USER}
65
66# as root
67cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-trusty
68cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-trusty-developer # required for web client
69# by default, CPAN needs some manual input at this point; you can just accept all defaults
70
71# web client
72if [[ -n "$WEBCLIENT" ]] ; then
73 cd ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/
74 suwrap "npm install" ${INSTALL_USER}
75 suwrap "bower install" ${INSTALL_USER}
76 suwrap "grunt all" ${INSTALL_USER} || { echo 'Could not install files for web-based staff client' ; exit 1; }
77fi
78
79# as INSTALL_USER
80suwrap "cd ${BUILDDIR} && autoreconf -i" ${INSTALL_USER} # not required for release versions
81suwrap "PATH=${INSTALLDIR}/bin:\$PATH cd ${BUILDDIR} && PATH=${INSTALLDIR}/bin:\$PATH ./configure -C --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf --with-opensrf-headers=${INSTALLDIR}/include/ --with-opensrf-libs=${INSTALLDIR}/lib/" ${INSTALL_USER}
82suwrap "cd ${BUILDDIR} && make" ${INSTALL_USER}
83suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en-CA install" ${INSTALL_USER}
84
85# as root
86mv ${INSTALLDIR}/var/web/reports/fm_IDL.xml ${INSTALLDIR}/var/web/reports/fm_IDL.xml.orig && cp ${INSTALLDIR}/conf/fm_IDL.xml ${INSTALLDIR}/var/web/reports/
87
88WSJSFILES="opensrf_ws.js opensrf_ws_shared.js"
89for WSJSFILE in ${WSJSFILES} ; do
90 # NOTE: this should be unnecessary if we installed OpenSRF with ./configure --with-websockets-port=443
91 sed -i 's/var WEBSOCKET_PORT_SSL = 7682;/var WEBSOCKET_PORT_SSL = 443;/g' ${INSTALLDIR}/lib/javascript/$WSJSFILE
92done
93
94echo 'managing file permissions...'
95for file in `ls -1 ${INSTALLDIR} | grep -v var` ; do chown -R opensrf:opensrf ${INSTALLDIR}/$file ; done
96chown opensrf:opensrf ${INSTALLDIR}/var
97for file in `ls -1 ${INSTALLDIR}/var | egrep -v '(data|tmp|web)'` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/$file ; done
98chown opensrf:opensrf ${INSTALLDIR}/var/data ${INSTALLDIR}/var/web
99for file in `ls -1 ${INSTALLDIR}/var/data | grep -v offline` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/data/$file ; done
100for file in `ls -1 ${INSTALLDIR}/var/web | grep -v reporter` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/web/$file ; done
101chown -R opensrf:opensrf /home/opensrf
102
103echo 'Evergreen is installed!'
104