]> git.evergreen-ils.org Git - working/OpenSRF.git/blob - README
fix typo
[working/OpenSRF.git] / README
1 Installing OpenSRF
2 ==================
3
4 Preamble: referenced user accounts
5 ----------------------------------
6
7 In subsequent sections, we will refer to a number of different accounts, as
8 follows:
9
10   * Linux user accounts:
11     ** The *user* Linux account is the account that you use to log onto the
12        Linux system as a regular user.
13     ** The *root* Linux account is an account that has system administrator
14        privileges. On Debian you can switch to this account from
15        your *user* account by issuing the `su -` command and entering the
16        password for the *root* account when prompted. On Ubuntu you can switch
17        to this account from your *user* account using the `sudo su -` command
18        and entering the password for your *user* account when prompted.
19     ** The *opensrf* Linux account is an account that you will create as part
20        of installing OpenSRF. You can switch to this account from the *root*
21        account by issuing the `su - opensrf` command.
22
23 Download and unpack the code
24 ----------------------------
25
26 Issue the following commands as the *user* Linux account.
27
28 1. Acquire a stable release tarball from https://evergreen-ils.org/opensrf-downloads/
29 +
30 [source, bash]
31 ------------------------------------------------------------------------------
32 wget https://evergreen-ils.org/downloads/opensrf-OSRFVERSION.tar.gz
33 ------------------------------------------------------------------------------
34 +
35 [NOTE]
36 Developers can find the full source code at the OpenSRF Git repository:
37 http://git.evergreen-ils.org/?p=OpenSRF.git
38 +
39 2. Unpack the tarball, and move into that directory:
40 +
41 [source, bash]
42 ------------------------------------------------------------------------------
43 tar -xvf opensrf-OSRFVERSION.tar.gz
44 cd opensrf-OSRFVERSION/
45 ------------------------------------------------------------------------------
46
47 Installing prerequisites
48 ------------------------
49
50 OpenSRF has a number of prerequisite packages that must be installed
51 before you can successfully configure, compile, and install OpenSRF.
52 On Debian and Ubuntu, the easiest way to install these prerequisites
53 is to use the Makefile.install prerequisite installer.
54
55 Issue the following commands as the *root* Linux account to install 
56 prerequisites using the Makefile.install prerequisite installer, substituting 
57 your operating system identifier for <osname> below:
58
59 [source, bash]
60 ---------------------------------------------------------------------------
61 apt-get install make
62 make -f src/extras/Makefile.install <osname>
63 ---------------------------------------------------------------------------
64
65 Well-tested values for <osname> include:
66
67   * `debian-buster` for Debian 10
68   * `debian-stretch` for Debian 9
69   * `debian-jessie` for Debian 8
70   * `ubuntu-xenial` for Ubuntu 16.04
71   * `ubuntu-bionic` for Ubuntu 18.04
72   * `centos` for CentOS 8 (experimental)
73   * `rhel` for RedHat Enterprise Linux 8 (Experimental)
74
75 Patches and suggestions for improvement from users of these distributions,
76 or others, are welcome!
77
78 When the prerequisite installer reaches the Perl module stage, you may 
79 be prompted for configuration of Comprehensive Perl Archive Network (CPAN)
80 on your server. You can generally accept the defaults by pressing <return>
81 for all of the prompts, except for the country configuration.
82
83 [NOTE]
84 ===========================================================================
85 The CentOS/RHEL options will automatically add extra repositories to allow
86 RPM package installation, and will download and install EJabberD from the
87 project website.
88 ===========================================================================
89
90 Preamble: Developer instructions
91 --------------------------------
92
93 [NOTE]
94 Skip this section if you are using an official release tarball downloaded
95 from https://evergreen-ils.org/opensrf-downloads/
96
97 Developers working directly with the source code from the Git repository,
98 rather than an official release tarball, must install some extra packages
99 and perform one step before they can proceed with the `./configure` step.
100
101 As the *root* Linux account, install the following packages:
102
103   * autoconf
104   * automake
105   * libtool
106
107 As the *user* Linux account, issue the following command in the OpenSRF
108 source directory to generate the configure script and Makefiles:
109
110 [source, bash]
111 ------------------------------------------------------------------------------
112 autoreconf -i
113 ------------------------------------------------------------------------------
114
115 Configuration and compilation instructions
116 ------------------------------------------
117
118 Use the `configure` command to configure OpenSRF, and the `make` command to
119 build OpenSRF. The default installation prefix (PREFIX) for OpenSRF is
120 `/opensrf/`.
121
122 If you are building OpenSRF for Evergreen, issue the following commands as
123 the *user* Linux account to configure and build OpenSRF:
124
125 [source, bash]
126 ---------------------------------------------------------------------------
127 ./configure --prefix=/openils --sysconfdir=/openils/conf
128 make
129 ---------------------------------------------------------------------------
130
131 By default, OpenSRF includes C, Perl, and JavaScript support.
132 You can add the `--enable-python` option to the configure command
133 to build Python support and `--enable-java` for Java support.
134
135 If you are planning on proxying WebSockets traffic (see below), you
136 can add `--with-websockets-port=443` to specify that WebSockets traffic
137 will be going through port 443. Without that option, the default port
138 is 7682.
139
140 Installation instructions
141 -------------------------
142
143 1. Once you have configured and compiled OpenSRF, issue the following
144    command as the *root* Linux account to install OpenSRF:
145 +
146 [source, bash]
147 ---------------------------------------------------------------------------
148 make install
149 ---------------------------------------------------------------------------
150
151 Create and set up the opensrf Unix user environment
152 ---------------------------------------------------
153
154 This user is used to start and stop all OpenSRF processes, and must own all
155 files contained in the PREFIX directory hierarchy. Issue the following
156 commands as the *root* Linux account to create the `opensrf` user and set up
157 its environment, substituting <PREFIX> with the value you passed to `--prefix`
158 in your configure command:
159
160 .Creating the `opensrf` user
161 [source, bash]
162 ---------------------------------------------------------------------------
163 useradd -m -s /bin/bash opensrf
164 echo "export PATH=\$PATH:/<PREFIX>/bin" >> /home/opensrf/.bashrc
165 passwd opensrf
166 chown -R opensrf:opensrf /<PREFIX>
167 ---------------------------------------------------------------------------
168
169 Define your public and private OpenSRF domains
170 ----------------------------------------------
171
172 For security purposes, OpenSRF uses Jabber domains to separate services
173 into public and private realms. Throughout these instructions, we will use
174 the example domains `public.localhost` and `private.localhost`. 
175
176 On a single-server system, the easiest way to define public and private
177 domains is to define separate hostnames by adding entries to the `/etc/hosts`
178 file. Here are entries that you could add to a stock `/etc/hosts` file for our
179 example domains:
180
181 .Example added entries for `/etc/hosts`
182 [source, bash]
183 ---------------------------------------------------------------------------
184 127.0.1.2       public.localhost        public
185 127.0.1.3       private.localhost       private
186 ---------------------------------------------------------------------------
187
188 Adjust the system dynamic library path
189 --------------------------------------
190
191 Add `<PREFIX>/lib/` to the system's dynamic library path, and then run
192 `ldconfig` as the *root* Linux account.
193
194 On Debian and Ubuntu systems, run the following commands as the *root*
195 Linux account:
196
197 .Adjusting the system dynamic library path
198 [source, bash]
199 ---------------------------------------------------------------------------
200 echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
201 ldconfig
202 ---------------------------------------------------------------------------
203
204 On most other systems, you can add these entries to `/etc/ld.so.conf`, or
205 create a file within the `/etc/ld.so.conf.d/` directory, and then run
206 `ldconfig` as the *root* Linux account.
207
208 Configure the ejabberd server
209 -----------------------------
210
211 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
212 the Jabber server of choice for the OpenSRF project. In most cases, you only
213 have to make a few changes to the default configuration file to make ejabberd
214 work for OpenSRF. 
215
216 1. Stop ejabberd before making any changes to its configuration by issuing the
217    following command as the *root* Linux account:
218 +
219 .Stopping ejabberd
220 [source, bash]
221 ---------------------------------------------------------------------------
222 systemctl stop ejabberd.service
223 ---------------------------------------------------------------------------
224 +
225 2. Edit the ejabberd config file.
226 +
227 (Debian Jessie) Ejabberd 13.x and 14.x::
228 Open `/etc/ejabberd/ejabberd.yml` and make the following
229 changes:
230   a. Define your public and private domains in the `hosts` directive. For
231    example:
232 +
233 [source, bash]
234 ---------------------------------------------------------------------------
235 hosts:
236   - "localhost"
237   - "private.localhost"
238   - "public.localhost"
239 ---------------------------------------------------------------------------
240 +
241   b. Change `shaper:` `normal` and `fast` values to 500000
242   c. Increase the `max_user_sessions:` `all:` value to 10000
243   d. Comment out the `mod_offline` directive
244 +
245 -----------------------
246 ##mod_offline:
247     ##access_max_user_messages: max_user_offline_messages
248 -----------------------
249 +
250 (Debian Stretch / Ubuntu Xenial) Ejabberd 16.x::
251 Open `/etc/ejabberd/ejabberd.yml` and make the following
252 changes:
253   a. Define your public and private domains in the `hosts` directive. For
254    example:
255 +
256 [source, bash]
257 ---------------------------------------------------------------------------
258 hosts:
259   - "localhost"
260   - "private.localhost"
261   - "public.localhost"
262 ---------------------------------------------------------------------------
263 +
264   b. Change `auth_password_format` to plain
265   c. Change `shaper:` `normal` and `fast` values to 500000
266   d. Increase the `max_user_sessions:` `all:` value to 10000
267   e. Comment out the `mod_offline` directive
268 +
269 -----------------------
270 ##mod_offline:
271     ##access_max_user_messages: max_user_offline_messages
272 -----------------------
273 +
274 (Debian Buster / Ubuntu Bionic) Ejabberd 18.x::
275 Open `/etc/ejabberd/ejabberd.yml` and make the following
276 changes:
277   a. Define your public and private domains in the `hosts` directive. For
278    example:
279 +
280 [source, bash]
281 ---------------------------------------------------------------------------
282 hosts:
283   - "localhost"
284   - "private.localhost"
285   - "public.localhost"
286 ---------------------------------------------------------------------------
287 +
288   b. Change `starttls_required` to false
289   c. Change `auth_password_format` to plain
290   d. Change `shaper:` `normal` and `fast` values to 500000
291   e. Increase the `max_user_sessions:` `all:` value to 10000
292   f. Comment out the `mod_offline` directive
293 +
294 -----------------------
295 ##mod_offline:
296     ##access_max_user_messages: max_user_offline_messages
297 -----------------------
298 +
299   g. Uncomment or add the `mod_legacy_auth` directive
300
301 (CentOS/RHEL) Ejabberd 20.x::
302 Open `/opt/ejabberd/conf/ejabberd.yml` and make the following 
303 changes:
304   a. Define your public and private domains in the `hosts` directive. For
305    example:
306 +
307 [source, bash]
308 ---------------------------------------------------------------------------
309 hosts:
310   - "localhost"
311   - "private.localhost"
312   - "public.localhost"
313 ---------------------------------------------------------------------------
314 +
315   b. Change `starttls_required` to false
316   c. Change `shaper:` `normal` and `fast` values to 500000
317   d. Increase the `max_user_sessions:` `all:` value to 10000
318   e. Comment out the `mod_offline` directive
319 +
320 -----------------------
321 ##mod_offline:
322     ##access_max_user_messages: max_user_offline_messages
323 -----------------------
324 +
325   f. Add the `mod_legacy_auth` directive under the `modules` section 
326 (indent 2 spaces):
327 +
328 -----------------------
329 modules:
330   ....
331   mod_version:
332     show_os: false
333   mod_legacy_auth: {}
334 -----------------------
335 +
336    g. Add the following lines under the `## Local Variables`:
337 +
338 -----------------------
339 auth_method: internal
340 auth_password_format: plain
341 -----------------------
342 +
343 3. Restart the ejabberd server to make the changes take effect:
344 +
345 .Starting ejabberd
346 [source, bash]
347 ---------------------------------------------------------------------------
348 systemctl start ejabberd.service
349 ---------------------------------------------------------------------------
350
351 Create the OpenSRF Jabber users
352 -------------------------------
353
354 On each domain, you need two Jabber users to manage the OpenSRF communications:
355
356   * a `router` user, to whom all requests to connect to an OpenSRF service
357     will be routed; this Jabber user must be named `router`
358   * an `opensrf` user, which clients use to connect to OpenSRF services; this
359     user can be named anything you like
360
361 Create the Jabber users by issuing the following commands as the *root* Linux
362 account. Substitute `<password>` for your chosen passwords for each user
363 respectively:
364
365 .Creating the OpenSRF Jabber users
366 [source, bash]
367 ---------------------------------------------------------------------------
368 ejabberdctl register router private.localhost <password>
369 ejabberdctl register opensrf private.localhost <password>
370 ejabberdctl register router public.localhost <password>
371 ejabberdctl register opensrf public.localhost <password>
372 ---------------------------------------------------------------------------
373
374 Update the OpenSRF configuration files
375 --------------------------------------
376
377 About the OpenSRF configuration files
378 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379 There are several configuration files that you must update to make OpenSRF
380 work. SYSCONFDIR is `/opensrf/etc` by default, or the value that you passed to
381 `--sysconfdir` during the configuration phase.
382
383   * `SYSCONFDIR/opensrf.xml` - this file lists the services that this
384     OpenSRF installation supports; if you create a new OpenSRF service,
385     you need to add it to this file.
386       ** The `<hosts>` element at the bottom of the file lists the services
387          that should be started for each hostname. You can force the system
388          to use `localhost`, so in most cases you will leave this section
389          as-is.
390     
391   * `SYSCONFDIR/opensrf_core.xml` - this file lists the Jabber connection
392     information that will be used for the system, as well as determining
393     logging verbosity and defining which services will be exposed on the
394     HTTP gateway.
395
396   * `~/.srfsh.xml` - this file gives a Linux account the ability to use
397     the `srfsh` interpreter to communicate with OpenSRF services.
398
399 Updating the OpenSRF configuration files
400 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401   1. As the *opensrf* Linux account, copy the example configuration files
402      to create your locally customizable OpenSRF configuration files:
403 +
404 .Copying the example OpenSRF configuration files
405 [source, bash]
406 ---------------------------------------------------------------------------
407 cd SYSCONFDIR
408 cp opensrf_core.xml.example opensrf_core.xml
409 cp opensrf.xml.example opensrf.xml
410 ---------------------------------------------------------------------------
411 +
412   2. Edit the `SYSCONFDIR/opensrf_core.xml` file to update the four username
413      / password pairs to match the Jabber user accounts you just created:
414
415     a. `<config><opensrf>` = use the private Jabber `opensrf` user
416     b. `<config><gateway>` = use the public Jabber `opensrf` user
417     c. `<config><routers><router>` = use the public Jabber `router` user
418     d. `<config><routers><router>` = use the private Jabber `router` user
419   3. Create a `.srfsh.xml` file in the home directory of each user
420      that you want to use `srfsh` to communicate with OpenSRF services. For
421      example, to enable the *opensrf* Linux account to use `srfsh`:
422     a. `cp SYSCONFDIR/srfsh.xml.example ~/.srfsh.xml`
423     b. Open `~/.srfsh.xml` in your text editor of choice and update the
424        password to match the password you set for the Jabber `opensrf` user
425        at the `private.localhost` domain.
426
427 Starting and stopping OpenSRF services
428 --------------------------------------
429
430 To start all OpenSRF services with a hostname of `localhost`, issue the
431 following command as the *opensrf* Linux account:
432
433 [source, bash]
434 ---------------------------------------------------------------------------
435 osrf_control --localhost --start-all
436 ---------------------------------------------------------------------------
437
438 To stop all OpenSRF services with a hostname of `localhost`, issue the
439 following command as the *opensrf* Linux account:
440
441 [source, bash]
442 ---------------------------------------------------------------------------
443 osrf_control --localhost --stop-all
444 ---------------------------------------------------------------------------
445
446 Testing the default OpenSRF services
447 ------------------------------------
448
449 By default, OpenSRF ships with an `opensrf.math` service that performs basic
450 calculations involving two integers. Once you have started the OpenSRF
451 services, test the services as follows:
452
453 1. Start the `srfsh` interactive OpenSRF shell by issuing the following
454    command as the *opensrf* Linux account:
455 +
456 .Starting the `srfsh` interactive OpenSRF shell
457 [source, bash]
458 ---------------------------------------------------------------------------
459 srfsh
460 ---------------------------------------------------------------------------
461 +
462 2. Issue the following request to test the `opensrf.math` service:
463 +
464 [source, bash]
465 ---------------------------------------------------------------------------
466 srfsh# request opensrf.math add 2,2
467 ---------------------------------------------------------------------------
468 +
469 You should receive the value `4`.
470
471 Websockets installation instructions
472 ------------------------------------
473
474 1. Install websocketd (latest stable release from http://websocketd.com/)
475 +
476 [source,bash]
477 ---------------------------------------------------------------------------
478 cd /tmp
479 wget 'https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip'
480 unzip websocketd-0.3.0-linux_amd64.zip
481 sudo cp websocketd /usr/local/bin/
482 ---------------------------------------------------------------------------
483 +
484 2. Run websocketd
485 +
486 Choose option a or b, below.
487
488 [NOTE]
489 ===========================================================================
490 websocketd does not offer a configurable inactivity timeout, meaning
491 websocket client connections will persist until each client disconnects
492 or the service is restarted.  However, a timeout can be achieved with
493 the use of a proxy (option 'a' below).  A proxy also allows websocketd
494 to be exposed to web clients on port 443 instead of its internal port, 
495 which may simplify firewall configuration.
496 ===========================================================================
497
498 a. Run websocketd as 'opensrf'
499 +
500 [NOTE]
501 ===========================================================================
502 This choice requires one of the proxy configurations mentioned below.
503 ===========================================================================
504 +
505 [source,bash]
506 ---------------------------------------------------------------------------
507 /usr/local/bin/websocketd --port 7682 /openils/bin/osrf-websocket-stdio &
508
509 # Other useful command line parameters include:
510 # --loglevel debug|trace|access|info|error|fatal
511 # --maxforks <n>
512 # --sameorigin=true
513 # --origin=host[:port][,host[:port]...]
514
515 # See https://github.com/joewalnes/websocketd/blob/master/help.go
516 ---------------------------------------------------------------------------
517 +
518 b. Run websocketd without a proxy
519 +
520 [source,bash]
521 ---------------------------------------------------------------------------
522 sudo -b /usr/local/bin/websocketd --port 7682 --ssl --sslcert=/etc/apache2/ssl/server.crt \
523      --sslkey=/etc/apache2/ssl/server.key /openils/bin/osrf-websocket-stdio
524 ---------------------------------------------------------------------------
525
526 Optional: Using a web proxy (Apache 2.4 and above)
527 --------------------------------------------------
528 When the OpenSRF HTTP Translator runs behind a proxy, Apache must be 
529 configured to read the IP address of the originating client instead
530 of the proxy IP address.  
531
532 1. Enable mod_remoteip
533 +
534 .(Debian, Ubuntu)
535 [source,bash]
536 ---------------------------------------------------------------------------
537 sudo a2enmod remoteip
538 ---------------------------------------------------------------------------
539 +
540 For CentOS/RHEL, create a file at `/etc/httpd/20-remoteip.conf` with the following line:
541 +
542 .(CentOS/RHEL)
543 [source,bash]
544 ---------------------------------------------------------------------------
545 LoadModule remoteip_module modules/mod_remoteip.so
546 ---------------------------------------------------------------------------
547 +
548 2. Enable remote IP settings by uncommenting and modifying as needed the 
549    Apache configuration variables starting with RemoteIP* in the sample Apache
550    configuration file opensrf.conf.
551 +
552 3. Configure Apache to listen on port 7080 for HTTP and port 7443 for HTTPS
553    and ensure that it is not listening on ports 80 and 443, then restart Apache.
554 +
555 [NOTE]
556 ===============================================================================
557 On CentOS and RHEL, SELinux must be configured to allow Apache to access
558 and execute files in the non-standard `/openils` directory and to run on alternate
559 ports.  Assuming `/openils` is the installation directory, issue the following
560 before restarting Apache.
561 ===============================================================================
562 +
563 .(CentOS/RHEL)
564 [source, bash]
565 ----------------------------------------------------------------------------
566 semanage fcontext -a -t httpd_sys_content_t "/openils(/.*)?"
567 semanage fcontext -a -t httpd_log_t "/openils/var/log(/.*)?"
568 semanage fcontext -a -t httpd_sys_script_exec_t "/openils/lib(/.*)?"
569 semanage port -a -t http_port_t -p tcp 7080
570 semanage port -a -t http_port_t -p tcp 7443
571 restorecon -Rv /openils
572 ----------------------------------------------------------------------------
573 +
574 4. If you didn't run `configure` with the `--with-websockets-port=443` option,
575    edit `<PREFIX>/javascript/opensrf_ws.js` and `<PREFIX>/javascript/opensrf_ws_shared.js`
576    and change
577 +
578 [source, javascript]
579 ---------------------------------------------------------------------------
580 var WEBSOCKET_PORT_SSL = 7682;
581 ---------------------------------------------------------------------------
582 +
583 to
584 +
585 [source, javascript]
586 ---------------------------------------------------------------------------
587 var WEBSOCKET_PORT_SSL = 443;
588 ---------------------------------------------------------------------------
589
590 Optional: Using NGINX as a proxy
591 --------------------------------
592 NGINX can be used to proxy HTTP, HTTPS, and WebSockets traffic. Among other
593 reasons, this can be useful for Evergreen setups that want to have both
594 HTTPS and secure WebSockets traffic both go through port 443 while using
595 two Apache instances (one for the WebSockets gateway and one for the more
596 memory-intensive TPAC pages).
597
598 The following instructions are a guide for setting this up on Debian
599 and Ubuntu systems, but expect general familiarity with various system
600 administration and network tasks.  The steps should be run as the *root*
601 Linux account, and assume that you already followed the instructions
602 for installing WebSockets support.
603
604 1. Install NGINX if not already present:
605 +
606 .(Debian/Ubuntu)
607 [source, bash]
608 ---------------------------------------------------------------------------
609 apt-get install nginx
610 ---------------------------------------------------------------------------
611 +
612 .(CentOS/RHEL)
613 [source, bash]
614 -----------------------
615 yum install nginx
616 -----------------------
617 +
618 2. Copy the example NGINX configuration file into place and remove default.
619 +
620 .(Debian/Ubuntu)
621 [source, bash]
622 ---------------------------------------------------------------------------
623 cd /path/to/opensrf-OSRFVERSION
624 cp examples/nginx/osrf-ws-http-proxy /etc/nginx/sites-available/
625 ln -s /etc/nginx/sites-available/osrf-ws-http-proxy /etc/nginx/sites-enabled/osrf-ws-http-proxy
626 rm /etc/nginx/sites-enabled/default
627 ---------------------------------------------------------------------------
628 +
629 .(CentOS/RHEL)
630 [source, bash]
631 ---------------------------------------------------------------------------
632 cp examples/nginx/osrf-ws-http-proxy /etc/nginx/conf.d/
633 ---------------------------------------------------------------------------
634 +
635 3. Edit `/etc/nginx/sites-available/osrf-ws-http-proxy` (Debian/Ubuntu) or 
636    `/etc/nginx/conf.d/osrf-ws-http-proxy` (CentOS/RHEL) to set the location 
637    of the SSL certificate and private key.
638 4. Generate a dhparam file in the directory specified in the nginx config.
639 +
640 .(Debian/Ubuntu)
641 [source, bash]
642 ---------------------------------------------------------------------------
643 # Default config stores dhparam.pem in the Apache2 ssl directory.
644 openssl dhparam -out /etc/apache2/ssl/dhparam.pem 2048
645 ---------------------------------------------------------------------------
646 +
647 .(CentOS/RHEL)
648 [source, bash]
649 ---------------------------------------------------------------------------
650 mkdir /etc/httpd/ssl
651 openssl dhparam -out /etc/httpd/ssl/dhparam.pem 2048
652 ---------------------------------------------------------------------------
653 +
654 5. Start NGINX
655 +
656 [source, bash]
657 ---------------------------------------------------------------------------
658 systemctl start nginx
659 ---------------------------------------------------------------------------
660
661 Optional: Using HAProxy as a proxy
662 ----------------------------------
663 HAProxy can also be used to proxy HTTP, HTTPS, and WebSockets traffic
664 as an alternative to NGINX.
665
666 The following instructions are a guide for setting this up on Debian
667 and Ubuntu systems, but expect general familiarity with various system
668 administration and network tasks.  The steps should be run as the *root*
669 Linux account, and assume that you already followed the instructions
670 for installing WebSockets support.
671
672 1. Install HAProxy if not already present:
673 +
674 [source, bash]
675 ---------------------------------------------------------------------------
676 apt-get install haproxy
677 ---------------------------------------------------------------------------
678 +
679 2. Append the example HAProxy to `haproxy.cfg`.
680 +
681 [source, bash]
682 ---------------------------------------------------------------------------
683 cd /path/to/opensrf-OSRFVERSION
684 cat examples/haproxy/osrf-ws-http-proxy >> /etc/haproxy/haproxy.cfg
685 ---------------------------------------------------------------------------
686 +
687 3. Edit `/etc/haproxy/haproxy.cfg` to set the location
688    of the PEM file containing the SSL certificate and private key.
689 4. Start HAProxy.
690 +
691 [source, bash]
692 ---------------------------------------------------------------------------
693 /etc/init.d/haproxy start
694 ---------------------------------------------------------------------------
695
696 Troubleshooting note for Python users
697 -------------------------------------
698
699 If you are running a Python client and trying to connect to OpenSRF running on
700 localhost rather than a hostname that can be resolved via DNS, you will
701 probably receive exceptions about `dns.resolver.NXDOMAIN`. If this happens,
702 you need to install the `dnsmasq` package, configure it to serve up a DNS
703 entry for localhost, and point your local DNS resolver to `dnsmasq`. For example,
704 on Ubuntu you can issue the following commands as the *root* Linux account:
705
706 .Installing and starting `dnsmasq`
707 [source, bash]
708 ---------------------------------------------------------------------------
709 aptitude install dnsmasq
710 /etc/init.d/dnsmasq restart
711 ---------------------------------------------------------------------------
712
713 Then edit `/etc/resolv.conf` and ensure that `nameserver 127.0.0.1` is the
714 first entry in the file.
715
716 Getting help
717 ------------
718
719 Need help installing or using OpenSRF? Join the mailing lists at
720 http://evergreen-ils.org/communicate/mailing-lists/ or contact us 
721 on the Freenode IRC network on the #evergreen channel.