[noosfero/noosfero][master] 2 commits: Chat package
Joenio Costa
gitlab at gitlab.com
Fri May 22 20:07:07 BRT 2015
Joenio Costa pushed to branch master at Noosfero / noosfero
Commits:
8808f617 by Rodrigo Souto at 2015-05-22T20:02:53Z
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 at colivre.coop.br>
- - - - -
2079fa79 by Joenio Costa at 2015-05-22T20:06:38Z
Merge branch 'diguliu/noosfero-chat-package'
- - - - -
16 changed files:
- INSTALL.chat.md
- + debian/apache2/conf.d/noosfero-chat
- debian/changelog
- debian/control
- + debian/default/noosfero-chat
- + debian/noosfero-chat.install
- + debian/noosfero-chat.postinst
- + debian/noosfero-runner
- debian/noosfero.install
- + debian/update-noosfero-odbc
- + etc/pam.d/noosfero-chat
- + etc/security/limits.d/noosfero-chat.conf
- script/apacheconf
- + script/noosfero-test-chat-session
- + script/odbcconf
- util/chat/apache/xmpp.conf
Changes:
=====================================
INSTALL.chat.md
=====================================
--- a/INSTALL.chat.md
+++ b/INSTALL.chat.md
@@ -1,5 +1,18 @@
-XMPP/Chat Setup
-===============
+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
+======================
The samples of config file to configure a XMPP/BOSH server with ejabberd,
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
in a production environment.
Steps
-=====
+-----
This is a step-by-step guide to get a XMPP service working, in a Debian system.
@@ -144,15 +157,8 @@ You should see a page with a message like that:
## 9. Test chat session
-Open Noosfero console and execute:
-
->> environment = Environment.default
->> user = Person['guest']
->> password = user.user.crypted_password
->> login = user.jid
->> RubyBOSH.initialize_session(login, password, "http://#{environment.default_hostname}/http-bind", :wait => 30, :hold => 1, :window => 5
-
-If you have luck, should see something like that:
+Run `./script/noosfero-test-chat-session`. If you have luck, should see
+something like that:
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"/>
=====================================
debian/apache2/conf.d/noosfero-chat
=====================================
--- /dev/null
+++ b/debian/apache2/conf.d/noosfero-chat
@@ -0,0 +1,9 @@
+<IfModule mpm_worker_module>
+ StartServers 8
+ MinSpareThreads 25
+ MaxSpareThreads 75
+ ThreadLimit 128
+ ThreadsPerChild 128
+ MaxClients 2048
+ MaxRequestsPerChild 0
+</IfModule>
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-noosfero (1.2~0) UNRELEASED; urgency=medium
+noosfero (1.2~1) UNRELEASED; urgency=medium
+ [ Antonio Terceiro ]
* Temporary version in heavy development
- -- Antonio Terceiro <terceiro at debian.org> Fri, 08 May 2015 16:08:18 -0300
+ [ Joenio Costa ]
+ * Build noosfero-chat package
+
+ -- Joenio Costa <joenio at colivre.coop.br> Mon, 18 May 2015 14:32:21 -0300
noosfero (1.1) wheezy; urgency=low
=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -85,3 +85,14 @@ Description: free web-based platform for social networks (apache frontend)
.
This package contains the configuration files needed to run Noosfero with the
Apache HTTPD server as frontend.
+
+Package: noosfero-chat
+Architecture: all
+Depends: noosfero (>= 1.2), ejabberd, odbc-postgresql, pidgin-data
+Description: free web-based platform for social networks (ejabberd based chat)
+ Noosfero is a web platform for social and solidarity economy networks with
+ blog, e-Porfolios, CMS, RSS, thematic discussion, events agenda and collective
+ inteligence for solidarity economy in the same system.
+ .
+ This package contains the configuration files needed to run Noosfero with the
+ Ejabberd XMPP chat server.
=====================================
debian/default/noosfero-chat
=====================================
--- /dev/null
+++ b/debian/default/noosfero-chat
@@ -0,0 +1,2 @@
+POLL=true
+SMP=auto
=====================================
debian/noosfero-chat.install
=====================================
--- /dev/null
+++ b/debian/noosfero-chat.install
@@ -0,0 +1,6 @@
+debian/default/noosfero-chat etc/default
+util/chat/ejabberd.cfg etc/ejabberd
+debian/update-noosfero-odbc usr/sbin
+etc/security/limits.d/noosfero-chat.conf etc/security/limits.d
+etc/pam.d/noosfero-chat etc/pam.d
+debian/apache2/conf.d/noosfero-chat etc/apache2/conf.d
=====================================
debian/noosfero-chat.postinst
=====================================
--- /dev/null
+++ b/debian/noosfero-chat.postinst
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+echo -n "Fetching noosfero domain ..."
+domain=$(noosfero-runner 'puts Environment.default.default_hostname(true)')
+echo " [domain = $domain]"
+
+ejabberd_config='/etc/ejabberd/ejabberd.cfg'
+if test -f $ejabberd_config; then
+ sed -i "s/acl, *\([^,]*\), *{user, *\([^,]*\), *[^}]*/acl, \1, {user, \2, \"$domain\"/" /etc/ejabberd/ejabberd.cfg
+ sed -i "s/hosts, *\[[^]]*/hosts, [\"$domain\"/" /etc/ejabberd/ejabberd.cfg
+fi
+
+echo -n 'Fetching noosfero database name ...'
+noosfero_database=$(noosfero-runner 'puts Environment.connection_config[:database]')
+echo " [database = $noosfero_database]"
+
+echo 'Creating ejabberd schema ...'
+. /etc/default/noosfero
+noosfero_user="$NOOSFERO_USER"
+su - postgres -c "psql -c 'GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;' > /dev/null"
+su - $noosfero_user -c 'rails dbconsole production < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql > /dev/null'
+
+if which update-noosfero-odbc > /dev/null ; then
+ update-noosfero-odbc
+fi
+
+ejabberd_default='/etc/default/ejabberd'
+noosfero_chat_default='/etc/default/noosfero-chat'
+if test -f $ejabberd_default; then
+ if ! cat $ejabberd_default | grep "^\. $noosfero_chat_default" > /dev/null ; then
+ echo 'Extending ejabberd defaults with noosfero-chat defaults ...'
+ echo ". $noosfero_chat_default" >> $ejabberd_default
+ fi
+fi
+
+a2enmod proxy_http
+
+invoke-rc.d ejabberd restart
+invoke-rc.d noosfero restart
+invoke-rc.d apache2 restart
+
+# stop debconf to avoid the problem with infinite hanging, cfe
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295477
+db_stop
+
+#DEBHELPER#
=====================================
debian/noosfero-runner
=====================================
--- /dev/null
+++ b/debian/noosfero-runner
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+environment="$2"
+test -z "$environment" && environment=production
+
+su - noosfero -c "rails runner -e $environment '$1'"
=====================================
debian/noosfero.install
=====================================
--- a/debian/noosfero.install
+++ b/debian/noosfero.install
@@ -17,6 +17,7 @@ debian/dbupgrade usr/lib/noosfero
debian/default/noosfero etc/default
debian/noosfero-check-dbconfig usr/sbin
debian/noosfero-console usr/sbin
+debian/noosfero-runner usr/sbin
debian/noosfero.yml etc/noosfero
debian/thin.yml etc/noosfero
doc usr/share/noosfero
=====================================
debian/update-noosfero-odbc
=====================================
--- /dev/null
+++ b/debian/update-noosfero-odbc
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+# automatically update configuration, but if package noosfero is also installed
+if test -x /usr/share/noosfero/script/odbcconf; then
+ config_file="/etc/odbc.ini"
+ if test -e "$config_file"; then
+ echo "Overwriting $config_file ..."
+ fi
+ /usr/share/noosfero/script/odbcconf > "$config_file"
+
+ echo 'Noosfero ODBC configuration updated.'
+fi
=====================================
etc/pam.d/noosfero-chat
=====================================
--- /dev/null
+++ b/etc/pam.d/noosfero-chat
@@ -0,0 +1 @@
+session required pam_limits.so
=====================================
etc/security/limits.d/noosfero-chat.conf
=====================================
--- /dev/null
+++ b/etc/security/limits.d/noosfero-chat.conf
@@ -0,0 +1,2 @@
+ejabberd hard nofile 65536
+ejabberd soft nofile 65536
=====================================
script/apacheconf
=====================================
--- a/script/apacheconf
+++ b/script/apacheconf
@@ -32,6 +32,7 @@ when 'virtualhosts'
puts " #{server_directive} #{domain.name}"
server_directive = 'ServerAlias'
end
+ puts " Include /usr/share/noosfero/util/chat/apache/xmpp.conf"
puts " Include /etc/noosfero/apache/virtualhost.conf"
puts "</VirtualHost>"
end
=====================================
script/noosfero-test-chat-session
=====================================
--- /dev/null
+++ b/script/noosfero-test-chat-session
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+require File.dirname(__FILE__) + '/../config/environment'
+
+environment = Environment.default
+person = Person.first
+password = person.user.crypted_password
+login = person.jid
+
+begin
+ RubyBOSH.initialize_session(
+ login,
+ password,
+ "http://#{environment.default_hostname}/http-bind",
+ :wait => 30,
+ :hold => 1,
+ :window => 5
+ )
+rescue Exception => e
+ puts ""
+ puts "[ERROR] XMPP/Chat setup isn't working"
+ puts "-------------------------------------"
+ puts e.to_s
+ exit 1
+else
+ puts ""
+ puts "[OK] XMPP/Chat setup is working"
+ exit 0
+end
=====================================
script/odbcconf
=====================================
--- /dev/null
+++ b/script/odbcconf
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+
+require 'yaml'
+config = YAML.load_file(File.dirname(__FILE__) + '/../config/database.yml')['production']
+
+
+puts "[PostgreSQLEjabberdNoosfero]"
+puts "Description = PostgreSQL Noosfero ejabberd database"
+puts "Driver = PostgreSQL Unicode"
+puts "Trace = No"
+puts "TraceFile = /tmp/psqlodbc.log"
+puts "Database = #{config['database']}"
+puts "Servername = #{config['host'] || 'localhost'}"
+puts "UserName = #{config['username']}"
+puts "Password = #{config['password']}"
+puts "Port = #{config['port'] || '5432'}"
+puts "ReadOnly = No"
+puts "RowVersioning = No"
+puts "ShowSystemTables = No"
+puts "ShowOidColumn = No"
+puts "FakeOidIndex = No"
+puts "ConnSettings = SET search_path TO ejabberd"
=====================================
util/chat/apache/xmpp.conf
=====================================
--- a/util/chat/apache/xmpp.conf
+++ b/util/chat/apache/xmpp.conf
@@ -1,6 +1,7 @@
# If your XMPP XMPP/BOSH isn't in localhost, change the config below to correct
# point to address
+ RewriteEngine On
RewriteRule /http-bind http://localhost:5280/http-bind [P,QSA,L]
<Proxy http://localhost:5280/http-bind>
Order Allow,Deny
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/db6ca267b0488e03226b48fe489c626c454c30b2...2079fa79a5dcf7d361e99540d6070e9224bbed3b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150522/9319bdc6/attachment-0001.html>
More information about the Noosfero-dev
mailing list