of installing OpenSRF. You can switch to this account from the *root*
account by issuing the `su - opensrf` command.
+Download and unpack the code
+----------------------------
+
+Issue the following commands as the *user* Linux account.
+
+1. Acquire a stable release tarball from https://evergreen-ils.org/opensrf-downloads/
++
+[source, bash]
+------------------------------------------------------------------------------
+wget https://evergreen-ils.org/downloads/opensrf-OSRFVERSION.tar.gz
+------------------------------------------------------------------------------
++
+[NOTE]
+Developers can find the full source code at the OpenSRF Git repository:
+http://git.evergreen-ils.org/?p=OpenSRF.git
++
+2. Unpack the tarball, and move into that directory:
++
+[source, bash]
+------------------------------------------------------------------------------
+tar -xvf opensrf-OSRFVERSION.tar.gz
+cd opensrf-OSRFVERSION/
+------------------------------------------------------------------------------
+
Installing prerequisites
------------------------
prerequisites using the Makefile.install prerequisite installer, substituting
your operating system identifier for <osname> below:
+[source, bash]
---------------------------------------------------------------------------
apt-get install make
make -f src/extras/Makefile.install <osname>
* `debian-jessie` for Debian 8.0
* `debian-wheezy` for Debian 7.0
- * `debian-squeeze` for Debian 6.0
- * `ubuntu-precise` for Ubuntu 12.04
* `ubuntu-trusty` for Ubuntu 14.04
+ * `ubuntu-xenial` for Ubuntu 16.04
* `fedora` for Fedora 17 and later
Patches and suggestions for improvement from users of these distributions,
[NOTE]
Skip this section if you are using an official release tarball downloaded
-from http://evergreen-ils.org/downloads
+from https://evergreen-ils.org/opensrf-downloads/
Developers working directly with the source code from the Git repository,
rather than an official release tarball, must install some extra packages
If you are building OpenSRF for Evergreen, issue the following commands as
the *user* Linux account to configure and build OpenSRF:
+[source, bash]
---------------------------------------------------------------------------
./configure --prefix=/openils --sysconfdir=/openils/conf
make
example domains:
.Example added entries for `/etc/hosts`
+[source, bash]
---------------------------------------------------------------------------
127.0.1.2 public.localhost public
127.0.1.3 private.localhost private
OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
the Jabber server of choice for the OpenSRF project. In most cases, you only
-have to make a few changes to the default `ejabberd.cfg` file to make ejabberd
+have to make a few changes to the default configuration file to make ejabberd
work for OpenSRF.
1. Stop ejabberd before making any changes to its configuration by issuing the
following command as the *root* Linux account:
+
-.(Debian / Ubuntu) Stopping ejabberd
+.(Debian / Ubuntu Trusty) Stopping ejabberd
[source, bash]
---------------------------------------------------------------------------
/etc/init.d/ejabberd stop
---------------------------------------------------------------------------
+
-.(Fedora) Stopping ejabberd
+.(Fedora / Ubuntu Xenial) Stopping ejabberd
[source, bash]
---------------------------------------------------------------------------
systemctl stop ejabberd.service
---------------------------------------------------------------------------
+
-2. Open `/etc/ejabberd/ejabberd.cfg` and make the following
+2. Edit the ejabberd config file.
++
+(Debian Wheezy / Ubuntu Trusty) Ejabberd 2.x.x::
+Open `/etc/ejabberd/ejabberd.cfg` and make the following
changes:
a. Define your public and private domains in the `hosts` directive. For
example:
+
+[source, bash]
---------------------------------------------------------------------------
{hosts, ["localhost", "private.localhost", "public.localhost"]}.
---------------------------------------------------------------------------
+
- b. Change all `max_stanza_size` values to 2000000
- c. Change all `maxrate` values to 500000
- d. Increase the `max_user_sessions` value to 10000
+ b. Change all `maxrate` values to 500000
+ c. Increase the `max_user_sessions` value to 10000
+ d. Comment out the `mod_offline` directive
++
+(Debian Jessie) Ejabberd 13.x and 14.x::
+Open `/etc/ejabberd/ejabberd.yml` and make the following
+changes:
+ a. Define your public and private domains in the `hosts` directive. For
+ example:
++
+[source, bash]
+---------------------------------------------------------------------------
+hosts:
+ - "localhost"
+ - "private.localhost"
+ - "public.localhost"
+---------------------------------------------------------------------------
++
+ b. Change `shaper:` `normal` and `fast` values to 500000
+ c. Increase the `max_user_sessions:` `all:` value to 10000
+ d. Comment out the `mod_offline` directive
++
+-----------------------
+##mod_offline:
+ ##access_max_user_messages: max_user_offline_messages
+-----------------------
++
+(Ubuntu Xenial) Ejabberd 16.x::
+Open `/etc/ejabberd/ejabberd.yml` and make the following
+changes:
+ a. Define your public and private domains in the `hosts` directive. For
+ example:
++
+[source, bash]
+---------------------------------------------------------------------------
+hosts:
+ - "localhost"
+ - "private.localhost"
+ - "public.localhost"
+---------------------------------------------------------------------------
++
+ b. Change `auth_password_format` to plain
+ c. Change `shaper:` `normal` and `fast` values to 500000
+ d. Increase the `max_user_sessions:` `all:` value to 10000
e. Comment out the `mod_offline` directive
+
+-----------------------
+##mod_offline:
+ ##access_max_user_messages: max_user_offline_messages
+-----------------------
++
3. Restart the ejabberd server to make the changes take effect:
+
-.(Debian / Ubuntu) Starting ejabberd
+.(Debian / Ubuntu Trusty) Starting ejabberd
[source, bash]
---------------------------------------------------------------------------
/etc/init.d/ejabberd start
---------------------------------------------------------------------------
+
-.(Fedora) Starting ejabberd
+.(Fedora / Ubuntu Xenial) Starting ejabberd
[source, bash]
---------------------------------------------------------------------------
systemctl start ejabberd.service
to create your locally customizable OpenSRF configuration files:
+
.Copying the example OpenSRF configuration files
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
cd SYSCONFDIR
cp opensrf_core.xml.example opensrf_core.xml
To stop all OpenSRF services with a hostname of `localhost`, issue the
following command as the *opensrf* Linux account:
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
osrf_control --localhost --stop-all
---------------------------------------------------------------------------
command as the *opensrf* Linux account:
+
.Starting the `srfsh` interactive OpenSRF shell
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
srfsh
---------------------------------------------------------------------------
+
2. Issue the following request to test the `opensrf.math` service:
+
+[source, bash]
---------------------------------------------------------------------------
srfsh# request opensrf.math add 2,2
---------------------------------------------------------------------------
1. Install git if not already present:
+
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
apt-get install git-core
---------------------------------------------------------------------------
+
2. Install the apache-websocket module:
+
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
# Use a temporary directory
cd /tmp
---------------------------------------------------------------------------
+
3. Create the websocket Apache instance (more information about this in
- /usr/share/doc/apache2/README.multiple-instances)
+ `/usr/share/doc/apache2/README.multiple-instances`)
+
-.(Debian / Ubuntu Precise)
-[source,bash]
+.(Debian)
+[source, bash]
---------------------------------------------------------------------------
sh /usr/share/doc/apache2.2-common/examples/setup-instance websockets
---------------------------------------------------------------------------
+
-.(Ubuntu Trusty)
-[source,bash]
+.(Ubuntu Trusty / Xenial)
+[source, bash]
---------------------------------------------------------------------------
sh /usr/share/doc/apache2/examples/setup-instance websockets
---------------------------------------------------------------------------
+
4. Remove from the main apache instance
+
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
a2dismod websocket
---------------------------------------------------------------------------
+
-5. Copy into place the config files
+5. Change to the directory into which you unpacked OpenSRF, then copy into
+ place the config files
+
-.(Debian / Ubuntu Precise)
-[source,bash]
+.(Debian)
+[source, bash]
---------------------------------------------------------------------------
-cp /home/opensrf/OpenSRF/examples/apache2/websockets/apache2.conf /etc/apache2-websockets/
+cd /path/to/opensrf-OSRFVERSION
+cp examples/apache2/websockets/apache2.conf /etc/apache2-websockets/
---------------------------------------------------------------------------
+
-.(Ubuntu Trusty)
-[source,bash]
+.(Ubuntu Trusty / Xenial)
+[source, bash]
---------------------------------------------------------------------------
-cp /home/opensrf/OpenSRF/examples/apache_24/websockets/apache2.conf /etc/apache2-websockets/
+cd /path/to/opensrf-OSRFVERSION
+cp examples/apache_24/websockets/apache2.conf /etc/apache2-websockets/
---------------------------------------------------------------------------
+
-6. OPTIONAL: add these configuration variables to /etc/apache2-websockets/envvars
+6. OPTIONAL: add these configuration variables to `/etc/apache2-websockets/envvars`
and adjust as needed.
+
+[source, bash]
---------------------------------------------------------------------------
export OSRF_WEBSOCKET_IDLE_TIMEOUT=120
export OSRF_WEBSOCKET_IDLE_CHECK_INTERVAL=5
export OSRF_WEBSOCKET_MAX_REQUEST_WAIT_TIME=600
---------------------------------------------------------------------------
+
- * IDLE_TIMEOUT specifies how long we will allow a client to stay connected
+ * `IDLE_TIMEOUT` specifies how long we will allow a client to stay connected
while idle. A longer timeout means less network traffic (from fewer
websocket CONNECT calls), but it also means more Apache processes are
tied up doing nothing.
- * IDLE_CHECK_INTERVAL specifies how often we wake to check the idle status
+ * `IDLE_CHECK_INTERVAL` specifies how often we wake to check the idle status
of the connected client.
- * MAX_REQUEST_WAIT_TIME is the maximum amount of time the gateway will
+ * `MAX_REQUEST_WAIT_TIME` is the maximum amount of time the gateway will
wait before declaring a client as idle when there is a long-running
outstanding request, yet no other activity is occurring. This is
primarily a fail-safe to allow idle timeouts when one or more requests
died on the server, and thus no response was ever delivered to the gateway.
- * CONFIG_FILE / CTXT are the standard opensrf core config options.
+ * `CONFIG_FILE / CTXT` are the standard opensrf core config options.
+
+7. Before you can start websockets, you must install a valid SSL certificate
+ in `/etc/apache2/ssl/`. It is possible, but not recommended, to generate a
+ self-signed SSL certificate. For example, if you need to test with a self-signed
+ certicate on Chrome or Chromimum browsers, one workaround is to start the browser
+ with `--ignore-certificate-errors`.
-7. After OpenSRF is up and running (or after any re-install),
+8. After OpenSRF is up and running (or after any re-install),
fire up the secondary Apache instance. Errors will appear in
`/var/log/apache2-websockets/error.log`. Start apache2-websockets with:
+
-[source,bash]
+[source, bash]
---------------------------------------------------------------------------
/etc/init.d/apache2-websockets start
---------------------------------------------------------------------------
+Optional: Using NGINX as a proxy
+--------------------------------
+NGINX can be used to proxy HTTP, HTTPS, and WebSockets traffic. Among other
+reasons, this can be useful for Evergreen setups that want to have both
+HTTPS and secure WebSockets traffic both go through port 443 while using
+two Apache instances (one for the WebSockets gateway and one for the more
+memory-intensive TPAC pages).
+
+The following instructions are a guide for setting this up on Debian
+and Ubuntu systems, but expect general familiarity with various system
+administration and network tasks. The steps should be run as the *root*
+Linux account, and assume that you already followed the instructions
+for installing WebSockets support.
+
+1. Install NGINX if not already present:
++
+[source, bash]
+---------------------------------------------------------------------------
+apt-get install nginx
+---------------------------------------------------------------------------
++
+2. Configure the main Apache instance to listen on port 7080 for HTTP and
+ port 7443 for HTTPS and ensure that it is not listening on ports 80
+ and 443, then restart Apache.
+3. Copy the example NGINX configuration file into place.
++
+[source, bash]
+---------------------------------------------------------------------------
+cd /path/to/opensrf-OSRFVERSION
+cp examples/nginx/osrf-ws-http-proxy /etc/nginx/sites-available/
+ln -s /etc/nginx/sites-available/osrf-ws-http-proxy /etc/nginx/sites-enabled/osrf-ws-http-proxy
+---------------------------------------------------------------------------
++
+4. Edit `/etc/nginx/sites-available/osrf-ws-http-proxy` to set the location
+ of the SSL certificate and private key.
+5. Start NGINX
++
+[source, bash]
+---------------------------------------------------------------------------
+/etc/init.d/nginx start
+---------------------------------------------------------------------------
++
+6. Edit `<PREFIX>/javascript/opensrf_ws.js` and `<PREFIX>/javascript/opensrf_ws_shared.js`
+ and change
++
+[source, javascript]
+---------------------------------------------------------------------------
+var WEBSOCKET_PORT_SSL = 7682;
+---------------------------------------------------------------------------
++
+to
++
+[source, javascript]
+---------------------------------------------------------------------------
+var WEBSOCKET_PORT_SSL = 443;
+---------------------------------------------------------------------------
+
+Optional: Using HAProxy as a proxy
+----------------------------------
+HAProxy can also be used to proxy HTTP, HTTPS, and WebSockets traffic
+as an alternative to NGINX.
+
+The following instructions are a guide for setting this up on Debian
+and Ubuntu systems, but expect general familiarity with various system
+administration and network tasks. The steps should be run as the *root*
+Linux account, and assume that you already followed the instructions
+for installing WebSockets support.
+
+1. Install HAProxy if not already present:
++
+[source, bash]
+---------------------------------------------------------------------------
+apt-get install haproxy
+---------------------------------------------------------------------------
++
+2. Configure the main Apache instance to listen on port 7080 for HTTP and
+ port 7443 for HTTPS and ensure that it is not listening on ports 80
+ and 443, then restart Apache.
+3. Append the example HAProxy to `haproxy.cfg`.
++
+[source, bash]
+---------------------------------------------------------------------------
+cd /path/to/opensrf-OSRFVERSION
+cat examples/haproxy/osrf-ws-http-proxy >> /etc/haproxy/haproxy.cfg
+---------------------------------------------------------------------------
++
+4. Edit `/etc/haproxy/haproxy.cfg` to set the location
+ of the PEM file containing the SSL certificate and private key.
+5. Start HAProxy.
++
+[source, bash]
+---------------------------------------------------------------------------
+/etc/init.d/haproxy start
+---------------------------------------------------------------------------
++
+6. Edit `<PREFIX>/javascript/opensrf_ws.js` and `<PREFIX>/javascript/opensrf_ws_shared.js`
+ and change
++
+[source, javascript]
+---------------------------------------------------------------------------
+var WEBSOCKET_PORT_SSL = 7682;
+---------------------------------------------------------------------------
++
+to
++
+[source, javascript]
+---------------------------------------------------------------------------
+var WEBSOCKET_PORT_SSL = 443;
+---------------------------------------------------------------------------
+
Troubleshooting note for Python users
-------------------------------------
------------
Need help installing or using OpenSRF? Join the mailing lists at
-http://evergreen-ils.org/listserv.php or contact us on the Freenode
-IRC network on the #evergreen channel.
+http://evergreen-ils.org/communicate/mailing-lists/ or contact us
+on the Freenode IRC network on the #evergreen channel.