]> git.evergreen-ils.org Git - OpenSRF.git/blob - README
forgot a noun
[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-gutsy" for Ubuntu 7.10
22   * "ubuntu-hardy" for Ubuntu 8.04
23   * "ubuntu-intrepid" for Ubuntu 8.10
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 # passwd opensrf
84
85 Define your public and private OpenSRF domains:
86 ==============================================
87
88 For security purposes, OpenSRF uses Jabber domains to separate services
89 into public and private realms. Throughout these instructions, we will use
90 the example domains "public.localhost" and "private.localhost". 
91
92 On a single-server system, the easiest way to define public and private
93 domains is to define separate hostnames by adding entries to the
94 /etc/hosts file. Here are entries that you could make to a stock /etc/hosts
95 file for our example domains:
96
97 127.0.1.2       public.localhost        public
98 127.0.1.3       private.localhost       private
99
100 Adjust the system dynamic library path:
101 ======================================
102
103 Add <PREFIX>/lib/ to the system's dynamic library path, and then run "ldconfig"
104 as root.
105
106 On Debian and Ubuntu systems, run the following commands as root:
107
108 # echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
109 # ldconfig
110
111 On most other systems, you can add these entries to a /etc/ld.so.conf, or create
112 a file within the /etc/ld.so.conf.d/ directory, and then run "ldconfig" as root.
113
114 Configure the ejabberd server:
115 =============================
116
117 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
118 the Jabber server of choice for the OpenSRF project. In most cases, you only
119 have to make a few changes to the default ejabberd.cfg file to make ejabberd
120 work for OpenSRF. 
121
122 1. Stop ejabberd before making any changes to its configuration by issuing the
123 following command as root:
124
125 # /etc/init.d/ejabberd stop
126
127 2. Open /etc/ejabberd/ejabberd.cfg and make the following
128 changes:
129
130 a. Define your public and private domains in the "hosts" directive. For
131    example:
132
133 {hosts, ["private.localhost", "public.localhost"]}
134
135 b. Comment out the "mod_offline" directive
136 c. Increase the "max_user_sessions" value to 1000
137 d. Change all "max_stanza_size" values to 200000
138 e. Change all "maxrate" values to 500000 
139
140 3. Restart the ejabberd server to make the changes take effect:
141
142 # /etc/init.d/ejabberd start
143
144 Create the OpenSRF Jabber users:
145 ===============================
146
147 On each domain, you need two Jabber users to manage the OpenSRF communications:
148
149   * a "router" user, to whom all requests to connect to an OpenSRF service
150     will be routed; this Jabber user must be named "router"
151   * an "opensrf" user, which clients use to connect to OpenSRF services; this
152     user can be named anything you like
153
154 Create the Jabber users by issuing the following commands as root. Substitute
155 <password> for your chosen passwords for each user respectively:
156
157 # ejabberdctl register router private.localhost <password>
158 # ejabberdctl register opensrf private.localhost <password>
159 # ejabberdctl register router public.localhost <password>
160 # ejabberdctl register opensrf public.localhost <password>
161
162 Update the OpenSRF configuration files:
163 ======================================
164
165 There are two critical files that you must update to make OpenSRF work.
166 "SYSCONFDIR" is "/opensrf/etc" by default, or the value that you passed to
167 --sysconfdir during the configuration phase:
168
169   * SYSCONFDIR/opensrf.xml - this file lists the services that this
170     OpenSRF installation supports; if you create a new OpenSRF service,
171     you need to add it to this file.
172       * The <hosts> element at the bottom of the file lists the services
173         that should be started for each hostname. You can force the system
174         to use "localhost", so in most cases you will leave this section
175         as-is.
176       * You must alter the <dbfile> element value for the "opensrf.persist"
177         service to point to a directory to which the opensrf user can write.
178         Note that the override in the <hosts> section takes precedence over
179         the general service definition value.
180     
181   * SYSCONFDIR/opensrf_core.xml - this file lists the Jabber connection
182     information that will be used for the system, as well as determining
183     logging verbosity and defining which services will be exposed on the
184     HTTP gateway. There are four username/password pairs to update in this
185     file:
186       1. <config><opensrf> = use the private Jabber "opensrf" user
187       2. <config><gateway> = use the public Jabber "opensrf" user
188       3. <config><routers><router> = use the public Jabber "router" user
189       4. <config><routers><router> = use the private Jabber "router" user
190
191 You should also create a .srfsh.xml file in the home directory of each user
192 that you want to enable to use the srfsh to communicate with OpenSRF services.
193
194 Copy <SYSCONFDIR>/srfsh.xml.example to ~/.srfsh.xml and update the password 
195 to match the one for your Jabber "opensrf" user with the private.localhost 
196 domain.
197
198 Starting and stopping OpenSRF services:
199 ======================================
200
201 To start all OpenSRF services with a hostname of "localhost", issue the
202 following command as the opensrf user:
203
204 $ osrf_ctl.sh -l -a start_all
205
206 To stop all OpenSRF services with a hostname of "localhost", issue the
207 following command as the opensrf user:
208
209 $ osrf_ctl.sh -l -a stop_all
210
211 Testing the default OpenSRF services:
212 ====================================
213
214 By default, OpenSRF ships with an opensrf.math service that performs basic
215 calculations involving two integers. Once you have started the OpenSRF
216 services, start srfsh and issue the following request:
217
218 srfsh# request opensrf.math add 2,2
219
220 You should receive the value "4".
221
222 Troubleshooting note for Python users:
223 =====================================
224
225 If you are running a Python client and trying to connect to OpenSRF running on
226 localhost rather than a hostname that can be resolved via DNS, you will
227 probably receive exceptions about "dns.resolver.NXDOMAIN". If this happens,
228 you need to install the dnsmasq package, configure it to serve up a DNS
229 entry for localhost, and point your local DNS resolver to dnsmasq. For example,
230 on Ubuntu you can issue the following commands as root:
231
232 # aptitude install dnsmasq
233 # echo "webserver=/localhost/127.0.0.1/" >> /etc/dnsmasq.conf
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.