Commit 8808f617271cdbc003775a850904829addd36994
Committed by
Joenio Costa
1 parent
0096a365
Exists in
staging
and in
42 other branches
Chat package
Now noosfero will generate a debian package to install the chat. The generated package is named 'noosfero-chat'. Signed-off-by: Joenio Costa <joenio@colivre.coop.br>
Showing
16 changed files
with
180 additions
and
14 deletions
Show diff stats
INSTALL.chat.md
1 | -XMPP/Chat Setup | |
2 | -=============== | |
1 | +Automatic XMPP/Chat Setup | |
2 | +========================= | |
3 | + | |
4 | +Since Noosfero 1.2, the XMPP/Chat can be installed via `noosfero-chat` Debian | |
5 | +package. So you don't need to follow the manual instructions here if you | |
6 | +already have it installed on your system. | |
7 | + | |
8 | +But if you are going to install the `noosfero-chat` package on a system that | |
9 | +already has `noosfero` older 1.2 installed then you need to check if apache's | |
10 | +configuration file `/etc/apache2/sites-available/noosfero` has this line below: | |
11 | + | |
12 | + Include /usr/share/noosfero/util/chat/apache/xmpp.conf | |
13 | + | |
14 | +Manual XMPP/Chat Setup | |
15 | +====================== | |
3 | 16 | |
4 | 17 | The samples of config file to configure a XMPP/BOSH server with ejabberd, |
5 | 18 | postgresql and apache2 can be found at util/chat directory. |
... | ... | @@ -8,7 +21,7 @@ This setup supposes that you are using Noosfero installed via Debian package |
8 | 21 | in a production environment. |
9 | 22 | |
10 | 23 | Steps |
11 | -===== | |
24 | +----- | |
12 | 25 | |
13 | 26 | This is a step-by-step guide to get a XMPP service working, in a Debian system. |
14 | 27 | |
... | ... | @@ -144,15 +157,8 @@ You should see a page with a message like that: |
144 | 157 | |
145 | 158 | ## 9. Test chat session |
146 | 159 | |
147 | -Open Noosfero console and execute: | |
148 | - | |
149 | ->> environment = Environment.default | |
150 | ->> user = Person['guest'] | |
151 | ->> password = user.user.crypted_password | |
152 | ->> login = user.jid | |
153 | ->> RubyBOSH.initialize_session(login, password, "http://#{environment.default_hostname}/http-bind", :wait => 30, :hold => 1, :window => 5 | |
154 | - | |
155 | -If you have luck, should see something like that: | |
160 | +Run `./script/noosfero-test-chat-session`. If you have luck, should see | |
161 | +something like that: | |
156 | 162 | |
157 | 163 | Ruby-BOSH - SEND |
158 | 164 | <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"/> | ... | ... |
debian/changelog
1 | -noosfero (1.2~0) UNRELEASED; urgency=medium | |
1 | +noosfero (1.2~1) UNRELEASED; urgency=medium | |
2 | 2 | |
3 | + [ Antonio Terceiro ] | |
3 | 4 | * Temporary version in heavy development |
4 | 5 | |
5 | - -- Antonio Terceiro <terceiro@debian.org> Fri, 08 May 2015 16:08:18 -0300 | |
6 | + [ Joenio Costa ] | |
7 | + * Build noosfero-chat package | |
8 | + | |
9 | + -- Joenio Costa <joenio@colivre.coop.br> Mon, 18 May 2015 14:32:21 -0300 | |
6 | 10 | |
7 | 11 | noosfero (1.1) wheezy; urgency=low |
8 | 12 | ... | ... |
debian/control
... | ... | @@ -85,3 +85,14 @@ Description: free web-based platform for social networks (apache frontend) |
85 | 85 | . |
86 | 86 | This package contains the configuration files needed to run Noosfero with the |
87 | 87 | Apache HTTPD server as frontend. |
88 | + | |
89 | +Package: noosfero-chat | |
90 | +Architecture: all | |
91 | +Depends: noosfero (>= 1.2), ejabberd, odbc-postgresql, pidgin-data | |
92 | +Description: free web-based platform for social networks (ejabberd based chat) | |
93 | + Noosfero is a web platform for social and solidarity economy networks with | |
94 | + blog, e-Porfolios, CMS, RSS, thematic discussion, events agenda and collective | |
95 | + inteligence for solidarity economy in the same system. | |
96 | + . | |
97 | + This package contains the configuration files needed to run Noosfero with the | |
98 | + Ejabberd XMPP chat server. | ... | ... |
... | ... | @@ -0,0 +1,6 @@ |
1 | +debian/default/noosfero-chat etc/default | |
2 | +util/chat/ejabberd.cfg etc/ejabberd | |
3 | +debian/update-noosfero-odbc usr/sbin | |
4 | +etc/security/limits.d/noosfero-chat.conf etc/security/limits.d | |
5 | +etc/pam.d/noosfero-chat etc/pam.d | |
6 | +debian/apache2/conf.d/noosfero-chat etc/apache2/conf.d | ... | ... |
... | ... | @@ -0,0 +1,50 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +set -e | |
4 | + | |
5 | +. /usr/share/debconf/confmodule | |
6 | + | |
7 | +echo -n "Fetching noosfero domain ..." | |
8 | +domain=$(noosfero-runner 'puts Environment.default.default_hostname(true)') | |
9 | +echo " [domain = $domain]" | |
10 | + | |
11 | +ejabberd_config='/etc/ejabberd/ejabberd.cfg' | |
12 | +if test -f $ejabberd_config; then | |
13 | + sed -i "s/acl, *\([^,]*\), *{user, *\([^,]*\), *[^}]*/acl, \1, {user, \2, \"$domain\"/" /etc/ejabberd/ejabberd.cfg | |
14 | + sed -i "s/hosts, *\[[^]]*/hosts, [\"$domain\"/" /etc/ejabberd/ejabberd.cfg | |
15 | +fi | |
16 | + | |
17 | +echo -n 'Fetching noosfero database name ...' | |
18 | +noosfero_database=$(noosfero-runner 'puts Environment.connection_config[:database]') | |
19 | +echo " [database = $noosfero_database]" | |
20 | + | |
21 | +echo 'Creating ejabberd schema ...' | |
22 | +. /etc/default/noosfero | |
23 | +noosfero_user="$NOOSFERO_USER" | |
24 | +su - postgres -c "psql -c 'GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;' > /dev/null" | |
25 | +su - $noosfero_user -c 'rails dbconsole production < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql > /dev/null' | |
26 | + | |
27 | +if which update-noosfero-odbc > /dev/null ; then | |
28 | + update-noosfero-odbc | |
29 | +fi | |
30 | + | |
31 | +ejabberd_default='/etc/default/ejabberd' | |
32 | +noosfero_chat_default='/etc/default/noosfero-chat' | |
33 | +if test -f $ejabberd_default; then | |
34 | + if ! cat $ejabberd_default | grep "^\. $noosfero_chat_default" > /dev/null ; then | |
35 | + echo 'Extending ejabberd defaults with noosfero-chat defaults ...' | |
36 | + echo ". $noosfero_chat_default" >> $ejabberd_default | |
37 | + fi | |
38 | +fi | |
39 | + | |
40 | +a2enmod proxy_http | |
41 | + | |
42 | +invoke-rc.d ejabberd restart | |
43 | +invoke-rc.d noosfero restart | |
44 | +invoke-rc.d apache2 restart | |
45 | + | |
46 | +# stop debconf to avoid the problem with infinite hanging, cfe | |
47 | +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295477 | |
48 | +db_stop | |
49 | + | |
50 | +#DEBHELPER# | ... | ... |
debian/noosfero.install
... | ... | @@ -17,6 +17,7 @@ debian/dbupgrade usr/lib/noosfero |
17 | 17 | debian/default/noosfero etc/default |
18 | 18 | debian/noosfero-check-dbconfig usr/sbin |
19 | 19 | debian/noosfero-console usr/sbin |
20 | +debian/noosfero-runner usr/sbin | |
20 | 21 | debian/noosfero.yml etc/noosfero |
21 | 22 | debian/thin.yml etc/noosfero |
22 | 23 | doc usr/share/noosfero | ... | ... |
... | ... | @@ -0,0 +1,14 @@ |
1 | +#!/bin/sh | |
2 | + | |
3 | +set -e | |
4 | + | |
5 | +# automatically update configuration, but if package noosfero is also installed | |
6 | +if test -x /usr/share/noosfero/script/odbcconf; then | |
7 | + config_file="/etc/odbc.ini" | |
8 | + if test -e "$config_file"; then | |
9 | + echo "Overwriting $config_file ..." | |
10 | + fi | |
11 | + /usr/share/noosfero/script/odbcconf > "$config_file" | |
12 | + | |
13 | + echo 'Noosfero ODBC configuration updated.' | |
14 | +fi | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +session required pam_limits.so | ... | ... |
script/apacheconf
... | ... | @@ -32,6 +32,7 @@ when 'virtualhosts' |
32 | 32 | puts " #{server_directive} #{domain.name}" |
33 | 33 | server_directive = 'ServerAlias' |
34 | 34 | end |
35 | + puts " Include /usr/share/noosfero/util/chat/apache/xmpp.conf" | |
35 | 36 | puts " Include /etc/noosfero/apache/virtualhost.conf" |
36 | 37 | puts "</VirtualHost>" |
37 | 38 | end | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +#!/usr/bin/env ruby | |
2 | +require File.dirname(__FILE__) + '/../config/environment' | |
3 | + | |
4 | +environment = Environment.default | |
5 | +person = Person.first | |
6 | +password = person.user.crypted_password | |
7 | +login = person.jid | |
8 | + | |
9 | +begin | |
10 | + RubyBOSH.initialize_session( | |
11 | + login, | |
12 | + password, | |
13 | + "http://#{environment.default_hostname}/http-bind", | |
14 | + :wait => 30, | |
15 | + :hold => 1, | |
16 | + :window => 5 | |
17 | + ) | |
18 | +rescue Exception => e | |
19 | + puts "" | |
20 | + puts "[ERROR] XMPP/Chat setup isn't working" | |
21 | + puts "-------------------------------------" | |
22 | + puts e.to_s | |
23 | + exit 1 | |
24 | +else | |
25 | + puts "" | |
26 | + puts "[OK] XMPP/Chat setup is working" | |
27 | + exit 0 | |
28 | +end | ... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +require 'yaml' | |
4 | +config = YAML.load_file(File.dirname(__FILE__) + '/../config/database.yml')['production'] | |
5 | + | |
6 | + | |
7 | +puts "[PostgreSQLEjabberdNoosfero]" | |
8 | +puts "Description = PostgreSQL Noosfero ejabberd database" | |
9 | +puts "Driver = PostgreSQL Unicode" | |
10 | +puts "Trace = No" | |
11 | +puts "TraceFile = /tmp/psqlodbc.log" | |
12 | +puts "Database = #{config['database']}" | |
13 | +puts "Servername = #{config['host'] || 'localhost'}" | |
14 | +puts "UserName = #{config['username']}" | |
15 | +puts "Password = #{config['password']}" | |
16 | +puts "Port = #{config['port'] || '5432'}" | |
17 | +puts "ReadOnly = No" | |
18 | +puts "RowVersioning = No" | |
19 | +puts "ShowSystemTables = No" | |
20 | +puts "ShowOidColumn = No" | |
21 | +puts "FakeOidIndex = No" | |
22 | +puts "ConnSettings = SET search_path TO ejabberd" | ... | ... |
util/chat/apache/xmpp.conf