install-eg.sh: updates for EG2.8
[sitka/sitka-tools.git] / deployment / install-eg.sh
CommitLineData
0155bbac
JD
1#!/bin/bash
2# IMPORTANT! This script assumes you have already installed OpenSRF.
3
71f85432 4HOSTNAME="nonprod-28"
0155bbac
JD
5DEFAULT_USER="sitkastaff"
6HOMEDIR="/home/${DEFAULT_USER}"
71f85432
JD
7EGRELEASE="Evergreen-ILS-2.8.beta"
8BUILDDIR="${HOMEDIR}/${EGRELEASE}"
0155bbac 9INSTALLDIR="/srv/openils"
71f85432
JD
10#BRANCH="upgrade/eg28/beta-tpac"
11STAMP_ID="rel_2_8_beta"
12ALT_STAMP_IDS="2_8_beta"
0155bbac 13SITKACONF="${HOMEDIR}/sysadmin"
0155bbac 14
e724d7db
JD
15suwrap() {
16 su -s /bin/bash -l -c "source ~/.bashrc ; $1" $2
17}
18
0155bbac
JD
19# as DEFAULT_USER
20
21# grab Sitka config files
22if [ ! -d "${SITKACONF}" ]
23then
24 # this will fail unless DEFAULT_USER has read access to the repo
e724d7db 25 suwrap "cd ${HOMEDIR} && git clone git+ssh://git@git.sitka.bclibraries.ca/sitka-infra/sysadmin" ${DEFAULT_USER}
0155bbac 26fi
e724d7db 27suwrap "cd ${SITKACONF} && git pull" ${DEFAULT_USER}
0155bbac
JD
28
29# checkout EG source
71f85432
JD
30#if [ ! -d "${BUILDDIR}" ]
31#then
32# suwrap "cd ${HOMEDIR} && git clone git://git.sitka.bclibraries.ca/sitka/evergreen evergreen" ${DEFAULT_USER}
33#fi
34#suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${DEFAULT_USER}
35
36# download and unpack EG release
37rm -rf ${BUILDDIR}
38suwrap "cd ${HOMEDIR} && wget http://open-ils.org/downloads/${EGRELEASE}.tar.gz && tar xzf ${EGRELEASE}.tar.gz" ${DEFAULT_USER}
0155bbac
JD
39
40# as root
71f85432
JD
41cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-trusty
42cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-trusty-developer # required for web client
0155bbac
JD
43# by default, CPAN needs some manual input at this point; you can just accept all defaults
44
45# as DEFAULT_USER
71f85432 46#suwrap "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER} # not required for release versions
fd31984b 47suwrap "cd ${BUILDDIR} && ./configure -C --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf --with-opensrf-headers=${INSTALLDIR}/include/ --with-opensrf-libs=${INSTALLDIR}/lib/" ${DEFAULT_USER}
e724d7db 48suwrap "cd ${BUILDDIR} && make" ${DEFAULT_USER}
691245a2 49suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en-CA install" ${DEFAULT_USER}
0155bbac
JD
50
51# as root
71f85432
JD
52cd ${BUILDDIR} && make STAFF_CLIENT_STAMP_ID=${STAMP_ID} install
53#mv ${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/
0155bbac
JD
54chown -R opensrf:opensrf ${INSTALLDIR}
55
56# Apache stuff (as root):
9d46f12d 57APACHEFILES="/etc/apache2/eg_vhost.conf /etc/apache2/eg_startup /etc/apache2/sites-available/eg.conf"
0155bbac
JD
58for APACHEFILE in ${APACHEFILES}
59do
bd41f68d 60 mv ${APACHEFILE} ${APACHEFILE}.bak
0155bbac
JD
61 cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
62done
fd31984b 63a2dissite 000-default
9d46f12d 64a2ensite eg.conf
51a4755a
JD
65if [ ! -d "/etc/apache2/ssl" ]
66then
67 mkdir /etc/apache2/ssl
68 cd /etc/apache2/ssl && openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
69fi
71f85432
JD
70# ensure opensrf can run Apache
71chown -R opensrf:opensrf /var/lock/apache2
7d30f3bf 72
26b3ea66 73# set up log rotation
abcafeff 74if [ ! -f "/etc/logrotate.d/evergreen" ]
26b3ea66
JD
75then
76 cp ${SITKACONF}/files/etc/logrotate.d/evergreen/${HOSTNAME} /etc/logrotate.d/evergreen
77fi
0155bbac 78
0155bbac
JD
79# 0. osrf conf stuff
80# FIXME: ensure osrf conf files point at a real, distinct db!
81OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
82for OSRFCONFFILE in ${OSRFCONFFILES}
83do
51a4755a 84 mv ${OSRFCONFFILE} ${OSRFCONFFILE}.bak
0155bbac
JD
85 cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}
86done
abcafeff 87if [ ! -f "${HOMEDIR}/.srfsh.xml" ]
9d46f12d
JD
88then
89 cp ${SITKACONF}/files/home/opensrf/.srfsh.xml/${HOSTNAME} ${HOMEDIR}/.srfsh.xml
90fi
91
0155bbac 92# 1. install dojo
abcafeff 93if [ ! -f "/home/opensrf/dojo-release-1.3.3.tar.gz" ]
51a4755a
JD
94then
95 cd /home/opensrf && wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
96fi
0155bbac
JD
97tar -C ${INSTALLDIR}/var/web/js -xzf /home/opensrf/dojo-release-1.3.3.tar.gz
98cp -r ${INSTALLDIR}/var/web/js/dojo-release-1.3.3/* ${INSTALLDIR}/var/web/js/dojo/.
99
100# 2. set up staff client
9d46f12d 101cd ${INSTALLDIR}/var/web/xul && rm server && rm current
0155bbac 102cd ${INSTALLDIR}/var/web/xul && ln -s ${STAMP_ID} current && ln -s current/server server
03b5e41f
JD
103for ALT_STAMP_ID in ${ALT_STAMP_IDS}
104do
105 cd ${INSTALLDIR}/var/web/xul && ln -s current ${ALT_STAMP_ID}
106done
0155bbac 107
9d46f12d 108# 3. install circ scripts and opac skins - DEPRECATED
71f85432
JD
109
110# 4. avoid 404s - XXX deprecated?
111#touch ${INSTALLDIR}/var/web/css/skin/default/register_custom.css
112#touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/patron_custom.properties
113#touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/common_custom.properties
114#touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/offline_custom.properties
115#touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/auth_custom.properties
116#touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/cat_custom.properties
117#touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/circ_custom.properties
118#touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/patron_custom.properties
119#touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/common_custom.properties
120#touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/offline_custom.properties
121#touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/auth_custom.properties
122#touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/cat_custom.properties
123#touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/circ_custom.properties
124#touch ${INSTALLDIR}/var/web/xul/server/skin/custom.js
125
126# 5. locale hack - XXX deprecated?
127#cd ${INSTALLDIR}/var/web/opac/locale && cp -fdr en-US en-US-bak && cp -fdr en-CA en-US
0155bbac
JD
128
129# 6. deletepatron
130# ensure apache conf contains deletepatron config (location should be ${INSTALLDIR}/var/web/deletepatron)
131cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
6f81dddf 132cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22 && find . -name "*.pm" | xargs sed -i -e 's|/openils|/srv/openils|g'
6113c87e 133apt-get install libcgi-session-perl libhtml-template-perl
0155bbac 134
71f85432
JD
135# 7. support scripts - XXX deprecated?
136#cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
137#cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
0155bbac 138
c05e3516
JD
139# 8. setup start page
140if [ ! -d "${INSTALLDIR}/var/web/news" ]
141then
142 mkdir ${INSTALLDIR}/var/web/news
143fi
144NEWSFILES="index.html style.css"
145for NEWSFILE in ${NEWSFILES}
146do
147 if [ -f "${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME}" ]
148 then
149 cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME} ${INSTALLDIR}/var/web/news/${NEWSFILE}
150 fi
151done
152
153# 9. make sure opensrf owns all the stuff we just did
0155bbac 154chown -R opensrf:opensrf ${INSTALLDIR}
d4e88b8a 155chown -R opensrf:opensrf /home/opensrf
0155bbac 156
d4e88b8a
JD
157# 10. staff client stuff
158apt-get install nsis unzip
089f11fb
JD
159
160# 11. integrity checker prereqs
161apt-get install libconfig-simple-perl libgit-repository-perl libdate-manip-perl
ee1de43f
JD
162
163# 12. paper overdue prereqs
164apt-get install python-reportlab python-reportlab-accel