Difference between revisions of "Eng:J2J:AdminGuide"

From JaWiki (Jabber/XMPP wiki)
Jump to: navigation, search
(Dependencies)
m (Reverted edits by 72.52.116.229 (talk) to last revision by Binary)
 
(29 intermediate revisions by 12 users not shown)
Line 1: Line 1:
 
{{EnglishVersion|J2J:AdminGuide}}
 
{{EnglishVersion|J2J:AdminGuide}}
Installation and operation guide for [[J2J|J2J (Jabber-to-Jabber)]] [[gateway]].
+
Installation and operation guide for [[Eng:J2J|J2J]] (Jabber-to-Jabber) gateway.
  
 
== Installation and configuring ==
 
== Installation and configuring ==
Line 7: Line 7:
  
 
For J2J you will need:
 
For J2J you will need:
* [[Python]] >=2.3
+
* [http://python.org Python] >=2.3
* [http://www.postgresql.org/ PostgreSQL] >=7.4.7
+
* [http://twistedmatrix.com/ Twisted] >=10.2.0 (patch http://twistedmatrix.com/trac/attachment/ticket/4771/twisted-ticket-4771.patch is needed for 10.2.0)
 +
* [http://www.postgresql.org/ PostgreSQL] >=8.2
 
* [http://www.pygresql.org/ PyGreSQL] >=3.8
 
* [http://www.pygresql.org/ PyGreSQL] >=3.8
* [[Twisted]] >=2.5.0
+
* [http://pyopenssl.sourceforge.net/ PyOpenSSL] >=0.6
* Any Jabber-[[server]] (for example, [[ejabberd]] or [[Openfire]]), that supports:
+
(Note: there is experimental [http://www.mysql.com/ Mysql] with [http://mysql-python.sourceforge.net/ mysql-python] support in 1.1.8 and beyond, see Changelog.txt)
 +
 
 +
* Any Jabber-server (for example ejabberd, jabberd2 or Openfire), that supports:
 
** {{xep|0114|Jabber Component Protocol}}
 
** {{xep|0114|Jabber Component Protocol}}
** [[Service Discovery|XEP-0030: Service Discovery]]
+
** {{xep|0030|Service Discovery}}
  
 
=== Source code downloads ===
 
=== Source code downloads ===
You need to get sources of [[J2J]]. You can do it at [http://jrudevels.org/index.php?pg=downloads.php&dir=J2J JRuDevels Downloads], or with help of [http://subversion.tigris.org/ SVN]:
+
You need to get sources of [[Eng:J2J|J2J]]. You can do it at [http://jrudevels.org/index.php?pg=downloads.php&dir=J2J JRuDevels Downloads], or with help of [http://subversion.tigris.org/ SVN]:
  
  <nowiki>svn co https://svn.jrudevels.org/j2j/trunk j2j/</nowiki>
+
  <nowiki>svn co svn://svn.jrudevels.org/j2j/trunk j2j/</nowiki>
  
 
=== Database setup ===
 
=== Database setup ===
  
You need to setup a database to work with [[J2J]]:
+
You need to setup a database to work with [[Eng:J2J|J2J]]:
 +
 
 +
Let's create a database for [[Eng:J2J|J2J]]:
 +
* postgresql:
 +
createdb j2j
 +
* mysql
 +
mysql -h localhost -u root -p -e "CREATE DATABASE j2j;"
  
 
Let's create a DB user:
 
Let's create a DB user:
 +
* postgresql:
 
  createuser -P j2j
 
  createuser -P j2j
 
+
A -P key means, that user is created with a password-prompt. Store it, because it will be needed for next steps. Same with yourpassword in mysql:
A -P key means, that user is created with a password-prompt. Store it, because it will be needed for next steps.
+
* mysql:
 
+
  mysql -h localhost -u root -p -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON j2j.* TO 'j2j'@'localhost' IDENTIFIED BY 'yourpassword';"
Let's create a database for [[J2J]]:
+
  createdb j2j
+
  
 
And import a database structure:
 
And import a database structure:
 
+
* postgresql:
 
  psql -U j2j j2j
 
  psql -U j2j j2j
 
  \i pgsql.schema
 
  \i pgsql.schema
 +
* mysql
 +
mysql -h localhost -u root -p -e "use j2j; \. mysql.schema"
  
 
=== Gateway configuration ===
 
=== Gateway configuration ===
  
Configuration file config.py is needed for [[J2J]]. Let's copy example of this and edit it:
+
Configuration file is needed for [[Eng:J2J|J2J]]. Default search paths for it is: ./j2j.conf, ~/.j2j/j2j.conf and /etc/j2j/j2j.conf; also you can use "-c /path/j2j.conf" in main.py, see later. Let's copy example of this and edit it:
  cp config.py.example config.py
+
  cp j2j.conf.example j2j.conf
  nano -w config.py
+
  nano -w j2j.conf
  
 
Parameters:
 
Parameters:
* JID - JID of gateway. For example,  
+
* Section component
  JID=u"j2j.server.com"
+
** JID - JID of gateway. For example,  
* HOST - IP or domain-name of your Jabber-server. For example,
+
  JID=j2j.server.com
  HOST="127.0.0.1"
+
** Host - IP or domain-name of your Jabber-server. For example,
* PORT - port on Jabber-server to which J2J will be connected. It must be the same as it specified in your Jabber-server's configuration.
+
  Host="127.0.0.1"
* DB_HOST - IP or Domain-name of your database server.
+
** Port - port on Jabber-server to which J2J will be connected. It must be the same as it specified in your Jabber-server's configuration.
* DB_USER - Database username (in our example is j2j)
+
** Password - password on Jabber-server to which J2J will be connected.
* DB_NAME - Database name (in our example is j2j)
+
* Section database
* DB_PASS - Password for this database username.
+
** Host - IP or Domain-name of your database server. Leave it blank to use postgres' UNIX-socket.
* DB_PREFIX - pass it as is.
+
** Type - Type of your database server: postgres or mysql
* ADMINS - a list of [[JID]]s, for a notifications of new users registrations. For example,
+
** User - Database username (in our example is j2j)
  ADMINS=[u"vasya@server.ru",u"zhenya@server.com"]
+
** Name - Database name (in our example is j2j)
 +
** Password - Password for this database username.
 +
** Prefix - pass it as is.
 +
* Section admins
 +
** List - a list of JIDs, for a notifications of new users registrations. For example,
 +
  List=vasya@server.ru,zhenya@server.com
 +
* Section debug
 +
** Pass it as is. If you will get errors in J2J's work try to turn on logging in it section.
  
 
=== Running ===
 
=== Running ===
Line 61: Line 78:
 
Let's start the gateway:
 
Let's start the gateway:
 
  python main.py
 
  python main.py
 +
it should spit "Connected", see also your jabber server log.
 +
 +
=== Problems ===
 +
* If you see:
 +
<nowiki>Exception exceptions.AttributeError: "database instance has no attribute 'dbCursor'" in <bound method
 +
database.__del__ of <database.database instance at 0x85f1bec>> ignored</nowiki>
 +
Check if you have installed python db access support ( i.e. python-pygresql, python-mysqldb in debian) and if it is up to date. Otherwise, is postgresql/mysql rdbms accesible with the parameters in [database] section in your j2j.conf? is it up?
 +
* If you see :
 +
Traceback (most recent call last):
 +
  File "/usr/src//j2j/main.py", line 11, in ?
 +
    import j2j
 +
  File "/usr/src/j2j/j2j.py", line 14, in ?
 +
    from client import Client
 +
  File "/usr/src/j2j/client.py", line 10, in ?
 +
    from twisted.names.error import DNSNameError
 +
ImportError: No module named error
 +
 +
In debian etch twisted is too old: required twisted 8.01 is in etch+1; ubuntu 8.04 is ok too.
 +
And with FreeBSD you need also py-twistedNames, it's not installed with twisted.
 +
 +
* Sometimes main.py doesn't spit nothing, check your jabber server log, maybe there is an authentication password problem so recheck [component] section in j2j.conf
 +
* In j2j.conf are declared some paths to log files, do these files exist? do they have write permissions?
 +
 +
=== Command line options ===
 +
 +
Start [[Eng:J2J|J2J]] with the --help key to get help about command-line options.
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:English]]
 
[[Category:English]]

Latest revision as of 07:02, 18 January 2015

Эта страница доступна в версии на русском языке.

This page is also available in Russian.

Pages in EnglishTranslated pagesPages that have an english version

Installation and operation guide for J2J (Jabber-to-Jabber) gateway.

Installation and configuring[edit]

Dependencies[edit]

For J2J you will need:

(Note: there is experimental Mysql with mysql-python support in 1.1.8 and beyond, see Changelog.txt)

Source code downloads[edit]

You need to get sources of J2J. You can do it at JRuDevels Downloads, or with help of SVN:

svn co svn://svn.jrudevels.org/j2j/trunk j2j/

Database setup[edit]

You need to setup a database to work with J2J:

Let's create a database for J2J:

  • postgresql:
createdb j2j
  • mysql
mysql -h localhost -u root -p -e "CREATE DATABASE j2j;"

Let's create a DB user:

  • postgresql:
createuser -P j2j

A -P key means, that user is created with a password-prompt. Store it, because it will be needed for next steps. Same with yourpassword in mysql:

  • mysql:
mysql -h localhost -u root -p -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON j2j.* TO 'j2j'@'localhost' IDENTIFIED BY 'yourpassword';"

And import a database structure:

  • postgresql:
psql -U j2j j2j
\i pgsql.schema
  • mysql
mysql -h localhost -u root -p -e "use j2j; \. mysql.schema"

Gateway configuration[edit]

Configuration file is needed for J2J. Default search paths for it is: ./j2j.conf, ~/.j2j/j2j.conf and /etc/j2j/j2j.conf; also you can use "-c /path/j2j.conf" in main.py, see later. Let's copy example of this and edit it:

cp j2j.conf.example j2j.conf
nano -w j2j.conf

Parameters:

  • Section component
    • JID - JID of gateway. For example,
JID=j2j.server.com
    • Host - IP or domain-name of your Jabber-server. For example,
Host="127.0.0.1"
    • Port - port on Jabber-server to which J2J will be connected. It must be the same as it specified in your Jabber-server's configuration.
    • Password - password on Jabber-server to which J2J will be connected.
  • Section database
    • Host - IP or Domain-name of your database server. Leave it blank to use postgres' UNIX-socket.
    • Type - Type of your database server: postgres or mysql
    • User - Database username (in our example is j2j)
    • Name - Database name (in our example is j2j)
    • Password - Password for this database username.
    • Prefix - pass it as is.
  • Section admins
    • List - a list of JIDs, for a notifications of new users registrations. For example,
List=vasya@server.ru,zhenya@server.com
  • Section debug
    • Pass it as is. If you will get errors in J2J's work try to turn on logging in it section.

Running[edit]

Let's start the gateway:

python main.py

it should spit "Connected", see also your jabber server log.

Problems[edit]

  • If you see:
Exception exceptions.AttributeError: "database instance has no attribute 'dbCursor'" in <bound method
 database.__del__ of <database.database instance at 0x85f1bec>> ignored

Check if you have installed python db access support ( i.e. python-pygresql, python-mysqldb in debian) and if it is up to date. Otherwise, is postgresql/mysql rdbms accesible with the parameters in [database] section in your j2j.conf? is it up?

  • If you see :
Traceback (most recent call last):
  File "/usr/src//j2j/main.py", line 11, in ?
    import j2j
  File "/usr/src/j2j/j2j.py", line 14, in ?
    from client import Client
  File "/usr/src/j2j/client.py", line 10, in ?
    from twisted.names.error import DNSNameError
ImportError: No module named error

In debian etch twisted is too old: required twisted 8.01 is in etch+1; ubuntu 8.04 is ok too. And with FreeBSD you need also py-twistedNames, it's not installed with twisted.

  • Sometimes main.py doesn't spit nothing, check your jabber server log, maybe there is an authentication password problem so recheck [component] section in j2j.conf
  • In j2j.conf are declared some paths to log files, do these files exist? do they have write permissions?

Command line options[edit]

Start J2J with the --help key to get help about command-line options.