root/HelpIM3_chi/README.txt

Revision 731, 12.8 kB (checked in by winfried, 2 years ago)

- updating tigase setup for setting up tigase 4.3.1 (needed to fix delay in closing webchat)

Line 
1HelpIM3 README
2
31) Introduction
4HelpIM3 is the development version of the next generation of HelpIM. Targets for its development are:
5- improved stability
6- improved scalability
7- improved support for non-western languages
8- improved configuration
9
10HelpIM3 will come in three flavours: HelpIM-light, HelpIM-embedded and HelpIM-full. Each of these flavours share the same codebase, but are different sets of configurations.
11- HelpIM-light is a light-weight subset of HelpIM3 that should pretty much work out of the box. Its configuration is suitable for simple applications of HelpIM.
12- If you want more features or other configuration options, HelpIM-full is your thing. HelpIM-full is very adaptable to your needs, because of its modulair setup, but you have to do the configuration yourself. An demo configuration is included.
13- HelpIM-embedded is an other set of configurations of HelpIM, designed to be integrated in an other CMS. In this flavour, it is possible to configure HelpIM fromout an CMS. Integrating HelpIM-embedded with your site, will need some configuration and probably a little programming.
14
152) Prerequisites
16We develop and test HelpIM on both Debian stable and Debian tesing, with Tigase as jabber server, Apache2 as webserver and MySQL as database engine.
17
18HelpIM3 needs:
19- Python 2.5 or an higher version of Python 2
20- The following non-standard Python modules:
21  - crypto
22  - pyxmpp 1.0.1 or later
23  - sqlalchmey
24  - the database driver for the database you wish to use.
25  On a Debian system with MySQL these can be installed with the following command:
26    sudo aptitude install python python-crypto python-pyxmpp python-sqlalchemy python-mysqldb
27  Note for Debian: the pyxmpp version of Lenny is too old, you must install the debs of
28  python-pyxmpp and python-support from a later version by hand with dpkg -i.
29- An Python WSGI-enabled web server, with the possibility to proxy requests on a certain URL to
30  another server. For the development of HelpIM we use:
31  - Apache2 with the following modules:
32    - mod_proxy
33    - mod_proxy_http
34    - mod_proxy_connect
35    - mod_wsgi
36  On a Debian system these can be installed with the following command:
37    sudo aptitude install apache2-mpm-prefork libapache2-mod-proxy-html libapache2-mod-wsgi
38  the module proxy_connect will be installed, but not be enabled. To enable it, run:
39    sudo a2enmod proxy_connect
40- An database engine. MySQL is tested, but PostgreSQL should work too.
41- An jabber server that supports:
42  - SASL Anonymous login
43  - BOSH
44  - MUC
45  - Chat state notifications in the MUC
46  Currently only the Tigase jabber server versions 4.3.1 and up supports all of these. Don't use
47  Tigase 4.2.0: it contains a bug in the BOSH connection manager that delays closing the chat for
48  5 minutes.
49  Tigase needs SUN JDK (not JRE!) version 1.6.
50  The jabber server only needs to listen on the localhost. The connection with external clients is
51  done through the proxy-component of the webserver.
52
533) Configuration setting up the light variant:
543a) Install and configure Tigase:
55- Make sure 'java' defaults to your SUN JDK 1.6:
56    java -version
57  On Debian based systems you can install it with:
58    sudo aptitude --without-recommends install sun-java6-jdk
59  Note 1: You need the non-free repository to be enabled for this.
60  Note 2: sun-java6-jdk recommends libnss-mdns, which in turn pulls in avahi. I suppose you
61          don't want to run avahi on a server. So install it with the --without-recommends
62          option. This also saves you from some X11-libs.
63  If you have it installed and 'java' points to a wrong version, you can change
64  the defaults with the command:
65    sudo update-alternatives java
66
67- Start the tigase installer for the basic installation:
68    sudo java -jar tigase-server-x.x.x-bxxxx.jar -console
69    - when installing on a computer with a grafical environment, it is easier to leave away the '-console'
70    - use the wizzards for a first installation
71    - at the 'target path': /usr/local/tigase should be a reasonable sane choice
72    - at the start of the configuration, choose: "Default plus extra components"
73    - make sure you include 'localhost' in the list of jabberdomains
74    - make an admin account for localhost (eg: admin@localhost)
75    - you can leave the advanced configuration options off
76
77- To further configure Tigase, you have two options:
78  Option 1:
79    Automatic setup for HelpIM3:
80      sudo ./tigase_setup.sh
81    This script assumes tigase is in /usr/local/tigase. It will:
82       - create the user and group 'tigase'
83       - move logging to /var/log/tigase
84       - move the runfile to /var/run/tigase
85       - move tigase.xml to /var/lib/tigase
86       - move the configuration files to /etc/tigase
87       - automaticly change the configuration files to settings suitable for HelpIM3
88       - create /etc/init.d/tigase and symlinks to it in the rc.d dirs
89  Option 2:
90    Manually configure tigase to your wishes.
91    - Make sure that in init.properties the following lines are present:
92      --comp-name-1=muc
93      --comp-class-1=tigase.muc.MUCComponent
94      muc/muc-allow-chat-states[B]=true
95      muc/muc-lock-new-room[B]=false
96      message-router/components/msg-receivers/s2s.active[B]=false
97      basic-conf/logging/java.util.logging.FileHandler.pattern=/var/log/tigase/tigase.log
98    - You might want to comment out the line "--debug = server" in init.properties: Tigase debug logging is extremely
99      verbose and might contain privacy sensitive data when using it with HelpIM3.
100- Start tigase. If you used the automatic setup for HelpIM3 you can do this
101  with:
102    sudo /etc/init.d/tigase start
103- Note: When changing the init.properties of Tigase, make sure you delete the
104  active tigase.xml before starting tigase again else your changes won't have
105  any effect.
106- To add users (e.g. helpimbot) manually (you might also connect with an jabber client to it and use the
107  clients register function):
108  - edit in the tigase base directory the file scripts/repo.sh to reflect your database
109  - create a file with, for every user you want to add a line like this:
110     helpimbot@localhost,<password>,,,,
111  - import the users with:
112     ./scripts/repo.sh -import import-file.txt
113
1143b) Configuring Apache2
115Apache2 has two functions: it serves the HelpIM webapplication and it proxies the XMPP-BOSH connections HelpIM makes to Tigase. Both need to be setup in Apache2.
116
117- Proxying BOSH:
118  - enable mod_proxy, mod_proxy_connect and mod_proxy_http (if not already done:
119      #/etc/apache2/mods-enabled# ln -s ../mods-available/proxy.load
120      #/etc/apache2/mods-enabled# ln -s ../mods-available/proxy_connect.load
121      #/etc/apache2/mods-enabled# ln -s ../mods-available/proxy_html.load
122      #/etc/apache2/mods-enabled# ln -s ../mods-available/wsgi.load
123  - In some some configs, Debian Lenny for example, there is the file
124    /etc/apache2/mods-enabled/proxy.conf loaded. If so, you need to change
125    the "Deny from all" into "Allow from all".
126    Warning: if you use apache also as a forward proxy (if you have anywhere
127    in your config "ProxyRequests on"), then you must implement a more fine
128    grained access control to your proxy. Otherwise you create an open proxy.
129  - Add to the definition of the virtual host HelpIM is going to run in
130    the following:
131      ProxyRequests Off
132      ProxyPass /http-bind/ http://localhost:5280/http-bind/
133      ProxyPassReverse /http-bind/ http://localhost:5280/http-bind/
134    this creates a reverse proxy to Tigase, while denying all other proxy
135    requests.
136  - Increase in apache2.conf the connection timeout a little:
137      Timeout 360
138    This timeout sets the time a request can take without responding before it
139    is killed off by apache. Unfortunately the default for this timeout (300)
140    is exactly the same as the BOSH 'wait' value used by HelpIM (and many other
141    BOSH clients). That means the proxy kills the request just at the moment
142    the client wants to refresh the connection. Increasing this timeout a
143    little avoids this.
144- Setup the webapplication. When HelpIM is installed in:
145  /home/winfried/werk/HelpIM/svn/HelpIM3/htdocs/ and you want to run HelpIM on
146  the location [www.virtual-host.example]/chi then you need to add the
147  following directives to your definition of www.virtual-host.example:
148        # make sure utf-8 is the default (if it isn't already)
149        <Location /chat/chat>
150                AddDefaultCharset utf-8
151        </Location>
152
153        # Directory for the static files
154        Alias /chat/chat/htdocs/ /usr/local/share/HelpIM/htdocs/
155        <Directory /usr/local/share/HelpIM/htdocs/>
156                Options None
157                AllowOverride None
158                Order allow,deny
159                Allow from all
160        </Directory>
161
162        # Webapp
163        # Note: do not use a trailing slash here, seems to be a bug in mod_wsgi!
164        WSGIScriptAlias /chat/chat /usr/local/lib/python2.5/site-packages/HelpIM/web/HelpIM.wsgi
165        <Directory /usr/local/lib/python2.5/site-packages/HelpIM/web/>
166                Order allow,deny
167                Allow from all
168                # Use one interpreter for all of HelpIM
169                WSGIApplicationGroup HelpIM3
170        </Directory>
171  Based on the hostname of the request, HelpIM wil automaticly look for the
172  correct configuration file in its own configs. It will adjust its paths to
173  path defined in the WSGIScriptAlias directive.
174- Generic performance settings:
175  - Consider raising the 'MaxClients' value in apache2.conf: for each chat,
176    one connection is permanently used and a second (and sometimes even a
177    third) needs to be available. So a MaxClients of 150 is only safe for up to
178    appr. 75 to 100 active chats.
179  - Consider increasing the SSL cache timeout in mods-available/ssl.conf:
180      SSLSessionCacheTimeout 3600
181    Because HelpIM clients generate a lot of subsequential seperate requests,
182    increasing this setting from its default of 300 to something like 3600,
183    saves the server (and the browser) from a lot of extra SSL negotiating.
184- Restart apache2
185
186
1873c) Setting up the database:
188HelpIM uses for each site a separate database. When it detects an empty
189database, it sets up the tables automaticly. To create the database for
190HelpIM:
191- log in to MySQL with enough permissions (probably as root)
192- execute the following SQL:
193    CREATE DATABASE <database_name>;
194    GRANT all ON <database_name>.* TO <username>@localhost IDENTIFIED BY '<password>';
195
1963d) Building pyxmpp for performance  (optional)
197If you don't install pyxmpp from package but from a n other source, you might
198compile it for extra performance. In that case download the sources of pyxmpp
199and make sure you have gcc, python-dev en libxml-dev installed. On a Debian
200system you can do:
201  sudo aptitude install gcc python-dev libxml2-dev
202Then download and unpack pyxmpp and cd to its base directory and do:
203  python configure.py
204  python setup.py build
205  sudo python setup.py install
206And if you don't like to have gcc floating around on your server, purge it
207again. On a Debian system:
208  sudo aptitude purge gcc
209
2103e) Install / configure HelpIM
211The easiest way to do this, is to edit the helpim_setup.sh script to your
212taste and run it as root. It does the following:
213- make and fill /etc/HelpIM
214- place HelpIM in pythonpath, in /usr/local/.../site-packages
215- precompiles HelpIM
216- places the htdocs in /usr/local/share/HelpIM
217- link /usr/local/bin/helpim to bot.py and make it executable
218- place & link /etc/init.d/helpim
219- create /var/log/HelpIM
220- make helpim user & group
221- make www-data member of helpim group
222
223If you placed the configs in an other location then /etc/HelpIM, you must
224also adjust the paths in: HelpIM/paths.py
225
226Next is to adjust the configs. There are two kind of configuration files to
227take care of:
228- The file /etc/HelpIM/config.xml
229  This file contains generic settings for the bot. You must adjust the username
230  and the password to the extra (non-admin) user you created in Tigase. If you
231  changed the paths, you also have to adjust the 'destination' of the <logging>
232  section. Usually the other settings will be ok.
233- The xml files in /etc/HelpIM/sites/
234  For each request HelpIM determines the servername requested. It then looks
235  for a file with the name [servername].xml and loads the configuration for
236  that site from it. When creating a site, you should at least adapt the
237  databaseuri in the '<site>' section. The databaseuri has the form:
238    driver://username:password@host:port/database
239  Allowable drivers are: sqlite, mysql, postgres, oracle, mssql, and firebird.
240  Note you need to have the corresponding Python database driver installed,
241  for the database to function.
242
243If you want, later on, to upgrade HelpIM from the subversion repository, you
244can run the update_HelpIM_from_svn.sh script.
245
246ToDo: default super-user when HelpIM-light is operational
247
2483f) Start the bot:
249  /etc/init.d/helpim start
250Or, if you did al the configuration your self:
251  ./bot.py
252will do too.
253
2543g) Login and chat
255ToDo: to be added when HelpIM-light is operational
256
2574) Where to go from here
258ToDo!
259- embedded
260- full
Note: See TracBrowser for help on using the browser.