-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.chat
258 lines (164 loc) · 5.74 KB
/
INSTALL.chat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
== XMPP/Chat 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/
If you use Debian Lenny:
# apt-get install librestclient-ruby (from backports)
# apt-get install pidgin-data
# apt-get install ruby1.8-dev
# gem install SystemTimer
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/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 -t lenny-backports install ejabberd
# apt-get install 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, "john", "www.example.com" } }.
{ acl, admin, { user, "bart", "www.example.com" } }.
2.2. Set the default host
{ hosts, [ "www.example.com" ] }.
2.3. Http-Bind activation
{ 5280, ejabberd_http, [
http_bind,
web_admin
]
}
(...)
{ 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] - 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}.
* 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_offine
* 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
Noosfero.
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 couldn't see your friends online.
4. ODBC configuration
The following files must be created:
* /etc/odbc.ini
[PostgreSQLEjabberdNoosfero]
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/psqlodbcw.so
Setup = /usr/lib/odbc/libodbcpsqlS.so
Debug = 0
CommLog = 1
UsageCount = 3
* testing all:
# isql 'PostgreSQLEjabberdNoosfero' DBUSER
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
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
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:
# 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