Giter VIP home page Giter VIP logo

ejabberd-postgresql-prototype's Introduction

ejabberd-postgresql-prototype

This repository is dedicated to demonstrate the configuration of an ejabberd server in combination with an PostgreSQL backend. It is based on the great hausgold/ejabberd Docker image to keep it small. Just boot it up and play with it. All the details are attached to this readme file.

Requirements

Getting started

First you need to clone this repository from Github:

# Clone the repository
$ git clone https://github.com/Jack12816/ejabberd-postgresql-prototype.git
# Go in the repository directory
$ cd ejabberd-postgresql-prototype

We assume you have prepared the requirements in advance. The only thing which is left, is to start the application:

$ make start

Pidgin Test

Just start Pidgin and create a new account and choose the following settings:

  • Protocol: XMPP
  • User: admin
  • Domain: jabber.local
  • Password: defaultpw

Afterwards accept the certificate request and then you should be able to send messages and create chat rooms. On the database side you can control the tables with pgAdmin (see the docker-compose file for the credentials, the hostname is db.local).

users archive

Caveats

For PostgreSQL you need to supply and migrate the schema yourself. Use the sql/pg.sql file, not the sql/pg.new.sql file. Except you have a ejabberd version which was compiled with --enable-new-sql-schema.

The good news for elastic Docker (Compose) setups is: when ejabberd fails to connect to the PostgreSQL database due to startup/migration reasons, it retries the connection 30 seconds later.

log results

Configuration

--- ejabberd.yml.orig	2018-01-20 21:00:50.000000000 +0100
+++ ejabberd.yml	2018-01-20 23:42:15.845922193 +0100
@@ -81,7 +81,7 @@
 ##   - "example.org"
 ##
 hosts:
-  - "{[MDNS_HOSTNAME]}"
+  - "jabber.local"

 ##
 ## route_subdomains: Delegate subdomains to other XMPP servers.
@@ -257,7 +257,13 @@
 ## If you want to use a different method,
 ## comment this line and enable the correct ones.
 ##
-auth_method: internal
+#
+# If you decide to store user password in ejabberd, you need to tell ejabberd
+# to use MySQL instead of internal database for authentication.  You thus need
+# to change ejabberd configuration auth_method to replace internal
+# authentication with sql:
+auth_method:
+  - sql

 ##
 ## Store the plain passwords or hashed for SCRAM:
@@ -348,6 +354,10 @@
 ## you want to use other database backends.
 ## Please consult the ejabberd Guide for details on database creation.

+# However, if you want to use MySQL for all modules that support MySQL as
+# db_type, you can simply use global option default_db: sql:
+default_db: sql
+
 ##
 ## MySQL server:
 ##
@@ -363,11 +373,11 @@
 ##
 ## PostgreSQL server:
 ##
-## sql_type: pgsql
-## sql_server: "server"
-## sql_database: "database"
-## sql_username: "username"
-## sql_password: "password"
+sql_type: pgsql
+sql_server: "db"
+sql_database: "ejabberd"
+sql_username: "postgres"
+sql_password: "postgres"
 ##
 ## If you want to specify the port:
 ## sql_port: 1234
@@ -429,7 +439,7 @@
   ##
   admin:
      user:
-       - "admin@{[MDNS_HOSTNAME]}"
+       - "[email protected]"

   ##
   ## Blocked users
@@ -669,10 +679,10 @@
   ## limited to 2GB which might be exceeded on large servers
   ## mod_mam: {} # for xep0313, mnesia is limited to 2GB, better use an SQL backend
   mod_mam:
-    request_activates_archiving: true
+    request_activates_archiving: false
     iqdisc: one_queue
     default: always
-    db_type: mnesia
+    db_type: sql
   mod_muc:
     ## host: "conference.@HOST@"
     access:

mDNS host configuration

If you running Ubuntu, everything should be in place out of the box. When you however find yourself unable to resolve the domains, read on.

Heads up: This is the Arch Linux way. (package and service names may differ, config is the same) Install the nss-mdns and avahi packages, enable and start the avahi-daemon.service. Then, edit the file /etc/nsswitch.conf and change the hosts line like this:

hosts: ... mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns ...

Further readings

Further reading

ejabberd-postgresql-prototype's People

Contributors

jack12816 avatar

Watchers

James Cloos avatar Mohan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.