Since Noosfero 1.2, the XMPP/Chat can be installed via noosfero-chat
Debian
package. So you don't need to follow the manual instructions here if you
already have it installed on your system.
But if you are going to install the noosfero-chat
package on a system that
already has noosfero
older 1.2 installed then you need to check if apache's
configuration file /etc/apache2/sites-available/noosfero
has this line below:
Include /usr/share/noosfero/util/chat/apache/xmpp.conf
The samples of config file to configure a XMPP/BOSH server with ejabberd, postgresql and apache2 can be found at util/chat directory.
This setup supposes that you are using Noosfero installed via Debian package in a production environment.
This is a step-by-step guide to get a XMPP service working, in a Debian system.
# apt-get install ejabberd odbc-postgresql librestclient-ruby pidgin-data ruby1.8-dev
# gem install SystemTimer
# cp /usr/share/noosfero/util/chat/ejabberd.cfg /etc/ejabberd/
Edit the /etc/ejabberd/ejabberd.cfg file and set your domain on the first 2 lines.
Give permission to noosfero user create new roles, login as postgres user and execute:
$ psql
postgres=# GRANT CREATE ON DATABASE noosfero TO noosfero;
Change the postgresql authentication method to md5 instead of ident, add the following line to the file /etc/postgresql/8.4/main/pg_hba.conf:
local noosfero noosfero md5
(add this line before the following line)
local all all ident
Restart postgresql server:
# service postgresql restart
Login as noosfero user, and execute:
$ psql -U noosfero -W noosfero < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql
(see database password in the /etc/noosfero/database.yml file)
This will create a new schema inside the noosfero database, called ejabberd
.
Note that 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.
Create the following files:
# cp /usr/share/noosfero/util/chat/odbc.ini /etc/
# cp /usr/share/noosfero/util/chat/odbcinst.ini /etc/
Edit the odbc.ini file and set the password for the database user, see the file /etc/noosfero/database.yml to get the password.
Adjust premissions:
# chmod 640 /etc/odbc.ini
# chown ejabberd /etc/odbc.ini
# isql 'PostgreSQLEjabberdNoosfero'
If the configuration was done right, the message "Connected!" will be displayed.
POLL=true
SMP=auto
session required pam_limits.so
ejabberd hard nofile 65536
ejabberd soft nofile 65536
Now, test the configuration:
# cat /proc/<EJABBERD_BEAM_PROCESS_PID>/limits
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
</IfModule>
Note: module proxy_http must be enabled:
# a2enmod proxy_http
Restart services:
# service ejabberd restart
# service noosfero restart
# service apache2 restart
Open in your browser the address:
http://<yout domain>/http-bind
You should see a page with a message like that:
ejabberd mod_http_bind An implementation of XMPP over BOSH (XEP-0206) This web page is only informative. To use HTTP-Bind you need a Jabber/XMPP client that supports it.
Run ./script/noosfero-test-chat-session
. If you have luck, should see
something like that:
Ruby-BOSH - SEND
Ruby-BOSH - SEND Z3Vlc3RAdmFncmFudC1kZWJpYW4tc3F1ZWV6ZS52YWdyYW50dXAuY29tAGd1ZXN0ADEzZTFhYWVlYjRhYjZlMTA0MmRkNWI1YWY0MzM4MjA1OGJiOWZmNzk= Ruby-BOSH - SEND Ruby-BOSH - SEND bosh_9631 Ruby-BOSH - SEND => ["[email protected]", "24cdfc43646a2af1059a7060b677c2e11b26f34f", 60270]