XmppServer - jappix/jappix GitHub Wiki

# The XMPP Server

If you do want to use another XMPP server (actually you want to use your own), you'll have to install it. You have a lot of choices, such as Metronome, ejabberd, Prosody, Tigase, Openfire...

We recommend you Metronome because it was specially designed for Jappix purposes. It is lightweight, easy to install, stable and offer great performances under load. It is fully compatible with all the Jappix tools, mostly you should use it because microblogging doesn't work correctly in Prosody (0.9 and less) and is very slow and heavy on resources in ejabberd. If you want to install it, just enter this command:

Metronome

Get Metronome

Install Metronome

UNIX user/group

Metronome runs (by default) on the metronome:metronome UNIX user/group pair.

To create this user/group pair, run:

sudo adduser --no-create-home --disabled-login --gecos 'Metronome' metronome

Install packages:

Now you can install all required Metronome packages. Execute the following command:

sudo apt-get install lua5.1 liblua5.1-dev liblua5.1-filesystem0 libidn11-dev libssl-dev lua-zlib lua-expat lua-event lua-bitop

Clone source

In order to clone the source, you need to have Git available on your server. If not, execute:

sudo apt-get install git

Then, we'll clone Metronome source in the /opt Linux directory, which is best suited for custom-installed software:

cd /opt; git clone https://github.com/maranda/metronome.git metronome

Build source

Once we got a copy of Metronome code, we need to configure it and compile it.

Execute the following command (here for Debian and Ubuntu systems):

cd ./metronome; ./configure --ostype=debian

Then, let's compile the code (it should be fast, since only the core is written in C):

make clean; make

Install build

Finally, we proceed Metronome install:

sudo make install

Init.d script

And then, we setup an init.d script, so that Metronome can start on server boot:

Download our Metronome init.d script and rename it to "metronome".

Then, upload it to your server in /etc/init.d and apply the following command on it:

sudo chmod +x /etc/init.d/metronome

To make it start on boot, execute the following command:

sudo update-rc.d metronome defaults

Don't launch it yet, we'll configure Metronome before it is first started.

Configure Metronome

You can download the Jappix.com Metronome configuration file (metronome.cfg.lua). This is the best example we can provide, fully working with Jappix. Feel free to reuse it for your personal usage, just change the jappix.com domain (and its subdomains) into your own.

Copy the example configuration file you downloaded above in /usr/local/etc/metronome/ and replace the existing one.

Then, edit it and change all "jappix.com" domain name entries with your own domain name. Feel free to tune it to suit your needs.

If you need help configuring Metronome, please refer to Metronome configuration help page.

Start Metronome

When you're done with Metronome configuration, you can launch it calling:

sudo /etc/init.d/metronome start

If it appends error, check all dependencies are satisfied. If it just timeouts and cannot start, the init.d script probably cannot create the PID file in /var/run.

For further error logs, check /var/log/metronome/metronome.err which contains server-wide (top-level and all modules) error logs.

Subdomains on Metronome

Please check that all the XMPP subdomains that you serve are configured in DNS as Internet-accessible network services.

If you don't add any DNS entry for a service like muc.example.tld, other external server users like those on jappix.com will not be able to join chatrooms hosted on your MUC service.

Update Metronome

In case you want to update your Metronome server, here are the instructions:

cd /opt/metronome; git pull; make clean; make; sudo make install

When this set of commands is completed, simply restart your server:

metronomectl restart

ejabberd

Install ejabberd

sudo apt-get install ejabberd

Then, open the ejabberd configuration file and edit it with your options:

sudo nano /etc/ejabberd/ejabberd.cfg

If you need help with the configuration, please follow this (French, sorry) help about installing and configuring ejabberd under Ubuntu: http://blog-perso.onzeweb.info/2006/08/25/tutoriel-ejabberd-ubuntu/

Configure ejabberd

You can download the Jappix.com ejabberd configuration file (ejabberd.cfg). This is the best example we can provide, fully working with Jappix. Feel free to reuse it for your personal usage, just change the jappix.com domain (and its subdomains) into your own.

Registration module

Due to lots of users complaining that they could not register new users on ejabberd through Jappix, here is the configuration you need to have to make it work:

{access, register, [{allow, all}]}.
{registration_timeout, infinity}.

You must also enable the mod_register with the proper rights:

{mod_register, [
  {access, register}
]}

Pubsub module

The microblogging feature of Jappix requires a special configuration of your XMPP server: we must enable the persistant PEP items storage (it's logical, because a microblog must keep a history of the activity!).

In the configuration file of ejabberd, first enter this:

{access, pubsub_createnode, [{allow, all}]}.

Then, enter this for the mod_pubsub module:

{access_createnode, pubsub_createnode},
{ignore_pep_from_offline, false},
{last_item_cache, false},
{max_items_node, 1000000},
{plugins, ["flat", "pep"]}]

When you're done, restart ejabberd and check there is no error.

#### Directory module

The user search feature of Jappix requires the server to provide a directory service (aka vJUD, virtual Jabber User Directory). It should be already enabled in the default ejabberd configuration.

If not, enable the mod_vcard module by adding a new item to the module list.

Subdomains on ejabberd

Each ejabberd module providing an XMPP service (like a MUC server or a vJUD server) use a subdomain, mapped to your root XMPP domain.

For instance, our ejabberd is running jappix.com, our MUC server is muc.jappix.com.

In some cases you need to create the proper DNS entries for your domain name to enable access to all these ejabberd services running on subdomains.