From 1f63951cd4b08c8df0793e4b786ebdbe82a24ebe Mon Sep 17 00:00:00 2001 From: Ben Shum Date: Wed, 24 Jul 2019 20:50:26 -0400 Subject: [PATCH] Use websocketd for stretch Signed-off-by: Ben Shum --- installer/stretch/eg_stretch_installer.sh | 55 +++++++++++-------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/installer/stretch/eg_stretch_installer.sh b/installer/stretch/eg_stretch_installer.sh index fdc96c54a..e97ac501c 100755 --- a/installer/stretch/eg_stretch_installer.sh +++ b/installer/stretch/eg_stretch_installer.sh @@ -101,11 +101,11 @@ function my_init { sleep 10 test_srfsh - echo __--==2 15. Optional: Websockets installation instructions + echo __--==2 15. Websockets installation instructions configure_websockets - echo __--==2 16. Optional: Using a web proxy + echo __--==2 16. Optional: Using a web proxy (Apache 2.4 and above) echo __--==2 17. Optional: Using NGINX as a proxy @@ -566,31 +566,13 @@ function test_srfsh { function configure_websockets { echo _.-~= configuring websockets - echo Install git if not already present: - apt-get install git-core - - echo Install the apache-websocket module: + echo Install websocketd cd /tmp - git clone https://github.com/disconnect/apache-websocket - cd apache-websocket - apxs2 -i -a -c mod_websocket.c - echo Return Value = $? - - echo Create the websocket Apache instance - sh /usr/share/doc/apache2/examples/setup-instance websockets + wget 'https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip' + unzip websocketd-0.3.0-linux_amd64.zip + sudo cp websocketd /usr/local/bin/ echo Return Value = $? - echo Change to the directory into which you unpacked OpenSRF, then copy into place the config files - cd ~test/OpenSRF - cp examples/apache_24/websockets/apache2.conf /etc/apache2-websockets/ - - echo OPTIONAL: add these configuration variables to /etc/apache2-websockets/envvars and adjust as needed. - echo 'export OSRF_WEBSOCKET_IDLE_TIMEOUT=120' >> /etc/apache2-websockets/envvars - echo 'export OSRF_WEBSOCKET_IDLE_CHECK_INTERVAL=5' >> /etc/apache2-websockets/envvars - echo 'export OSRF_WEBSOCKET_CONFIG_FILE=/openils/conf/opensrf_core.xml' >> /etc/apache2-websockets/envvars - echo 'export OSRF_WEBSOCKET_CONFIG_CTXT=gateway' >> /etc/apache2-websockets/envvars - echo 'export OSRF_WEBSOCKET_MAX_REQUEST_WAIT_TIME=600' >> /etc/apache2-websockets/envvars - echo Before you can start websockets, you must install a valid SSL certificate in /etc/apache2/ssl/ mkdir -p /etc/apache2/ssl; @@ -608,19 +590,22 @@ function configure_websockets { a2enmod ssl echo Return Value = $? - echo State of Apache processes - ps -aef | egrep -i 'apache|http' + echo Run websocketd, choosing option a or b, below: - echo After OpenSRF is up and running, fire up the secondary Apache instance. - if [ -e /etc/init.d/apache2-websockets ]; then - /etc/init.d/apache2-websockets start - else - systemctl start apache2@websockets.service - fi - echo Return Value = $? + echo a. Run websocketd as opensrf (optional) - echo State of Apache processes - ps -aef | egrep -i 'apache|http' + echo /usr/local/bin/websocketd --port 7682 /openils/bin/osrf-websocket-stdio & + echo # Other useful command line parameters include: + echo # --loglevel debug|trace|access|info|error|fatal + echo # --maxforks + echo # --sameorigin=true + echo # --origin=host[:port][,host[:port]...] + echo # See https://github.com/joewalnes/websocketd/blob/master/help.go + + echo b. Run websocketd without a proxy (chosen) + + /usr/local/bin/websocketd --port 7682 --ssl --sslcert=/etc/apache2/ssl/server.crt \ + --sslkey=/etc/apache2/ssl/server.key /openils/bin/osrf-websocket-stdio echo End of configuring websockets =~-._ } -- 2.11.0