INSTALL.chat 4.73 KB
== Client setup

To configure XMPP/BOSH in Noosfero you need:

* REST Client - http://github.com/archiloque/rest-client
* SystemTimer - http://ph7spot.com/musings/system-timer
* Pidgin data files - http://www.pidgin.im/

# apt-get install librestclient-ruby
# apt-get install libsystemtimer-ruby (depends to do Debian package to this)
# apt-get install pidgin-data

Take a look at util/chat directory to see samples of config file to configure a
XMPP/BOSH server with ejabberd, postgresql and apache2.


== XMPP Server Setup

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

1. Install the required packages

# aptitude install ejabberd odbc-postgresql


2. Ejabberd configuration

All the following changes must be done in config file:

 /etc/ejabberd/ejabberd.cfg

 2.1. Set the default admin user

{ acl, admin, { user, "", "localhost" } }.

 2.2. Set the default host

{ hosts, [ "localhost" ] }.

 2.3. Http-Bind activation

{ 5280, ejabberd_http, [
		http bind,
	]
}

(...)

{ 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 to 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] - http://xmpp.org/extensions/xep-0045.html#enter-nonanon


 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 }.
{ odbc_server, "DSN=PSQLejabberd" }.


 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_offine
 * ...


3. Configuring Postgresql

Change to the noosfero user, and:

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

where "noosfero_production" may need to be replace by the name of the
database used for noosfero.

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

4. ODBC configuration

The following files must be created:

 * /etc/odbc.ini

[ PSQLejabberd ]
	Description	= PostgreSQL
	Driver		= PostgreSQL Unicode
	Trace		= No
	TraceFile	= /tmp/psqlodbc.log
	Database	= ejabberd
	Servername	= localhost
	UserName	= USER
	Password	= PASSWORD
	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/psqlodbcw.so
	Setup		= /usr/lib/odbc/libodbcpsqlS.so
	Debug		= 0
	CommLog		= 1
	UsageCount	= 3

 * testing all:

# isql 'PSQLejabberd' USER


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

POLL = true
SMP = auto


6. Increase the file descriptors limit for user ejabberd

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

session required pam_limits.so


 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

Be our server is jabber-br.org, Apache server must be configurated as follow:

 * /etc/apache2/sites-available/jabber-br-proxy:

ProxyPass /http-bind/ https://jabber-br.org:5280/http-bind/
	<Proxy ∗>
		Order deny, allow
		Allow from all
	</Proxy>

 * /etc/apache2/apache2.conf:

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

Note: module proxy_http must be enabled:

# a2enmod proxy_http


8. DNS configuration

 * /etc/bind/db.colivre:

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


9. Testing this Setup

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

# ulimit −s 256
# ulimit −n 8192
# echo 10 > /proc/sys/net/ipv4/tcp_syn_retries

To measure the bandwidth between server and client:

 * at server side:

# iperf −s

 * at client side:

# iperf −c server_ip

For heavy load tests, clone and use this software:

git clone http://git.holoscopio.com/git/metal/tester.git