Blame view

INSTALL.chat.md 5.82 KB
8808f617   Rodrigo Souto   Chat package
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Automatic XMPP/Chat Setup
=========================

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

Manual XMPP/Chat Setup
======================
0233ac67   Joenio Costa   Adding "Multi-Use...
16

06d664a6   Joenio Costa   Documenting setup...
17
18
The samples of config file to configure a XMPP/BOSH server with ejabberd,
postgresql and apache2 can be found at util/chat directory.
1628c334   Joenio Costa   XMPP/Jabber based...
19

06d664a6   Joenio Costa   Documenting setup...
20
21
This setup supposes that you are using Noosfero installed via Debian package
in a production environment.
1628c334   Joenio Costa   XMPP/Jabber based...
22

06d664a6   Joenio Costa   Documenting setup...
23
Steps
8808f617   Rodrigo Souto   Chat package
24
-----
6cced7ff   Samuel R. C. Vale   Added instruction...
25
26
27

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

af25d9e0   Aurélio A. Heckert   correct markdown ...
28
## 1. Install the required packages
6cced7ff   Samuel R. C. Vale   Added instruction...
29

06d664a6   Joenio Costa   Documenting setup...
30
31
    # apt-get install ejabberd odbc-postgresql librestclient-ruby pidgin-data ruby1.8-dev
    # gem install SystemTimer
6cced7ff   Samuel R. C. Vale   Added instruction...
32

af25d9e0   Aurélio A. Heckert   correct markdown ...
33
## 2. Ejabberd configuration
6cced7ff   Samuel R. C. Vale   Added instruction...
34

06d664a6   Joenio Costa   Documenting setup...
35
    # cp /usr/share/noosfero/util/chat/ejabberd.cfg /etc/ejabberd/
0233ac67   Joenio Costa   Adding "Multi-Use...
36

06d664a6   Joenio Costa   Documenting setup...
37
Edit the /etc/ejabberd/ejabberd.cfg file and set your domain on the first 2 lines.
0233ac67   Joenio Costa   Adding "Multi-Use...
38

06d664a6   Joenio Costa   Documenting setup...
39
## 3. Configuring Postgresql
22fce6dd   Joenio Costa   XMPP/Chat install...
40

06d664a6   Joenio Costa   Documenting setup...
41
42
Give permission to noosfero user create new roles, login as
postgres user and execute:
22fce6dd   Joenio Costa   XMPP/Chat install...
43

06d664a6   Joenio Costa   Documenting setup...
44
45
    $ psql
    postgres=# GRANT CREATE ON DATABASE noosfero TO noosfero;
6cced7ff   Samuel R. C. Vale   Added instruction...
46

06d664a6   Joenio Costa   Documenting setup...
47
48
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:
6cced7ff   Samuel R. C. Vale   Added instruction...
49

06d664a6   Joenio Costa   Documenting setup...
50
51
   # Noosfero user
   local   noosfero    noosfero                          md5
6cced7ff   Samuel R. C. Vale   Added instruction...
52

06d664a6   Joenio Costa   Documenting setup...
53
(add this line before the following line)
6cced7ff   Samuel R. C. Vale   Added instruction...
54

06d664a6   Joenio Costa   Documenting setup...
55
56
   # "local" is for Unix domain socket connections only
   local   all         all                               ident
6cced7ff   Samuel R. C. Vale   Added instruction...
57

06d664a6   Joenio Costa   Documenting setup...
58
Restart postgresql server:
6cced7ff   Samuel R. C. Vale   Added instruction...
59

06d664a6   Joenio Costa   Documenting setup...
60
    # service postgresql restart
6cced7ff   Samuel R. C. Vale   Added instruction...
61

06d664a6   Joenio Costa   Documenting setup...
62
Login as noosfero user, and execute:
6cced7ff   Samuel R. C. Vale   Added instruction...
63

06d664a6   Joenio Costa   Documenting setup...
64
    $ psql -U noosfero -W noosfero < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql
22fce6dd   Joenio Costa   XMPP/Chat install...
65

06d664a6   Joenio Costa   Documenting setup...
66
(see database password in the /etc/noosfero/database.yml file)
22fce6dd   Joenio Costa   XMPP/Chat install...
67

06d664a6   Joenio Costa   Documenting setup...
68
This will create a new schema inside the noosfero database, called `ejabberd`.
6cced7ff   Samuel R. C. Vale   Added instruction...
69

06d664a6   Joenio Costa   Documenting setup...
70
71
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.
6cced7ff   Samuel R. C. Vale   Added instruction...
72

06d664a6   Joenio Costa   Documenting setup...
73
## 4. ODBC configuration
6cced7ff   Samuel R. C. Vale   Added instruction...
74

06d664a6   Joenio Costa   Documenting setup...
75
Create the following files:
6cced7ff   Samuel R. C. Vale   Added instruction...
76

06d664a6   Joenio Costa   Documenting setup...
77
78
    # cp /usr/share/noosfero/util/chat/odbc.ini /etc/
    # cp /usr/share/noosfero/util/chat/odbcinst.ini /etc/
22fce6dd   Joenio Costa   XMPP/Chat install...
79

06d664a6   Joenio Costa   Documenting setup...
80
81
Edit the odbc.ini file and set the password for the database user, see
the file /etc/noosfero/database.yml to get the password.
22fce6dd   Joenio Costa   XMPP/Chat install...
82

06d664a6   Joenio Costa   Documenting setup...
83
Adjust premissions:
6cced7ff   Samuel R. C. Vale   Added instruction...
84

06d664a6   Joenio Costa   Documenting setup...
85
86
    # chmod 640 /etc/odbc.ini
    # chown ejabberd /etc/odbc.ini
6cced7ff   Samuel R. C. Vale   Added instruction...
87

af25d9e0   Aurélio A. Heckert   correct markdown ...
88
## 4.1 testing all:
6cced7ff   Samuel R. C. Vale   Added instruction...
89

af25d9e0   Aurélio A. Heckert   correct markdown ...
90
    # isql 'PostgreSQLEjabberdNoosfero'
cfb0d900   Daniela Feitosa   Fixed chat
91

af25d9e0   Aurélio A. Heckert   correct markdown ...
92
If the configuration was done right, the message "Connected!" will be displayed.
6cced7ff   Samuel R. C. Vale   Added instruction...
93

af25d9e0   Aurélio A. Heckert   correct markdown ...
94
## 5. Enabling kernel polling and SMP in `/etc/default/ejabberd`
6cced7ff   Samuel R. C. Vale   Added instruction...
95

af25d9e0   Aurélio A. Heckert   correct markdown ...
96
97
    POLL=true
    SMP=auto
6cced7ff   Samuel R. C. Vale   Added instruction...
98

af25d9e0   Aurélio A. Heckert   correct markdown ...
99
## 6. Increase the file descriptors limit for user ejabberd
6cced7ff   Samuel R. C. Vale   Added instruction...
100

af25d9e0   Aurélio A. Heckert   correct markdown ...
101
### 6.1. Uncomment this line in file `/etc/pam.d/su`:
6cced7ff   Samuel R. C. Vale   Added instruction...
102

af25d9e0   Aurélio A. Heckert   correct markdown ...
103
    session required pam_limits.so
6cced7ff   Samuel R. C. Vale   Added instruction...
104

af25d9e0   Aurélio A. Heckert   correct markdown ...
105
### 6.2. Add this lines to file `/etc/security/limits.conf`:
6cced7ff   Samuel R. C. Vale   Added instruction...
106

af25d9e0   Aurélio A. Heckert   correct markdown ...
107
108
    ejabberd       hard    nofile  65536
    ejabberd       soft    nofile  65536
6cced7ff   Samuel R. C. Vale   Added instruction...
109
110
111

Now, test the configuration:

af25d9e0   Aurélio A. Heckert   correct markdown ...
112
    # cat /proc/<EJABBERD_BEAM_PROCESS_PID>/limits
6cced7ff   Samuel R. C. Vale   Added instruction...
113

af25d9e0   Aurélio A. Heckert   correct markdown ...
114
## 7. Apache Configuration
6cced7ff   Samuel R. C. Vale   Added instruction...
115

22fce6dd   Joenio Costa   XMPP/Chat install...
116
Apache server must be configurated as follow:
6cced7ff   Samuel R. C. Vale   Added instruction...
117

af25d9e0   Aurélio A. Heckert   correct markdown ...
118
`/etc/apache2/sites-enabled/noosfero`:
6cced7ff   Samuel R. C. Vale   Added instruction...
119

af25d9e0   Aurélio A. Heckert   correct markdown ...
120
121
    RewriteEngine On
    Include /usr/share/noosfero/util/chat/apache/xmpp.conf
6cced7ff   Samuel R. C. Vale   Added instruction...
122

af25d9e0   Aurélio A. Heckert   correct markdown ...
123
`/etc/apache2/apache2.conf`:
6cced7ff   Samuel R. C. Vale   Added instruction...
124

af25d9e0   Aurélio A. Heckert   correct markdown ...
125
126
127
128
129
130
131
132
133
    <IfModule mpm_worker_module>
       StartServers          8
       MinSpareThreads       25
       MaxSpareThreads       75
       ThreadLimit           128
       ThreadsPerChild       128
       MaxClients            2048
       MaxRequestsPerChild   0
    </IfModule>
6cced7ff   Samuel R. C. Vale   Added instruction...
134
135
136

Note: module proxy_http must be enabled:

af25d9e0   Aurélio A. Heckert   correct markdown ...
137
    # a2enmod proxy_http
6cced7ff   Samuel R. C. Vale   Added instruction...
138

06d664a6   Joenio Costa   Documenting setup...
139
Restart services:
6cced7ff   Samuel R. C. Vale   Added instruction...
140

06d664a6   Joenio Costa   Documenting setup...
141
142
143
    # service ejabberd restart
    # service noosfero restart
    # service apache2 restart
6cced7ff   Samuel R. C. Vale   Added instruction...
144

06d664a6   Joenio Costa   Documenting setup...
145
## 8. Test Apache Configuration
6cced7ff   Samuel R. C. Vale   Added instruction...
146

06d664a6   Joenio Costa   Documenting setup...
147
Open in your browser the address:
6cced7ff   Samuel R. C. Vale   Added instruction...
148

06d664a6   Joenio Costa   Documenting setup...
149
    http://<yout domain>/http-bind
6cced7ff   Samuel R. C. Vale   Added instruction...
150

06d664a6   Joenio Costa   Documenting setup...
151
You should see a page with a message like that:
6cced7ff   Samuel R. C. Vale   Added instruction...
152

06d664a6   Joenio Costa   Documenting setup...
153
154
155
156
   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.
6cced7ff   Samuel R. C. Vale   Added instruction...
157

06d664a6   Joenio Costa   Documenting setup...
158
## 9. Test chat session
6cced7ff   Samuel R. C. Vale   Added instruction...
159

8808f617   Rodrigo Souto   Chat package
160
161
Run `./script/noosfero-test-chat-session`. If you have luck, should see
something like that:
6cced7ff   Samuel R. C. Vale   Added instruction...
162

06d664a6   Joenio Costa   Documenting setup...
163
164
165
166
167
168
169
170
171
172
173
Ruby-BOSH - SEND
<body window="5" rid="60265" xmlns="http://jabber.org/protocol/httpbind" xmlns:xmpp="urn:xmpp:xbosh" to="vagrant-debian-squeeze.vagrantup.com" wait="30" xmpp:version="1.0" hold="1"/>
Ruby-BOSH - SEND
<body rid="60266" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Z3Vlc3RAdmFncmFudC1kZWJpYW4tc3F1ZWV6ZS52YWdyYW50dXAuY29tAGd1ZXN0ADEzZTFhYWVlYjRhYjZlMTA0MmRkNWI1YWY0MzM4MjA1OGJiOWZmNzk=</auth></body>
Ruby-BOSH - SEND
<body xmpp:restart="true" rid="60267" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"/>
Ruby-BOSH - SEND
<body rid="60268" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><iq type="set" xmlns="jabber:client" id="bind_29330"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>bosh_9631</resource></bind></iq></body>
Ruby-BOSH - SEND
<body rid="60269" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><iq type="set" xmlns="jabber:client" id="sess_21557"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq></body>
=> ["guest@vagrant-debian-squeeze.vagrantup.com", "24cdfc43646a2af1059a7060b677c2e11b26f34f", 60270]