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