Commit 6cced7ffd54675cde9bbcc455962c11ee85e15f8

Authored by Samuel R. C. Vale
Committed by Antonio Terceiro
1 parent 39e83093

Added instructions to XMPP chat setup.

Step-by-step instructions to setup a XMPP server for Noosfero chat.
This include Ejabberd, ODBC, PostgreSQL, Apache and DNS configurations.

This instructions were originally written by
Marcelo Jorge Vieira <metal@holoscopio.com>, now revised, translated
and "formated".
Showing 1 changed file with 217 additions and 14 deletions   Show diff stats
INSTALL.chat
... ... @@ -13,11 +13,47 @@ To configure XMPP/BOSH in Noosfero you need:
13 13 Take a look at util/chat directory to see samples of config file to configure a
14 14 XMPP/BOSH server with ejabberd, postgresql and apache2.
15 15  
16   -== Server setup
17 16  
18   -Ejabberd creates semi-anonymous rooms by default, but Noosfero's Jabber client needs
19   -non-anonymous room, then we need to change default params of creation rooms in ejabberd
20   -to create non-anonymous rooms.
  17 +== XMPP Server Setup
  18 +
  19 +This is a step-by-step guide to get a XMPP service working, in a Debian system.
  20 +
  21 +1. Install the required packages
  22 +
  23 +# aptitude install ejabberd odbc-postgresql
  24 +
  25 +
  26 +2. Ejabberd configuration
  27 +
  28 +All the following changes must be done in config file:
  29 +
  30 + /etc/ejabberd/ejabberd.cfg
  31 +
  32 + 2.1. Set the default admin user
  33 +
  34 +{ acl, admin, { user, "", "localhost" } }.
  35 +
  36 + 2.2. Set the default host
  37 +
  38 +{ hosts, [ "localhost" ] }.
  39 +
  40 + 2.3. Http-Bind activation
  41 +
  42 +{ 5280, ejabberd_http, [
  43 + http bind,
  44 + ]
  45 +}
  46 +
  47 +(...)
  48 +
  49 +{ modules, [
  50 + ...
  51 + { mod_http_bind, [] }
  52 +] }.
  53 +
  54 +Ejabberd creates semi-anonymous rooms by default, but Noosfero's Jabber client
  55 +needs non-anonymous room, then we need to change default params of creation
  56 +rooms in ejabberd to create non-anonymous rooms.
21 57  
22 58 In non-anonymous rooms the jabber service sends the new occupant's full JID to
23 59 all occupants in the room[1].
... ... @@ -25,15 +61,182 @@ all occupants in the room[1].
25 61 Add option "{default_room_options, [{anonymous, false}]}" to
26 62 /etc/ejabberd/ejabberd.cfg to mod_muc session. See below:
27 63  
28   - {mod_muc, [
29   - %%{host, "conference.@HOST@"},
30   - {access, muc},
31   - {access_create, muc},
32   - {access_persistent, muc},
33   - {access_admin, muc_admin},
34   - {max_users, 500},
35   - {default_room_options, [{anonymous, false}]}
36   - ]},
37   -
  64 +{ mod_muc, [
  65 + %%{host, "conference.@HOST@"},
  66 + {access, muc},
  67 + {access_create, muc},
  68 + {access_persistent, muc},
  69 + {access_admin, muc_admin},
  70 + {max_users, 500},
  71 + {default_room_options, [{anonymous, false}]}
  72 +]},
38 73  
39 74 [1] - http://xmpp.org/extensions/xep-0045.html#enter-nonanon
  75 +
  76 +
  77 + 2.4. Authentication method
  78 +
  79 +To use Postgresql through ODBC, the following modifications must be done:
  80 +
  81 + * Disable the default method:
  82 +
  83 +{ auth_method, internal }.
  84 +
  85 + * Enable autheticantion through ODBC:
  86 +
  87 +{ auth_method, odbc }.
  88 +{ odbc_server, "DSN=PSQLejabberd" }.
  89 +
  90 +
  91 + 2.5. Increase the shaper traffic limit
  92 +
  93 +{ shaper, normal, { maxrate, 10000000 } }.
  94 +
  95 +
  96 + 2.6. Disable unused modules
  97 +
  98 +Unused modules can be disabled, for example:
  99 +
  100 + * s2s
  101 + * web_admin
  102 + * mod_pubsub
  103 + * mod_irc
  104 + * mod_offine
  105 + * ...
  106 +
  107 +
  108 +3. Configuring Postgresql
  109 +
  110 + 3.1. Create a new database
  111 +
  112 +# createdb ejabberd
  113 +
  114 +
  115 + 3.2. Basic database scheme for this setup:
  116 +
  117 +# zcat /usr/share/doc/ejabberd/examples/pg.sql.gz > pg.sql
  118 +# psql ejabberd < pg.sql
  119 +
  120 +
  121 +4. ODBC configuration
  122 +
  123 +The following files must be created:
  124 +
  125 + * /etc/odbc.ini
  126 +
  127 +[ PSQLejabberd ]
  128 + Description = PostgreSQL
  129 + Driver = PostgreSQL Unicode
  130 + Trace = No
  131 + TraceFile = /tmp/psqlodbc.log
  132 + Database = ejabberd
  133 + Servername = localhost
  134 + UserName = USER
  135 + Password = PASSWORD
  136 + Port =
  137 + ReadOnly = No
  138 + RowVersioning = No
  139 + ShowSystemTables= No
  140 + ShowOidColumn = No
  141 + FakeOidIndex = No
  142 + ConnSettings =
  143 +
  144 + * /etc/odbcinst.ini
  145 +
  146 +[ PostgreSQL Unicode ]
  147 + Description = PostgreSQL ODBC driver ( Unicode version )
  148 + Driver = /usr/lib/odbc/psqlodbcw.so
  149 + Setup = /usr/lib/odbc/libodbcpsqlS.so
  150 + Debug = 0
  151 + CommLog = 1
  152 + UsageCount = 3
  153 +
  154 + * testing all:
  155 +
  156 +# isql 'PSQLejabberd' USER
  157 +
  158 +
  159 +5. Enabling kernel polling and SMP in /etc/default/ejabberd
  160 +
  161 +POLL = true
  162 +SMP = auto
  163 +
  164 +
  165 +6. Increase the file descriptors limit for user ejabberd
  166 +
  167 + 6.1. Uncomment this line in file /etc/pam.d/su:
  168 +
  169 +session required pam_limits.so
  170 +
  171 +
  172 + 6.2. Add this lines to file /etc/security/limits.conf:
  173 +
  174 +ejabberd hard nofile 65536
  175 +ejabberd soft nofile 65536
  176 +
  177 +Now, test the configuration:
  178 +
  179 +# cat /proc/<EJABBERD_BEAM_PROCESS_PID>/limits
  180 +
  181 +
  182 +7. Apache Configuration
  183 +
  184 +Be our server is jabber-br.org, Apache server must be configurated as follow:
  185 +
  186 + * /etc/apache2/sites-available/jabber-br-proxy:
  187 +
  188 +ProxyPass /http-bind/ https://jabber-br.org:5280/http-bind/
  189 + <Proxy ∗>
  190 + Order deny, allow
  191 + Allow from all
  192 + </Proxy>
  193 +
  194 + * /etc/apache2/apache2.conf:
  195 +
  196 +<IfModule mpm_worker_module>
  197 + StartServers 8
  198 + MinSpareThreads 25
  199 + MaxSpareThreads 75
  200 + ThreadLimit 128
  201 + ThreadsPerChild 128
  202 + MaxClients 2048
  203 + MaxRequestsPerChild 0
  204 +</IfModule>
  205 +
  206 +Note: module proxy_http must be enabled:
  207 +
  208 +# a2enmod proxy_http
  209 +
  210 +
  211 +8. DNS configuration
  212 +
  213 + * /etc/bind/db.colivre:
  214 +
  215 +_xmpp-client._tcp SRV 5 100 5222 master
  216 +(...)
  217 +conference CNAME master
  218 +_xmpp-client._tcp.conference SRV 5 100 5222 master
  219 +
  220 +
  221 +9. Testing this Setup
  222 +
  223 +Adjust shell limits to proceed with some benchmarks and load tests:
  224 +
  225 +# ulimit −s 256
  226 +# ulimit −n 8192
  227 +# echo 10 > /proc/sys/net/ipv4/tcp_syn_retries
  228 +
  229 +To measure the bandwidth between server and client:
  230 +
  231 + * at server side:
  232 +
  233 +# iperf −s
  234 +
  235 + * at client side:
  236 +
  237 +# iperf −c server_ip
  238 +
  239 +For heavy load tests, clone and use this software:
  240 +
  241 +git clone http://git.holoscopio.com/git/metal/tester.git
  242 +
... ...