EG install scripts: add websockets/proxy ports config for 2.12
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 29 Mar 2017 01:04:30 +0000 (18:04 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 29 Mar 2017 01:04:30 +0000 (18:04 -0700)
deployment/install-eg.sh
deployment/install-osrf.sh

index 7a664af..de577e2 100755 (executable)
@@ -120,6 +120,38 @@ if [[ ! -n "$PROD" ]] ; then
   a2ensite test-server.conf
 fi
 
+# websockets config
+if [[ -n "$WEBCLIENT" ]] ; then
+    # use nginx proxy for websockets traffic
+    apt-get install -y nginx
+    cp -b ${SITKACONF}/files/etc/nginx/osrf-ws-http-proxy/${HOSTNAME} /etc/nginx/osrf-ws-http-proxy
+    ln -s /etc/nginx/sites-available/osrf-ws-http-proxy /etc/nginx/sites-enabled/osrf-ws-http-proxy
+    rm /etc/nginx/sites-enabled/default
+    cp -b ${SITKACONF}/files/etc/apache2/ports.conf/${HOSTNAME} /etc/apache2/ports.conf
+    WSJSFILES="opensrf_ws.js opensrf_ws_shared.js"
+    for WSJSFILE in ${WSJSFILES} ; do
+        # NOTE: this should be unnecessary if we installed OpenSRF with ./configure --with-websockets-port=443
+        sed -i 's/var WEBSOCKET_PORT_SSL = 7682;/var WEBSOCKET_PORT_SSL = 443;/g' ${INSTALLDIR}/lib/javascript/$WSJSFILE
+    done
+    # apache2-websockets
+    if [[ ! -n "$PROD" ]] ; then
+        if [ ! -d "/etc/apache2-websockets/ssl" ] ; then
+            cd /etc/apache2-websockets/ && ln -s /etc/apache2/ssl
+        fi
+        if [ ! -d "/etc/apache2-websockets/includes" ] ; then
+            mkdir /etc/apache2-websockets/includes
+        fi
+        WSINCLUDES="498-ssl-star.catalogue.libraries.coop-include 499-rewrites.conf-include default.conf-include"
+        for WSINCLUDE in ${WSINCLUDES} ; do
+            mv ${WSINCLUDE} ${WSINCLUDE}.bak
+            ln -s /etc/apache2/includes/${WSINCLUDE} /etc/apache2-websockets/includes/
+        done
+        ln -s /etc/apache2/sites-available/499-star.catalogue.libraries.coop.conf /etc/apache2-websockets/sites-available/499-star.catalogue.libraries.coop.conf
+    else
+        echo "Don't forget to configure apache2-websockets!"
+    fi
+fi
+
 # install default crontab, if specified
 if [[ -c "$CRONTAB" ]]; then
   if [ ! -f "/etc/cron.d/evergreen-dailies" ] ; then
index 9e2fc17..d548bdb 100755 (executable)
@@ -25,6 +25,13 @@ while getopts ":pw" opt ; do
 done
 shift $(($OPTIND - 1))
 
+# always use a proxy for websockets traffic
+if [[ -n "$WEBSOCKETS" ]] ; then
+    WSPORT="--with-websockets-port=443"
+else
+    WSPORT=""
+fi
+
 if [[ -n "$PROD" ]] ; then
   echo 'this is a production install'
 else
@@ -62,7 +69,7 @@ cd ${BUILDDIR} && make -f src/extras/Makefile.install ubuntu-trusty
 # as DEFAULT_USER
 echo "Configuring and building OpenSRF..."
 su -c "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER}
-su -c "cd ${BUILDDIR} && ./configure --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf" ${DEFAULT_USER}
+su -c "cd ${BUILDDIR} && ./configure --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf ${WSPORT}" ${DEFAULT_USER}
 su -c "cd ${BUILDDIR} && make" ${DEFAULT_USER}
  
 # as root