Search code examples
ejabberd

User storage in ejabberd


I am trying to setup ejabberd as IM solution for my project, which will be mobile app + backend. I am using SQL auth (and SQL store for all modules also), using MSSQL via ODBC. I have some questions I didnt find answered in docs.

  1. Do I understand correctly, that ejabberd is multi-tenant (since it can support multiple domains). If so, how are users assigned to particular tenant (domain)? In users table in DB, there is only username (without domain part). Can I have two different users john@jabber.myproject.com and john@jabber.myotherproject.net ?
  2. I want to create XMPP accounts on ejabberd automatically (user doesnt need to know anything about underlaying service) - do I need to register users via API, or can I insert rows directly into DB table users and ejabberd will be OK with it?

Solution

  • In users table in DB, there is only username (without domain part). Can I have two different users john@jabber.myproject.com and john@jabber.myotherproject.net ?

    Create a new database for each vhost, and use the host_config option in ejabberd.yml to tell which database to use for each vhost:

    https://docs.ejabberd.im/admin/configuration/#database-and-ldap-configuration

    Or you can enable the new SQL schema, see https://blog.process-one.net/ejabberd-18-03/

    do I need to register users via API, or can I insert rows directly into DB table users and ejabberd will be OK with it?

    Both are acceptable. In the second case, there are chances that some task performed at account registration is missing in your server, but I don't remember any module that performs any task at account registration. So, it looks OK.