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