Mercurial > libervia-pubsub
changeset 264:86e767dc6abb
packaging for release
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 22 Feb 2014 06:10:24 +0100 (2014-02-22) |
parents | 9dfd3890e646 |
children | 89493845d3dd |
files | CHANGELOG INSTALL MANIFEST.in NEWS README UPGRADING db/to_idavoll_0.8.sql setup.py twisted/plugins/idavoll_http.py |
diffstat | 9 files changed, 155 insertions(+), 358 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CHANGELOG Sat Feb 22 06:10:24 2014 +0100 @@ -0,0 +1,2 @@ +v 0.0.1 (24/02/2014): + ** FIRST PUBLIC RELEASE **
--- a/INSTALL Fri Feb 21 16:10:11 2014 +0100 +++ b/INSTALL Sat Feb 22 06:10:24 2014 +0100 @@ -3,34 +3,24 @@ - Twisted >= 8.0.1: - Twisted Core - - Twisted Conch (for idavoll-http) - - Twisted Web (for idavoll-http) - - Twisted Web2 (for idavoll-http) - Twisted Words - uuid.py (Python 2.5 std. lib. or http://pypi.python.org/pypi/uuid) - Wokkel >= 0.5.0 (http://wokkel.ik.nu/) -- simplejson (for idavoll-http) -- A Jabber server that supports the component protocol (XEP-0114) +- A Jabber server that supports the component protocol (XEP-0114), + and, to enable the micro-blogging feature, the remote roster + management protocol (XEP-0321). We recommend using Prosody. For the PostgreSQL backend, the following is also required: - PostgreSQL -- pyPgSQL +- Psycopg 2 Installation ============ -Idavoll uses setuptools for package building and installing, and is also -available through the Python Package Index (pypi). The easiest way to -install idavoll is: - - easy_install idavoll - -This will pull down the dependencies, if needed, except for the Twisted -packages. - -To building from source run: +sat_pubsub uses setuptools for package building and installing. +To build from the source run: python setup.py build @@ -45,42 +35,32 @@ Configuration ============= -Idavoll uses Twisted's twistd command for running its services. Starting with +sat_pubsub uses Twisted's twistd command for running its services. Starting with Twisted 2.5.0, twistd supports running Twisted Application Plugins directly, without the use of mktap. In Twisted 8.1.0, the use of mktap for configuration -is deprecated. These instructions will not cover the use of mktap anymore, but -you can use TAC files to store a configuration, as described near the end -of this document. +is deprecated. -Idavoll provides two types of storage for the backend: a memory-based storage -facility, which is volatile, and a persistent storage facility using -PostgreSQL. By default, the memory backend is used. +Idavoll, on which sat_pubsub is based, provides two types of storage for the backend: +a memory-based storage facility, which is volatile, and a persistent storage facility +using PostgreSQL. For now, sat_pubsub only uses the persistent storage facility. -For using the PostgreSQL backend, create a database (for example named pubsub) -like so: - - createdb pubsub - psql pubsub <db/pubsub.sql +For using the PostgreSQL backend, create a database (for example named pubsub): -To use this backend, add the --backend=pgsql parameter to twistd, along -with the optional connection parameters (see twistd idavoll --help). - -Your Jabber server must also be configured to accept component connections, -see below for details. + sudo -u postgres createuser -d -P `whoami` + createdb pubsub + psql pubsub < sat_pubsub/db/pubsub.sql -Running Idavoll -=============== +Your Jabber server must also be configured to accept component connections and, +to enable the micro-blogging feature, remote roster management. See below for details. + -Idavoll provides two twistd plugins: idavoll and idavoll-http. The former -provides a generic publish-subscribe service, and the latter adds to that an -HTTP interface to access some of the features of the Idavoll backend, and also -provides a way to subscribe to, and receive notifications from, remote -publish-subscribe nodes. +Running sat_pubsub +================== -The minimal example for running idavoll is: +The minimal example for running sat_pubsub is: - twistd idavoll + twistd sat_pubsub This will start the service and run it in the background. It generates a file twistd.pid that holds the PID of the service and a log file twistd.log. @@ -95,63 +75,57 @@ the twistd plugin. You can get an overview of the parameters and their defaults using: - twistd idavoll --help + twistd sat_pubsub --help In particular, the following parameters will be of interest: --jid: The Jabber ID the component will assume. --rport: the port number of the Jabber server to connect to --secret: the secret used to authenticate with the Jabber server. - --backend: the backend storage facility to be used (memory or PostgreSQL). -The defaults for Idavoll use the memory database and assume the default -settings of jabberd 2.x for --rport and --secret. +For example: + + twistd sat_pubsub --jid=sat-pubsub.<xmpp_domain> --secret=<password> You may also want to provide the --verbose flag to see the traffic flow, for example to debug the configuration. Below some specifics for the -different Jabber server implementations. - - -jabberd 2.x -=========== - -You can use the 'legacy' component support that defaults to port 5347 with -secret 'secret'. These are the defaults of Idavoll, so you don't need to -alter the connection details with a default jabberd 2.x install. +Prosody XMPP server implementation. -jabberd 1.4.x -============= +Running sat_pubsub with Prosody +=============================== -Put the following in the jabber.xml configuration file of jabberd: +To enable the micro-blogging feature with Prosody XMPP server, you need +the remote_roster plugin. Check if the remote_roster plugin is already +in your Prosody installation: - <service id='pubsub.localhost'> - <accept> - <ip>127.0.0.1</ip> - <port>5347</port> - <secret>secret</secret> - </accept> - </service> + cd prosody/plugins + ls mod_remote_roster.lua + +If you can't see it, download it from here: -and restart jabberd. Unlike jabber 2.x, you can only have one component per -port, so the port number may need to be changed. + wget http://prosody-modules.googlecode.com/hg/mod_remote_roster/mod_remote_roster.lua + +You need to patch the file (commenting two lines to make all contacts available): + + wget http://paste.debian.net/download/12106 + patch -p2 < paste_1206 -For other server implementations, please refer to its documentation on -how to interact with server side components using the protocol defined in -JEP-0114. +Edit the prosodi.cfg.lua file to add this module: -Then, you can start Idavoll with: - - twistd idavoll --rport=5347 --jid=pubsub.localhost --secret=secret - -This uses the (default) memory based backend. + modules_enabled = { + [...] + "remote_roster"; + [...] + } - -Using TAC files to store a configuration -======================================== +Also add these two lines at the end of the file, adapting them to your XMPP server +domain (virtual host) and selecting a password of your choice: -Apart from the provided TAPs that can be run with twistd, you can also create -a configuration file that can be used by twistd to start up Idavoll. You can -find an example in doc/examples/idavoll.tac, which can be run using: + Component "sat-pubsub.<xmpp_domain>" + component_secret = "<password>" - twisted -y idavoll.tac +For a more complete installation and configuration of Prosody to be used with +sat_pubsub, please report yourself to the Salut à Toi wiki: + +http://wiki.goffi.org/wiki/Libervia/en#XMPP_server \ No newline at end of file
--- a/MANIFEST.in Fri Feb 21 16:10:11 2014 +0100 +++ b/MANIFEST.in Sat Feb 22 06:10:24 2014 +0100 @@ -1,5 +1,5 @@ include INSTALL -include LICENSE -include NEWS +include COPYING +include CHANGELOG include db/* graft twisted
--- a/NEWS Fri Feb 21 16:10:11 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -0.9.1 (2009-09-07) -================== - - - Log HTTP requests if verbose logging is on. - - Make HTTP requests with 204 responses don't result in failure. - - Remove some debug logging. - - Fix subscription and unsubscription JID checking. - - Fix zope import warning. - - -0.9.0 (2009-04-07) -================== - - - Track changes to Wokkel, require version 0.5.0. - - Add support for node deletion with redirect. - - Fix error reporting for older Python versions. - - -0.8.1 (2008-08-05) -================== - - - Include database schema files in distribution. - - -0.8.0 (2008-08-05) -================== - - - Complete API method name change to conform to Twisted's naming conventions. - - Change so that stored items are stripped of the pubsub namespace, this makes - notifications have the proper namespace for items. - - Match an API change in Wokkel for the HTTP gateway. - - Add persistent storage for the HTTP gateway's record of subscriptions and - callbacks. - - Adjust node configuration code to match Wokkel's API changes for data forms. - - Implement a root collection that includes all leaf nodes. - - -0.7.3 (2008-05-30) -================== - - - Return appropriate HTTP status codes on failed un-/subscription. - - Use ServiceMaker to setup twistd plugins, available as of Twisted 8.1.0. - - Require simplejson through setup.py. - - Update installation and configuration documentation in INSTALL. - - -0.7.2 (2008-05-16) -================== - - - Make sure that optional PostgreSQL connect parameters are passed as None - if not specified. - - Require wokkel and uuid through setup.py. - - -0.7.0 (2008-04-22) -================== - - - Depend on Wokkel for XMPP protocol implementations (#4). - - Depend on the uuid module that ships with Python 2.5 and can be installed - for older versions from http://pypi.python.org/pypi/uuid. - - Provide twistd parameters for connecting to a remote PostgreSQL - database (#6). - - Add support for node deletion notifications. - - Optionally send the last published item on subscription. - - Add an HTTP gateway (accessible via a separate twistd plugin) that allows - for creating new nodes, publishing to nodes locally and subscribing to - remote nodes through HTTP. See http://idavoll.ik.nu/wiki/HTTP_Interface. - - Miscellaneous fixes (#7, #9). - - -0.6.0 (2007-01-18) -================== - - - Improve error handling by using stanza error support in Twisted Words 0.4.0. - - Bring errors up to date with version 1.8 of JEP-0060. - - Add new retrieve-default feature for retrieval of default node - configuration. - - Fully comply with access model 'open'. - - Add --dbpass option for PostgreSQL backend. - - Fix import incompatibility with Twisted Words 0.5.0 (#3). - - -0.5.0 (2006-08-17) -================== - -First release.
--- a/README Fri Feb 21 16:10:11 2014 +0100 +++ b/README Sat Feb 22 06:10:24 2014 +0100 @@ -1,50 +1,52 @@ -Sat PubSub component +SàT PubSub component v0.1.0 This program is heavily based on Idavoll (0.9.1), which was written by Ralph Meijer +Copyright (c) 2014 Adrien Cossa +Copyright (c) 2012, 2013, 2014 Jérôme Poisson Copyright (c) 2003-2011 Ralph Meijer -Copyright (c) 2012, 2013 Jérôme Poisson -** Below is the original README from Idavoll ** +Sàt PubSub is a PubSub component service for XMPP + + -What is this? -================ +** LICENSE ** -Idavoll is a Jabber publish-subscribe service component, as defined in -JEP-0060, aiming to be fully compliant and mostly complete. The goal is to -build a generic pubsub service, but of which parts can be reused for building -custom pubsub services for specific applications. +Sàt PubSub is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -Current Status -============== - -There are two different backends: one using PostgreSQL for storage, and one -just keeping everything in memory. +Sàt PubSub is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. -In Idavoll the mimimal requirements of JEP-0060 version 1.11 are implemented -plus a number of optional features, as returned by Service Discovery. +You should have received a copy of the GNU Affero General Public License +along with Sàt PubSub. If not, see <http://www.gnu.org/licenses/>. -Installing -========== + +** ABOUT ** -Instructions for installing, configuring and running this software are in -INSTALL. Also refer to UPGRADING for instruction on upgrading from older -versions of Idavoll. +SàT PubSub is a XMPP PubSub service component (XEP-0060) +It's based on Ralph Meijer's Idavoll, but provide special features necessary for the « Salut à Toi » project ( http://sat.goffi.org ), but it can also be used for any other XMPP project. +The use of a standard external component allow to use this features with most XMPP servers. +One of the main addition is fine access tuning for PubSub, which allow the publication of items for only some groups, even if the entire node is open. The protocol is explained on http://www.goffi.org/post/2012/06/24/Fine-access-tuning-for-PubSub for the moment, and a protoxep should be proposed to the XSF in the future... -Copyright -========= + +** INSTALLATION ** -All of the code in this distribution is Copyright (c) 2003-2011 Ralph Meijer. +Instructions for installation are the same as for Idavoll, so follow what is written in INSTALL and UPGRADING files. + -Idavoll is made available under the MIT license. The included LICENSE file -describes this in detail. +** CREDIT ** -Contact -======= +The base project (Idavoll) was made by Ralph Meijer and can be found on http://idavoll.ik.nu/ + -Questions, comments or suggestions are welcome! There is a mailing list for -Jabber related Twisted development at mailto:twisted-jabber@ik.nu. The list's -info page lives here: https://mailman.ik.nu/mailman/listinfo/twisted-jabber. +** CONTACT ** -Ralph Meijer -<xmpp:ralphm@ik.nu> +Goffi (Jérôme Poisson): goffi@goffi.org (e-mail) or goffi@jabber.fr (jid) +Souliane (Adrien Cossa): souliane@mailoo.org (e-mail) or souliane@libervia.org (jid) + +XMPP MUC: sat@chat.jabberfr.org
--- a/UPGRADING Fri Feb 21 16:10:11 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -Upgrading -========= - -To 0.8.0 -======== - -This release includes an optional HTTP interface with a gateway to subscribe -to remote nodes. The subscriptions and associated callbacks are stored in -the database if the PostgreSQL storage backend is used. This requires a new -table, of which the schema is in db/gateway.sql: - - psql -e pubsub <db/gateway.sql - -The schema of the other tables has also changed significantly compared to -0.7.3 and older. For these changes, there is an upgrade script in the form -of a series of SQL statements to be run against an database with the older schema: db/to_idavoll_0.8.sql, like so: - - psql -e pubsub <db/to_idavoll_0.8.sql
--- a/db/to_idavoll_0.8.sql Fri Feb 21 16:10:11 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -ALTER TABLE affiliations RENAME id TO affiliation_id; - -ALTER TABLE entities RENAME id TO entity_id; - -ALTER TABLE items RENAME id TO item_id; - -ALTER TABLE nodes RENAME id TO node_id; -ALTER TABLE nodes RENAME persistent to persist_items; -ALTER TABLE nodes RENAME deliver_payload to deliver_payloads; -ALTER TABLE nodes ADD COLUMN node_type text; -ALTER TABLE nodes ALTER COLUMN node_type SET DEFAULT 'leaf'; -UPDATE nodes SET node_type = 'leaf'; -ALTER TABLE nodes ALTER COLUMN node_type SET NOT NULL; -ALTER TABLE nodes ADD CHECK (node_type IN ('leaf', 'collection')); -ALTER TABLE nodes ALTER COLUMN persistent DROP NOT NULL; -ALTER TABLE nodes ALTER COLUMN persistent DROP DEFAULT; - -ALTER TABLE subscriptions RENAME id TO subscription_id; -ALTER TABLE subscriptions RENAME subscription TO state; -ALTER TABLE subscriptions ADD COLUMN subscription_type text - CHECK (subscription_type IN (NULL, 'items', 'nodes')); -ALTER TABLE subscriptions ADD COLUMN subscription_depth text - CHECK (subscription_depth IN (NULL, '1', 'all')); - -INSERT INTO nodes (node, node_type) values ('', 'collection');
--- a/setup.py Fri Feb 21 16:10:11 2014 +0100 +++ b/setup.py Sat Feb 22 06:10:24 2014 +0100 @@ -1,61 +1,77 @@ #!/usr/bin/python #-*- coding: utf-8 -*- -""" -Copyright (c) 2003-2011 Ralph Meijer -Copyright (c) 2012, 2013 Jérôme Poisson - +# Copyright (c) 2003-2011 Ralph Meijer +# Copyright (C) 2011-2014 Jérôme Poisson <goffi@goffi.org> -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. --- +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. -This program is based on Idavoll (http://idavoll.ik.nu/), -originaly written by Ralph Meijer (http://ralphm.net/blog/) -It is sublicensed under AGPL v3 (or any later version) as allowed by the original -license. +# This program is based on Idavoll (http://idavoll.ik.nu/), +# originaly written by Ralph Meijer (http://ralphm.net/blog/) +# It is sublicensed under AGPL v3 (or any later version) as allowed +# by the original license. --- +# Here is a copy of the original license: -Here is a copy of the original license: - -Copyright (c) 2003-2011 Ralph Meijer +# Copyright (c) 2003-2011 Ralph Meijer -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -""" +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import sys from setuptools import setup from sat_pubsub import __version__ + +# seen here: http://stackoverflow.com/questions/7275295 +try: + from setuptools.command import egg_info + egg_info.write_toplevel_names +except (ImportError, AttributeError): + pass +else: + def _top_level_package(name): + return name.split('.', 1)[0] + + def _hacked_write_toplevel_names(cmd, basename, filename): + pkgs = dict.fromkeys( + [_top_level_package(k) + for k in cmd.distribution.iter_distribution_names() + if _top_level_package(k) != "twisted" + ] + ) + cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n') + + egg_info.write_toplevel_names = _hacked_write_toplevel_names + + install_requires = [ 'wokkel >= 0.7.1', 'simplejson', @@ -74,14 +90,10 @@ packages=[ 'sat_pubsub', 'sat_pubsub.test', + 'twisted.plugins', ], - package_data={'twisted.plugins': ['twisted/plugins/sat_pubsub.py', - 'twisted/plugins/sat_pubsub_http.py']}, - data_files=[('share/sat_pubsub', ['db/pubsub.sql', - 'db/gateway.sql', - 'db/to_idavoll_0.8.sql', - 'doc/examples/sat_pubsub.tac', - ])], + package_data={'twisted.plugins': ['twisted/plugins/sat_pubsub.py']}, + data_files=[('share/sat_pubsub', ['db/pubsub.sql', 'doc/examples/sat_pubsub.tac'])], zip_safe=False, install_requires=install_requires, )
--- a/twisted/plugins/idavoll_http.py Fri Feb 21 16:10:11 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#!/usr/bin/python -#-*- coding: utf-8 -*- - -""" -Copyright (c) 2003-2011 Ralph Meijer -Copyright (c) 2012, 2013 Jérôme Poisson - - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. --- - -This program is based on Idavoll (http://idavoll.ik.nu/), -originaly written by Ralph Meijer (http://ralphm.net/blog/) -It is sublicensed under AGPL v3 (or any later version) as allowed by the original -license. - --- - -Here is a copy of the original license: - -Copyright (c) 2003-2011 Ralph Meijer - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -""" - -try: - from twisted.application.service import ServiceMaker -except ImportError: - from twisted.scripts.mktap import _tapHelper as ServiceMaker - -Idavoll = ServiceMaker( - "Idavoll HTTP", - "idavoll.tap_http", - "Jabber Publish-Subscribe Service Component with HTTP gateway", - "idavoll-http")