Project: Noosfero
Code Location: git://
Download File
== XMPP/Chat Client Setup

To configure XMPP/BOSH in Noosfero you need:

* REST Client -
* SystemTimer -
* Pidgin data files -

If you use Debian 6.0 (squeeze):

# apt-get install librestclient-ruby pidgin-data ruby1.8-dev
# gem install SystemTimer

The samples of config file to configure a XMPP/BOSH server with
ejabberd, postgresql and apache2 can be found at util/chat directory.

== XMPP/Chat Server Setup

This is a step-by-step guide to get a XMPP service working, in a Debian system.

1. Install the required packages

# apt-get install ejabberd odbc-postgresql

2. Ejabberd configuration

All the following changes must be done in config file:


 2.1. Set the default admin user

{ acl, admin, { user, "john", "" } }.
{ acl, admin, { user, "bart", "" } }.

 2.2. Set the default host

{ hosts, [ "" ] }.

 2.3. Http-Bind activation

{ 5280, ejabberd_http, [


{ modules, [
   {mod_http_bind, []},
] }.

Ejabberd creates semi-anonymous rooms by default, but Noosfero's Jabber client
needs non-anonymous room, then we need to change default params of creation
rooms in ejabberd to create non-anonymous rooms.

In non-anonymous rooms the jabber service sends the new occupant's full JID to
all occupants in the room[1].

Add option "{default_room_options, [{anonymous, false}]}" to
/etc/ejabberd/ejabberd.cfg in mod_muc session. See below:

{ mod_muc, [
   %%{host, "conference.@HOST@"},
   {access, muc},
   {access_create, muc},
   {access_persistent, muc},
   {access_admin, muc_admin},
   {max_users, 500},
   {default_room_options, [{anonymous, false}]}

[1] -

 2.4. Authentication method

To use Postgresql through ODBC, the following modifications must be done:

 * Disable the default method:

{auth_method, internal}.

 * Enable autheticantion through ODBC:

{auth_method, odbc}.

 * Set database server name

{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.

 2.5. Increase the shaper traffic limit

{ shaper, normal, { maxrate, 10000000 } }.

 2.6. Disable unused modules

Unused modules can be disabled, for example:

 * s2s
 * web_admin
 * mod_pubsub
 * mod_irc
 * mod_offline
 * mod_admin_extra
 * mod_register

 2.7. Enable ODBC modules

 * mod_privacy -> mod_privacy_odbc
 * mod_private -> mod_private_odbc
 * mod_roster  -> mod_roster_odbc

3. Configuring Postgresql

Login as noosfero user, and execute:

   $ psql noosfero < /path/to/noosfero/util/chat/postgresql/ejabberd.sql

Where 'noosfero' may need to be replace by the name of the database used for

This will create a new schema inside the noosfero database, called 'ejabberd'.

Note 'noosfero' user should have permission to create Postgresql schemas. Also,
there should be at least one domain with 'is_default = true' in 'domains'
table, otherwise people won't be able to see their friends online.

4. ODBC configuration

The following files must be created:

 * /etc/odbc.ini

Description      = PostgreSQL Noosfero ejabberd database
Driver           = PostgreSQL Unicode
Trace            = No
TraceFile        = /tmp/psqlodbc.log
Database         = noosfero
Servername       = localhost
UserName         = <DBUSER>
Password         = <DBPASS>
Port             =
ReadOnly         = No
RowVersioning    = No
ShowSystemTables = No
ShowOidColumn    = No
FakeOidIndex     = No
ConnSettings     = SET search_path TO ejabberd

 * /etc/odbcinst.ini

[PostgreSQL Unicode]
Description = PostgreSQL ODBC driver (Unicode version)
Driver      = /usr/lib/odbc/
Setup       = /usr/lib/odbc/
Debug       = 0
CommLog     = 1
UsageCount  = 3

 4.1 testing all:

# isql 'PostgreSQLEjabberdNoosfero'

If the configuration was done right, the message "Connected!"
will be displayed.

5. Enabling kernel polling and SMP in /etc/default/ejabberd


6. Increase the file descriptors limit for user ejabberd

 6.1. Uncomment this line in file /etc/pam.d/su:

session required

 6.2. Add this lines to file /etc/security/limits.conf:

ejabberd       hard    nofile  65536
ejabberd       soft    nofile  65536

Now, test the configuration:

# cat /proc/<EJABBERD_BEAM_PROCESS_PID>/limits

7. Apache Configuration

Apache server must be configurated as follow:

 * /etc/apache2/sites-enabled/noosfero

RewriteEngine On
Include /usr/share/noosfero/util/chat/apache/xmpp.conf

 * /etc/apache2/apache2.conf:

<IfModule mpm_worker_module>
   StartServers          8
   MinSpareThreads       25
   MaxSpareThreads       75
   ThreadLimit           128
   ThreadsPerChild       128
   MaxClients            2048
   MaxRequestsPerChild   0

Note: module proxy_http must be enabled:

# a2enmod proxy_http

8. DNS configuration

For this point, we assume you are using BIND as your DNS server. You need to
add the following entries to the DNS zone file corresponding to the domain
of your noosfero site:

_xmpp-client._tcp   SRV   5 100 5222 master
conference   CNAME master
_xmpp-client._tcp.conference   SRV   5 100 5222 master

If you are running a DNS server other than BIND, you will have to figure out
how to create equivalente rules for your zone file. Patches to this
documentation are welcome.

9. Testing this Setup

Adjust shell limits to proceed with some benchmarks and load tests: 

# ulimits 256
# ulimitn 8192
# echo 10 > /proc/sys/net/ipv4/tcp_syn_retries

To measure the bandwidth between server and client:

 * at server side:

# iperfs

 * at client side:

# iperfc server_ip

For heavy load tests, clone and use this software:

git clone