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