Libervia/en

De Goffiwiki
Aller à : navigation, rechercher


Libervia is the web frontend of SàT.

Installation

Manual Libervia's installation is a bit long as you need to install a couple of dependencies and transpile Python code to JavaScript... If you can, use your distribution package or do a request for a package. An other option is the Docker image.

Note: Libervia installation via Docker is really easy, and its usage is then simple (running, backup, etc), you'll find instructions here: Docker/en. If you want to quickly try it, that's the recommended way.

If you want to go with manual installation anyway, here are the instructions, and don't forget that we can help you on the SàT XMPP room: sat@chat.jabberfr.org.

Prerequesites

Salut à Toi backend

  • make sure to have SàT and its media installed and properly configured

XMPP server

We recommend Prosody. It is by now the sole server which implements all the XMPP extensions supported by SàT.

Prosody

Installation

Libervia needs a patch which is posterior to Prosody 0.9. Until the release of Prosody 0.10, it is recommended to use a very fresh version:

  • If your distribution is using "apt", please follow the instructions to install the daily built package. With this solution your Prosody will also be kept up to date whenever you update your distribution.
  • Otherwise you can install it directly from the source code repository. If you choose this solution and that you are in a hurry, here the instructions to be commands to be entered on a Debian based distribution (use the root account or precede with "sudo" when necessary):
 apt-get install lua5.1 liblua5.1-dev luarocks libidn11-dev libssl-dev
 luarocks install luasec luaexpat luafilesystem
 hg clone https://hg.prosody.im/trunk prosody-trunk
 cd prosody-trunk
 ./configure --ostype=debian
 make
 make install

You may need to adapt these lines to your OS. If you encounter any error, check the INSTALL file to complete the dependencies.

Configuration

You can use the prosody.cfg.lua.dist template to create your own configuration:

 cp prosody.cfg.lua.dist prosody.cfg.lua

Here is a recommended configuration, considering you are running Prosody locally to host the XMPP domain "example.net", and directly from the working directory (not using the system installation that has been done with "make install", otherwise you need to change the pidfile's path):

 [...]
 modules_enabled = {
               [...]
               "posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
               [...]
 }
 allow_registration = true
 pidfile = "prosody.pid"
 [...]
 VirtualHost "example.net"
 [...]

Remark: to declare an additional VirtualHost "localhost" is up to you, but to avoid any problem SàT should use a proper domain name like "example.net". If you don't have a real DNS and to assign yourself the domain just for local use, you may need to modify your system configuration for /etc/hostname to contain a single line:

 example.net

and /etc/hosts to contain the following (and more):

 127.0.0.1    localhost
 127.0.0.1    example.net

Set the XMPP domain to be used by Libervia in your SàT config file (e.g. in ~/.config/sat/sat.config). Here we give a sample configuration for the whole "account" plugin section using the "example.net" domain:

 [plugin account]
 email_from = NOREPLY@example.net
 email_server = localhost
 #email_sender_domain =
 #email_port = 25
 #email_username =
 #email_password =
 #email_starttls = 0
 #email_auth = 0
 email_admins_list = admin@example.net,
 new_account_server = localhost
 new_account_domain = example.net
 prosody_path = /home/<user>/workspace/prosody-hg
 prosodyctl = prosodyctl
 reserved_list = libervia

Running a mail server is not mandatory, it is only needed to send the account creation confirmation. Also keep in mind that the configuration examples that we gave here are not sufficient to run a fully functional Libervia. But the goal of this article is not to describe in detail how to configure your XMPP server. For more information, please check:

SàT PubSub

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. One of the main addition is fine access tuning for PubSub, which allow the publication of items for only some groups.

Installation

 hg clone http://repos.goffi.org/sat_pubsub

Follow the procedure as described in INSTALL, paying attention to the dependencies and the database creation. The commands you need to type look like that:

 sudo apt-get install python-twisted-core python-twisted-words postgresql python-psycopg2
 sudo pip install uuid wokkel
 
 cd sat_pubsub
 sudo pip install .
 
 sudo -u postgres createuser -d -P `whoami`
 createdb pubsub
 psql pubsub < sat_pubsub/db/pubsub.sql

Configuration with Prosody

  • add these two lines at the end of your prosody.cfg.lua file, adapting them to your XMPP server domain (virtual host) and selecting a password of your choice:
 Component "sat-pubsub.<xmpp_domain>"
         component_secret = "<password>"
  • there are extra steps to enable the micro-blogging feature with Prosody. Please follow the installation and configuration instructions that are given on these pages:
 https://modules.prosody.im/mod_delegation.html
 https://modules.prosody.im/mod_privilege.html

To keep your modules up to date, we recommend to clone the full modules repository and then to symlink them like that:

 cd /path/to
 hg clone https://hg.prosody.im/prosody-modules
 cd prosody-trunk/plugins
 ln -sf /path/to/prosody-modules/mod_delegation ./
 ln -sf /path/to/prosody-modules/mod_privilege ./

Or course, you have to adapt /path/to to the good directory where you cloned the repositories. If you installed Prosody not from the source but with the apt package, replace prosody-trunk/plugins/ with something like /usr/local/lib/prosody/modules/ (in that case the ln command should be run with the root account or preceded by sudo). Once your symlinks are set, to update the modules we just need to type this:

 cd /path/to/prosody-modules
 hg pull -u

As we gave before a configuration example for your prosody.cfg.lua file, if you are using the delegation and privilege modules it should look a bit like that:

[...]
modules_enabled = {
              [...]
              "delegation";
              "privilege";
}
[...]
VirtualHost "<xmpp_domain>"
  privileged_entities = {
    ["sat-pubsub.<xmpp_domain>"] = {
      roster = "get";
      message = "outgoing";
      presence = "roster"; 
    },
  }
  delegations = {
    ["urn:xmpp:mam:1"] = {
      filtering = {"node"};
      jid = "sat-pubsub.<xmpp_domain>";
    },
    ["http://jabber.org/protocol/pubsub"] = {
      jid = "sat-pubsub.<xmpp_domain>";
    },
  }

Component "sat-pubsub.<xmpp_domain>"
   component_secret = "<password>"
   modules_enabled = {"delegation", "privilege"}

Of course, you still have to replace <xmpp_domain> and <password> with the good values.

Salut

Salut is a (early-stage) XMPP directory, build for the Salut à Toi project, or any other XMPP related stuff.

Installation

There is no installer yet, so you just need to retrieve the source:

 hg clone http://repos.goffi.org/salut

Configuration with Prosody

  • add these two lines at the end of your prosody.cfg.lua file, adapting them to your XMPP server domain (virtual host) and selecting a password of your choice:
 Component "salut.<xmpp_domain>"
         component_secret = "<password>"

Since Salut is not yet a Twisted plugin and doesn't accept command line parameters, you need to edit salut.tac to set the good host, port, JID and password:

 xmppcomponent = Component("127.0.0.1", 5347, "salut.<xmpp_domain>", "<password>")

Dependencies

  • you need to install the txJSON-RPC dependency (as root):
 pip install txJSON-RPC

For a full featured Libervia, it is recommended to also install these modules:

 pip install dokuwiki miniupnpc netifaces
  • install python-gobject-2 from your distribution repositories. For example:
 apt-get install python-gobject-2
 wget ftp://ftp.goffi.org/pyjamas/pyjamas.tar.bz2
 tar xvjf pyjamas.tar.bz2
 cd pyjamas
 python2.7 bootstrap.py

Note that we force the python version to 2.7. Salut à Toi and Libervia will be ported to Python 3 after the Twisted framework which is our main dependency. You can check that it works by compiling the helloworld example:

 cd examples/helloworld
 ./build.sh

if you have no error message, it should be all right

Libervia

  • to install Libervia using setuptools, the pyjsbuild executable should be accessible from your environment variable "PATH". The easiest would be:
 cd pyjamas
 sudo ln -sf `pwd`/bin/pyjsbuild /usr/bin/pyjsbuild 
  • clone libervia repository:
 hg clone http://repos.goffi.org/libervia
  • install Libervia and configure Libervia:
 cd libervia
 sudo pip install .

For the configuration, please check the parameters' explanations here: Configuration/en

  • create an account "libervia@example.net" (replace "example.net" by your domain or virtual host) on your XMPP server, create a profile on SàT named "libervia", and plug the SàT profile to this account with jp or primitivus.
 cd <prosody_directory>
 ./prosodyctl adduser libervia@example.net  # you will be prompted for a password
 jp profile create libervia -j libervia@example.net -p <libervia_password>

Usage

The four components must be launched in the following order:

  • prosody
 cd prosody && prosodyctl start
  • sat_pubsub (xmpp domain and password as declared in prosody.cfg.lua)
 twistd sat_pubsub --jid=sat-pubsub.<xmpp_domain> --secret=<password>
  • salut (not mandatory)
 cd salut && twistd -y salut.tac
  • sat
 sat
  • libervia's web server
 libervia

Here a bash script to help you with stopping and restarting the services during development (sat will be reinstalled and libervia will be re-built before each start): Helping_script_to_launch_a_Libervia_server/en

If you have any issue, you can ask for help on MUC room sat@chat.jabberfr.org , or use the dev mailing list at http://lists.goffi.org