PURPOSE_="Generate config files needed for Evergreen-ILS Cluster"
SYNOPSIS_="$NAME_"
REQUIRES_="standard GNU commands, apt, dpkg"
- VERSION_="1.94"
- DATE_="2010-11-23; last update: 2019-01-07"
+ VERSION_="1.95"
+ DATE_="2010-11-23; last update: 2019-02-22"
AUTHOR_="Andy Witter <awitter@georgialibraries.org>"
URL_="http://evergreen-ils.org"
CATEGORY_="devel"
WD=$(dirname $(readlink -f $0))
CUSTOMDIR="$WD/custom"
-EG_VERSION="3.2.3"
+EG_VERSION="3.2.2"
UBUNTU_CODENAME="xenial"
LICENSE="$WD/License.txt"
TEMPLATEDIR="$WD/templates"
sed -i 's^OpenLibrary added content^Syndetics added content^g' $TMPOPENSRF_XML
sed -i "s^MODULE_USER_ID^$SYNDETICS_USER_ID^g" $TMPOPENSRF_XML
# sed -i 's^<!-- <base_url>http://syndetics.com/index.aspx</base_url> -->^<base_url>http://syndetics.com/index.aspx</base_url>^g' $TMPOPENSRF_XML
- sed -i '/<module>OpenILS::WWW::/a \\t <base_url>https://syndetics.com/index.aspx</base_url>' $TMPOPENSRF_XML
+ sed -i '/<module>OpenILS::WWW::/a \\t <base_url>http://syndetics.com/index.aspx</base_url>' $TMPOPENSRF_XML
fi
### Start setup of munin.conf file
eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/web/reporter
eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/systemd/system
eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/sudoers.d
+ eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/usr/local/bin
### head gets exports
if [ "$ROBOTS_TXT" = "y" ] || [ "$ROBOTS_TXT" = "Y" ] ### Copy robots.txt if selected.
eval cp -f $TEMPLATEDIR/systemd/apache2.service ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/systemd/system
eval cp -f $TEMPLATEDIR/systemd/opensrf.sudoers ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/sudoers.d/opensrf
eval cp -f $TEMPLATEDIR/monitor/check_osrf.sudoers ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/sudoers.d/nagios
+ eval cp -fP $TEMPLATEDIR/websocketd/websocket* ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/usr/local/bin
+ eval cp -f $TEMPLATEDIR/systemd/websocketd-osrf.service ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/systemd/system
#eval sed -i "s^CLUSTER_DOMAINNAME^${CLUSTERDOMAINNAME}^g" ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/60-evergreen-ils.conf
eval echo "\$BRICKHOSTNAME${BRICK}-head" > ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hostname
eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/openils/var/web/reporter
eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/systemd/system
eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/sudoers.d
+ eval mkdir -p ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/usr/local/bin
### head gets exports
if [ "$ROBOTS_TXT" = "y" ] || [ "$ROBOTS_TXT" = "Y" ] ### Copy robots.txt if selected.
then
eval cp -f $TEMPLATEDIR/systemd/apache2.service ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/systemd/system
eval cp -f $TEMPLATEDIR/systemd/opensrf.sudoers ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/sudoers.d/opensrf
eval cp -f $TEMPLATEDIR/monitor/check_osrf.sudoers ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/sudoers.d/nagios
+ eval cp -fP $TEMPLATEDIR/websocketd/websocket* ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/usr/local/bin
+ eval cp -f $TEMPLATEDIR/systemd/websocketd-osrf.service ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/systemd/system
#eval cp -f /tmp/rsyslog.conf ${OUTDIR}/\$BRICKHOSTNAME${BRICK}/\$BRICKHOSTNAME${BRICK}-head/etc/
eval echo "\$BRICKHOSTNAME${BRICK}-head" > ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/hostname
eval echo "\$BRICKHOSTNAME${BRICK}-head" >> $TMPOSRFNODES
Optimize_Brick_OpenSRF () { ### Optimize OpenSRF for bricks
#--- Optimize OpenSRF max_children
-sed -i "s^actor_MAX^72^g" openils/conf/opensrf.xml
+sed -i "s^actor_MAX^60^g" openils/conf/opensrf.xml
sed -i "s^search_MAX^80^g" openils/conf/opensrf.xml
sed -i "s^cata_MAX^60^g" openils/conf/opensrf.xml
sed -i "s^supercat_MAX^60^g" openils/conf/opensrf.xml
sed -i "s^storage_MAX^48^g" openils/conf/opensrf.xml
sed -i "s^cstore_MAX^128^g" openils/conf/opensrf.xml
sed -i "s^permacrud_MAX^50^g" openils/conf/opensrf.xml
-sed -i "s^fielder_MAX^72^g" openils/conf/opensrf.xml
+sed -i "s^fielder_MAX^50^g" openils/conf/opensrf.xml
sed -i "s^vandelay_MAX^50^g" openils/conf/opensrf.xml
#---
}
cp $TEMPLATEDIR/monitor/check_postgres.pl ../setup_${SUBFOLDER}/monitoring
cp $TEMPLATEDIR/monitor/check_cpu.sh ../setup_${SUBFOLDER}/monitoring
cp $TEMPLATEDIR/monitor/check_osrf ../setup_${SUBFOLDER}/monitoring
- cp -r $TEMPLATEDIR/apache2/websockets ../setup_${SUBFOLDER}
+ #cp -r $TEMPLATEDIR/apache2/websockets ../setup_${SUBFOLDER}
touch ../setup_${SUBFOLDER}/.osrf_node
sed -i "s^HOSTNAME^${SUBFOLDER}^g" ../setup_${SUBFOLDER}/debconf-settings
cp -f "$TEMPLATEDIR/setup_sshkeys.sh" "setup_${NODE_FOLDER}"
cp -f "$TEMPLATEDIR/utility/opensrf-crontab" "setup_${NODE_FOLDER}"
cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}"
- cp -rf "$TEMPLATEDIR/apache2/websockets" "setup_${NODE_FOLDER}"
+ #cp -rf "$TEMPLATEDIR/apache2/websockets" "setup_${NODE_FOLDER}"
fi
if echo ${NODE_FOLDER} | grep -q sip0
then
cp -f "$TEMPLATEDIR/Net-Z3950-SimpleServer-1.12.tar.gz" "setup_${NODE_FOLDER}"
- cp -rf "$TEMPLATEDIR/apache2/websockets" "setup_${NODE_FOLDER}"
+ #cp -rf "$TEMPLATEDIR/apache2/websockets" "setup_${NODE_FOLDER}"
[ -e "${TMPFOLDER}/oils_sip.xml" ] && cp -f "${TMPFOLDER}/oils_sip.xml" "setup_${NODE_FOLDER}"
fi
if echo ${NODE_FOLDER} | grep -q reporter0
}
location /osrf-websocket-translator {
- proxy_pass https://localhost:7682;
+ proxy_pass http://localhost:7682;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# high value so that we can leverage osrf-websocket-translator's
# timeout settings.
proxy_connect_timeout 5m;
- proxy_send_timeout 1h;
- proxy_read_timeout 1h;
+ proxy_send_timeout 5m;
+ proxy_read_timeout 5m;
}
}
echo "Websockets found copying config files..."
sleep 2
# mkdir -p /etc/apache2/apache2-websockets
- cp -f $WD/websockets/* /etc/apache2-websockets
- cat <<EOF >> /etc/apache2-websockets/envvars
+ # cp -f $WD/websockets/* /etc/apache2-websockets
+# cat <<EOF >> /etc/apache2-websockets/envvars
### For Opensrf
- export OSRF_WEBSOCKET_IDLE_TIMEOUT=120
- export OSRF_WEBSOCKET_IDLE_CHECK_INTERVAL=5
- export OSRF_WEBSOCKET_CONFIG_FILE=/openils/conf/opensrf_core.xml
- export OSRF_WEBSOCKET_CONFIG_CTXT=gateway
- export OSRF_WEBSOCKET_MAX_REQUEST_WAIT_TIME=600
-EOF
+# export OSRF_WEBSOCKET_IDLE_TIMEOUT=120
+# export OSRF_WEBSOCKET_IDLE_CHECK_INTERVAL=5
+# export OSRF_WEBSOCKET_CONFIG_FILE=/openils/conf/opensrf_core.xml
+# export OSRF_WEBSOCKET_CONFIG_CTXT=gateway
+# export OSRF_WEBSOCKET_MAX_REQUEST_WAIT_TIME=600
+#EOF
fi
a2dismod websocket
update-rc.d apache2-websockets defaults
### Enable systemd autogen service for first boot
systemctl enable autogen
systemctl enable apache2
+systemctl enable websocketd-osrf
echo
echo
--- /dev/null
+[Unit]
+Description=Websocketd OpenSRF Gateway
+
+[Service]
+Type=simple
+User=opensrf
+Group=opensrf
+Environment=PATH=/openils/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+Environment=LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH
+ExecStart=/usr/local/bin/websocketd --loglevel error --maxforks 250 --port 7682 /openils/bin/osrf-websocket-stdio
+
+# modify websocketd command line options to taste
+# --sameorigin and --origin=domain1,domain2 flags are also supported for security.
--- /dev/null
+Version 0.3.1 (Jan 28, 2019)
+
+* Minor improvements to websocketd itself
+* Use of go modules, gorilla websockets set to 1.4.0
+* Binaries build code switched to 1.11.5 (improving underlying protocol handlers)
+
+Version 0.3.0 (??, 2017)
+
+* Migration of underlying websocket server to Gorilla Websocket lib.
+* Binaries build code switched to 1.9.2
+
+Version 0.2.12 (Feb 17, 2016)
+
+* Update of underlying go standard libraries change how SSL works. SSL3 is no longer supported.
+* Support of commands that do not provide text IO (using them as binary websocket frames)
+* Minor changes in examples and --help output
+
+Version 0.2.11 (Jul 1, 2015)
+
+* PATH env variable is now passed to process by default
+* new --header* flags could generate custom HTTP headers for all websocketd-generated answers
+* fixed bug causing process to hang when WebSockets client disconnect is detected
+* minor changes for console app (default url building logic and tab char printing)
+* multiple changes of examples.
+
+
+Version 0.2.10 (Feb 16, 2015)
+
+* fixes for null-origin situations (#75, #96)
+* better bash examples (#103)
+* changelog and checksums for released files (#101, #105)
+
+
+Version 0.2.9 (May 19, 2014)
+
+* ability to listen multiple IP addresses (#40, #43)
+* proper support for TLS (#17)
+* resource limits enforcement (a.k.a. maxforks feature, #46)
+* passenv option to limit environment variables visible by running commands (#4)
+* fix for problem of closing upgraded websocket connection when script is not found (#29)
+* websocket origin restrictions via command line option (#20)
+* minor update for help flag behavior
+* minor fix for devconsole
+
+Version 0.2.8 (Jan 11, 2014)
+
+* ...
\ No newline at end of file
--- /dev/null
+Copyright (c) 2014, Joe Walnes and the websocketd authors.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+websocketd
+==========
+
+`websocketd` is a small command-line tool that will wrap an existing command-line interface program, and allow it to be accessed via a WebSocket.
+
+WebSocket-capable applications can now be built very easily. As long as you can write an executable program that reads `STDIN` and writes to `STDOUT`, you can build a WebSocket server. Do it in Python, Ruby, Perl, Bash, .NET, C, Go, PHP, Java, Clojure, Scala, Groovy, Expect, Awk, VBScript, Haskell, Lua, R, whatever! No networking libraries necessary.
+
+-[@joewalnes](https://twitter.com/joewalnes)
+
+Details
+-------
+
+Upon startup, `websocketd` will start a WebSocket server on a specified port, and listen for connections.
+
+Upon a connection, it will fork the appropriate process, and disconnect the process when the WebSocket connection closes (and vice-versa).
+
+Any message sent from the WebSocket client will be piped to the process's `STDIN` stream, followed by a `\n` newline.
+
+Any text printed by the process to `STDOUT` shall be sent as a WebSocket message whenever a `\n` newline is encountered.
+
+
+Download
+--------
+
+If you're on a Mac, you can install `websocketd` using [Homebrew](http://brew.sh/). Just run `brew install websocketd`. For other operating systems, or if you don't want to use Homebrew, check out the link below.
+
+**[Download for Linux, OS X and Windows](https://github.com/joewalnes/websocketd/wiki/Download-and-install)**
+
+
+Quickstart
+----------
+
+To get started, we'll create a WebSocket endpoint that will accept connections, then send back messages, counting to 10 with 1 second pause between each one, before disconnecting.
+
+To show how simple it is, let's do it in Bash!
+
+__count.sh__:
+
+```sh
+#!/bin/bash
+for ((COUNT = 1; COUNT <= 10; COUNT++)); do
+ echo $COUNT
+ sleep 1
+done
+```
+
+Before turning it into a WebSocket server, let's test it from the command line. The beauty of `websocketd` is that servers work equally well in the command line, or in shell scripts, as they do in the server - with no modifications required.
+
+```sh
+$ chmod +x count.sh
+$ ./count.sh
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+```
+
+Now let's turn it into a WebSocket server:
+
+```sh
+$ websocketd --port=8080 ./count.sh
+```
+
+Finally, let's create a web-page that to test it.
+
+__count.html__:
+
+```html
+<!DOCTYPE html>
+<pre id="log"></pre>
+<script>
+ // helper function: log message to screen
+ function log(msg) {
+ document.getElementById('log').textContent += msg + '\n';
+ }
+
+ // setup websocket with callbacks
+ var ws = new WebSocket('ws://localhost:8080/');
+ ws.onopen = function() {
+ log('CONNECT');
+ };
+ ws.onclose = function() {
+ log('DISCONNECT');
+ };
+ ws.onmessage = function(event) {
+ log('MESSAGE: ' + event.data);
+ };
+</script>
+```
+Open this page in your web-browser. It will even work if you open it directly
+from disk using a `file://` URL.
+
+More Features
+-------------
+
+* Very simple install. Just [download](https://github.com/joewalnes/websocketd/wiki/Download-and-install) the single executable for Linux, Mac or Windows and run it. Minimal dependencies, no installers, no package managers, no external libraries. Suitable for development and production servers.
+* Server side scripts can access details about the WebSocket HTTP request (e.g. remote host, query parameters, cookies, path, etc) via standard [CGI environment variables](https://github.com/joewalnes/websocketd/wiki/Environment-variables).
+* As well as serving websocket daemons it also includes a static file server and classic CGI server for convenience.
+* Command line help available via `websocketd --help`.
+* Includes [WebSocket developer console](https://github.com/joewalnes/websocketd/wiki/Developer-console) to make it easy to test your scripts before you've built a JavaScript frontend.
+* [Examples in many programming languages](https://github.com/joewalnes/websocketd/tree/master/examples) are available to help you getting started.
+
+User Manual
+-----------
+
+**[More documentation in the user manual](https://github.com/joewalnes/websocketd/wiki)**
+
+Example Projects
+----------------
+
+* [Plot real time Linux CPU/IO/Mem stats to a HTML5 dashboard using websocketd and vmstat](https://github.com/joewalnes/web-vmstats) _(for Linux)_
+* [Remote JScript & VBScript code execution tool based on websocketd](https://github.com/dab00/ws-console) _(for Windows)_
+* [Arbitrary REPL in the browser using websocketd](https://github.com/rowanthorpe/ws-repl)
+* [Retrieve SQL data from server with LiveCode and webSocketd](https://github.com/samansjukur/wslc)
+
+Got more examples? Open a pull request.
+
+My Other Projects
+-----------------
+
+* [ReconnectingWebSocket](https://github.com/joewalnes/reconnecting-websocket) - Simplest way to add some robustness to your WebSocket connections.
+* [Smoothie Charts](http://smoothiecharts.org/) - JavaScript charts for streaming data.
+* Visit [The Igloo Lab](http://theigloolab.com/) to see and subscribe to other thingies I make.
+
+And [follow @joewalnes](https://twitter.com/joewalnes)!
--- /dev/null
+websocketd
\ No newline at end of file