]> git.evergreen-ils.org Git - OpenSRF.git/blob - README
Add SIGPIPE retry handling to child data sysread
[OpenSRF.git] / README
1 README for OpenSRF 2.0.0
2 ============================
3
4 Installing prerequisites:
5 -------------------------
6
7 OpenSRF has a number of prerequisite packages that must be installed
8 before you can successfully configure, compile, and install OpenSRF.
9 On Debian and Ubuntu, the easiest way to install these prerequisites
10 is to use the Makefile.install prerequisite installer for Evergreen.
11
12 Issue the following commands as the root user to install prerequisites
13 using the Makefile.install prerequisite installer, substituting your
14 operating system identifier for <osname> below:
15
16 ---------------------------------------------------------------------------
17 aptitude install make
18 make -f src/extras/Makefile.install <osname>
19 ---------------------------------------------------------------------------
20
21 Well-tested values for <osname> include:
22
23   * `debian-lenny` for Debian 5.0
24   * `debian-squeeze` for Debian 6.0.0
25   * `ubuntu-hardy` for Ubuntu 8.04
26   * `ubuntu-lucid` for Ubuntu 10.04
27   * `fedora15` for Fedora 15
28
29 Less-tested values for <osname> include:
30
31   * `centos` for CentOS 5
32   * `rhel` for Red Hat Enterprise Linux 5
33
34 Patches and suggestions for improvement from users of these distributions,
35 or others, are welcome!
36
37 When the prerequisite installer reaches the Perl module stage, you may 
38 be prompted for configuration of Comprehensive Perl Archive Network (CPAN)
39 on your server. You can generally accept the defaults by pressing <return>
40 for all of the prompts, except for the country configuration.
41
42 [NOTE]
43 If you are installing this using a copy of the source code that was
44 checked out directly from the OpenSRF Subversion repository rather
45 than from a downloaded release of the source code, there are a few
46 additional prerequisite tools and steps that you will need to follow.
47 See "Developer instructions" at the bottom of the file.
48
49 Configuration and compilation instructions:
50 -------------------------------------------
51
52 Use the `configure` command to configure OpenSRF, and the `make` command to
53 build OpenSRF. The default installation prefix (PREFIX) for OpenSRF is
54 `/opensrf/`.
55
56 If you are building OpenSRF for Evergreen, pass the `--prefix` and
57 `--sysconfdir` options as follows:
58
59 ---------------------------------------------------------------------------
60 ./configure --prefix=/openils --sysconfdir=/openils/conf
61 make
62 ---------------------------------------------------------------------------
63
64 By default, OpenSRF includes C, Perl, and JavaScript support.
65 You can add the `--enable-python` option to the configure command
66 to build Python support, and `--enable-java` for Java support.
67
68 Installation instructions:
69 --------------------------
70
71 Once you have configured and compiled OpenSRF, issue the following
72 command as the root user to install OpenSRF:
73
74 ---------------------------------------------------------------------------
75 make install
76 ---------------------------------------------------------------------------
77
78 This will install OpenSRF in the prefix directory that you specified in the
79 configuration step. This will also install example configuration files that
80 you can use as templates for your own configuration files.
81
82 Create and set up the opensrf Unix user environment:
83 ----------------------------------------------------
84
85 This user is used to start and stop all OpenSRF processes, and must own all
86 files contained in the PREFIX directory hierarchy. Issue the following
87 commands as root to create the `opensrf` user and set up its environment,
88 substituting <PREFIX> with the value you passed to `--prefix` in your
89 configure command:
90
91 ---------------------------------------------------------------------------
92 # useradd -m -s /bin/bash opensrf
93 # echo "export PATH=\$PATH:/<PREFIX>/bin" >> /home/opensrf/.bashrc
94 # passwd opensrf
95 ---------------------------------------------------------------------------
96
97 Define your public and private OpenSRF domains:
98 -----------------------------------------------
99
100 For security purposes, OpenSRF uses Jabber domains to separate services
101 into public and private realms. Throughout these instructions, we will use
102 the example domains `public.localhost` and `private.localhost`. 
103
104 On a single-server system, the easiest way to define public and private
105 domains is to define separate hostnames by adding entries to the `/etc/hosts`
106 file. Here are entries that you could make to a stock `/etc/hosts` file for our
107 example domains:
108
109 ---------------------------------------------------------------------------
110 127.0.1.2       public.localhost        public
111 127.0.1.3       private.localhost       private
112 ---------------------------------------------------------------------------
113
114 Adjust the system dynamic library path:
115 ---------------------------------------
116
117 Add `<PREFIX>/lib/` to the system's dynamic library path, and then run
118 `ldconfig` as root.
119
120 On Debian and Ubuntu systems, run the following commands as root:
121
122 ---------------------------------------------------------------------------
123 # echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
124 # ldconfig
125 ---------------------------------------------------------------------------
126
127 On most other systems, you can add these entries to `/etc/ld.so.conf`, or
128 create a file within the `/etc/ld.so.conf.d/` directory, and then run
129 `ldconfig` as root.
130
131 Configure the ejabberd server:
132 ------------------------------
133
134 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
135 the Jabber server of choice for the OpenSRF project. In most cases, you only
136 have to make a few changes to the default `ejabberd.cfg` file to make ejabberd
137 work for OpenSRF. 
138
139 1. Stop ejabberd before making any changes to its configuration by issuing the
140 following command as root:
141 +
142 ---------------------------------------------------------------------------
143 # /etc/init.d/ejabberd stop
144 ---------------------------------------------------------------------------
145 +
146 2. Open `/etc/ejabberd/ejabberd.cfg` and make the following
147 changes:
148   a. Define your public and private domains in the `hosts` directive. For
149    example:
150 +
151 ---------------------------------------------------------------------------
152 {hosts, ["private.localhost", "public.localhost"]}
153 ---------------------------------------------------------------------------
154 +
155   b. Comment out the `mod_offline` directive
156   c. Increase the `max_user_sessions` value to 1000
157   d. Change all `max_stanza_size` values to 2000000
158   e. Change all `maxrate` values to 500000 
159 +
160 3. Restart the ejabberd server to make the changes take effect:
161 ---------------------------------------------------------------------------
162 # /etc/init.d/ejabberd start
163 ---------------------------------------------------------------------------
164
165 Create the OpenSRF Jabber users:
166 --------------------------------
167
168 On each domain, you need two Jabber users to manage the OpenSRF communications:
169
170   * a `router` user, to whom all requests to connect to an OpenSRF service
171     will be routed; this Jabber user must be named `router`
172   * an `opensrf` user, which clients use to connect to OpenSRF services; this
173     user can be named anything you like
174
175 Create the Jabber users by issuing the following commands as root. Substitute
176 <password> for your chosen passwords for each user respectively:
177
178 ---------------------------------------------------------------------------
179 # ejabberdctl register router private.localhost <password>
180 # ejabberdctl register opensrf private.localhost <password>
181 # ejabberdctl register router public.localhost <password>
182 # ejabberdctl register opensrf public.localhost <password>
183 ---------------------------------------------------------------------------
184
185 Update the OpenSRF configuration files:
186 ---------------------------------------
187
188 There are two critical files that you must update to make OpenSRF work.
189 SYSCONFDIR is `/opensrf/etc` by default, or the value that you passed to
190 `--sysconfdir` during the configuration phase:
191
192   * `SYSCONFDIR/opensrf.xml` - this file lists the services that this
193     OpenSRF installation supports; if you create a new OpenSRF service,
194     you need to add it to this file.
195       * The `<hosts>` element at the bottom of the file lists the services
196         that should be started for each hostname. You can force the system
197         to use `localhost`, so in most cases you will leave this section
198         as-is.
199     
200   * `SYSCONFDIR/opensrf_core.xml` - this file lists the Jabber connection
201     information that will be used for the system, as well as determining
202     logging verbosity and defining which services will be exposed on the
203     HTTP gateway. There are four username/password pairs to update in this
204     file:
205       1. `<config><opensrf>` = use the private Jabber `opensrf` user
206       2. `<config><gateway>` = use the public Jabber `opensrf` user
207       3. `<config><routers><router>` = use the public Jabber `router` user
208       4. `<config><routers><router>` = use the private Jabber `router` user
209
210 You should also create a `.srfsh.xml` file in the home directory of each user
211 that you want to enable to use the srfsh to communicate with OpenSRF services.
212
213 Copy `SYSCONFDIR/srfsh.xml.example` to `~/.srfsh.xml` and update the password 
214 to match the one for your Jabber `opensrf` user with the private.localhost 
215 domain.
216
217 Starting and stopping OpenSRF services:
218 ---------------------------------------
219
220 To start all OpenSRF services with a hostname of `localhost`, issue the
221 following command as the opensrf user:
222
223 ---------------------------------------------------------------------------
224 $ osrf_ctl.sh -l -a start_all
225 ---------------------------------------------------------------------------
226
227 To stop all OpenSRF services with a hostname of `localhost`, issue the
228 following command as the opensrf user:
229
230 [source,bash]
231 ---------------------------------------------------------------------------
232 $ osrf_ctl.sh -l -a stop_all
233 ---------------------------------------------------------------------------
234
235 Testing the default OpenSRF services:
236 -------------------------------------
237
238 By default, OpenSRF ships with an `opensrf.math` service that performs basic
239 calculations involving two integers. Once you have started the OpenSRF
240 services, start srfsh and issue the following request:
241
242 ---------------------------------------------------------------------------
243 srfsh# request opensrf.math add 2,2
244 ---------------------------------------------------------------------------
245
246 You should receive the value `4`.
247
248 Troubleshooting note for Python users:
249 --------------------------------------
250
251 If you are running a Python client and trying to connect to OpenSRF running on
252 localhost rather than a hostname that can be resolved via DNS, you will
253 probably receive exceptions about `dns.resolver.NXDOMAIN`. If this happens,
254 you need to install the `dnsmasq` package, configure it to serve up a DNS
255 entry for localhost, and point your local DNS resolver to `dnsmasq`. For example,
256 on Ubuntu you can issue the following commands as root:
257
258 ---------------------------------------------------------------------------
259 # aptitude install dnsmasq
260 # /etc/init.d/dnsmasq restart
261 ---------------------------------------------------------------------------
262
263 Then edit `/etc/resolv.conf` and ensure that `nameserver 127.0.0.1` is the
264 first entry in the file.
265
266 Developer instructions:
267 -----------------------
268
269 Developers working directly with the source code from the Subversion
270 repository will also need to install some extra packages and perform
271 one more step before they can proceed with the `./configure` step.
272
273 Install the following packages:
274
275   * autoconf
276   * automake
277   * libtool
278
279 Run the following command in the source directory to generate the configure
280 script and Makefiles:
281
282 ---------------------------------------------------------------------------
283 $ ./autogen.sh 
284 ---------------------------------------------------------------------------
285
286 Getting help:
287 -------------
288
289 Need help installing or using OpenSRF? Join the mailing lists at
290 http://evergreen-ils.org/listserv.php or contact us on the Freenode
291 IRC network on the #evergreen channel.