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
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;
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 <n>
+ 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 =~-._
}