{"id":17482404,"url":"https://github.com/jack12816/ejabberd-postgresql-prototype","last_synced_at":"2025-04-10T12:02:46.595Z","repository":{"id":152209371,"uuid":"118285103","full_name":"Jack12816/ejabberd-postgresql-prototype","owner":"Jack12816","description":"A simple ejabberd/PostgreSQL setup prototype","archived":false,"fork":false,"pushed_at":"2018-01-22T14:31:50.000Z","size":176,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T02:17:27.944Z","etag":null,"topics":["docker","ejabberd","makefile","postgresql","prototype"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jack12816.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-20T22:15:27.000Z","updated_at":"2022-05-12T13:17:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"67a74c38-5e24-4577-b246-57cd0218385f","html_url":"https://github.com/Jack12816/ejabberd-postgresql-prototype","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"c36b73e57b2881c9c8c1bb822bb976506c040e40"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jack12816%2Fejabberd-postgresql-prototype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jack12816%2Fejabberd-postgresql-prototype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jack12816%2Fejabberd-postgresql-prototype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jack12816%2Fejabberd-postgresql-prototype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jack12816","download_url":"https://codeload.github.com/Jack12816/ejabberd-postgresql-prototype/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215522,"owners_count":21066624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","ejabberd","makefile","postgresql","prototype"],"created_at":"2024-10-18T23:06:00.183Z","updated_at":"2025-04-10T12:02:46.584Z","avatar_url":"https://github.com/Jack12816.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"![ejabberd-postgresql-prototype](docs/assets/project.png)\n\nThis repository is dedicated to demonstrate the configuration of an ejabberd\nserver in combination with an PostgreSQL backend. It is based on the great\n[hausgold/ejabberd Docker image](https://hub.docker.com/r/hausgold/ejabberd/)\nto keep it small. Just boot it up and play with it. All the details are\nattached to this readme file.\n\n- [Requirements](#requirements)\n- [Getting started](#getting-started)\n- [Pidgin Test](#pidgin-test)\n- [Caveats](#caveats)\n- [Configuration](#configuration)\n- [mDNS host configuration](#mdns-host-configuration)\n- [Further reading](#further-reading)\n\n## Requirements\n\n* [GNU Make](https://www.gnu.org/software/make/) (\u003e=4.2.1)\n* [Docker](https://www.docker.com/get-docker) (\u003e=17.06.0-ce)\n* [Docker Compose](https://docs.docker.com/compose/install/) (\u003e=1.15.0)\n* [pgAdmin](https://www.pgadmin.org/) - optional\n* [Pidgin](https://pidgin.im/) - optional\n\n## Getting started\n\nFirst you need to clone this repository from Github:\n\n```bash\n# Clone the repository\n$ git clone https://github.com/Jack12816/ejabberd-postgresql-prototype.git\n# Go in the repository directory\n$ cd ejabberd-postgresql-prototype\n```\n\nWe assume you have prepared the requirements in advance. The only thing\nwhich is left, is to start the application:\n\n```bash\n$ make start\n```\n\n## Pidgin Test\n\nJust start Pidgin and create a new account and choose the following settings:\n\n* Protocol: XMPP\n* User: admin\n* Domain: jabber.local\n* Password: defaultpw\n\nAfterwards accept the certificate request and then you should be able to send\nmessages and create chat rooms. On the database side you can control the tables\nwith pgAdmin (see the [docker-compose file](./docker-compose.yml) for the\ncredentials, the hostname is `db.local`).\n\n![users](docs/assets/users.png)\n![archive](docs/assets/archive.png)\n\n## Caveats\n\nFor PostgreSQL you need to supply and migrate the schema yourself. Use the\n[sql/pg.sql\nfile](https://github.com/processone/ejabberd/blob/master/sql/pg.sql), not the\n[sql/pg.new.sql\nfile](https://github.com/processone/ejabberd/blob/master/sql/pg.new.sql).\nExcept you have a ejabberd version [which was compiled\nwith](https://github.com/processone/ejabberd/issues/2183#issuecomment-354101801)\n`--enable-new-sql-schema`.\n\nThe good news for elastic Docker (Compose) setups is: when ejabberd fails to\nconnect to the PostgreSQL database due to startup/migration reasons, it retries\nthe connection 30 seconds later.\n\n![log results](docs/assets/logs.png)\n\n## Configuration\n\n```diff\n--- ejabberd.yml.orig\t2018-01-20 21:00:50.000000000 +0100\n+++ ejabberd.yml\t2018-01-20 23:42:15.845922193 +0100\n@@ -81,7 +81,7 @@\n ##   - \"example.org\"\n ##\n hosts:\n-  - \"{[MDNS_HOSTNAME]}\"\n+  - \"jabber.local\"\n\n ##\n ## route_subdomains: Delegate subdomains to other XMPP servers.\n@@ -257,7 +257,13 @@\n ## If you want to use a different method,\n ## comment this line and enable the correct ones.\n ##\n-auth_method: internal\n+#\n+# If you decide to store user password in ejabberd, you need to tell ejabberd\n+# to use MySQL instead of internal database for authentication.  You thus need\n+# to change ejabberd configuration auth_method to replace internal\n+# authentication with sql:\n+auth_method:\n+  - sql\n\n ##\n ## Store the plain passwords or hashed for SCRAM:\n@@ -348,6 +354,10 @@\n ## you want to use other database backends.\n ## Please consult the ejabberd Guide for details on database creation.\n\n+# However, if you want to use MySQL for all modules that support MySQL as\n+# db_type, you can simply use global option default_db: sql:\n+default_db: sql\n+\n ##\n ## MySQL server:\n ##\n@@ -363,11 +373,11 @@\n ##\n ## PostgreSQL server:\n ##\n-## sql_type: pgsql\n-## sql_server: \"server\"\n-## sql_database: \"database\"\n-## sql_username: \"username\"\n-## sql_password: \"password\"\n+sql_type: pgsql\n+sql_server: \"db\"\n+sql_database: \"ejabberd\"\n+sql_username: \"postgres\"\n+sql_password: \"postgres\"\n ##\n ## If you want to specify the port:\n ## sql_port: 1234\n@@ -429,7 +439,7 @@\n   ##\n   admin:\n      user:\n-       - \"admin@{[MDNS_HOSTNAME]}\"\n+       - \"admin@jabber.local\"\n\n   ##\n   ## Blocked users\n@@ -669,10 +679,10 @@\n   ## limited to 2GB which might be exceeded on large servers\n   ## mod_mam: {} # for xep0313, mnesia is limited to 2GB, better use an SQL backend\n   mod_mam:\n-    request_activates_archiving: true\n+    request_activates_archiving: false\n     iqdisc: one_queue\n     default: always\n-    db_type: mnesia\n+    db_type: sql\n   mod_muc:\n     ## host: \"conference.@HOST@\"\n     access:\n```\n\n## mDNS host configuration\n\nIf you running Ubuntu, everything should be in place out of the box. When\nyou however find yourself unable to resolve the domains, read on.\n\n**Heads up:** This is the Arch Linux way. (package and service names may\ndiffer, config is the same) Install the `nss-mdns` and `avahi` packages, enable\nand start the `avahi-daemon.service`. Then, edit the file /etc/nsswitch.conf\nand change the hosts line like this:\n\n```bash\nhosts: ... mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns ...\n```\n\n**Further readings**\n\n* Archlinux howto: https://wiki.archlinux.org/index.php/avahi\n* Ubuntu/Debian howto: https://wiki.ubuntuusers.de/Avahi/\n\n## Further reading\n\n* https://packages.ubuntu.com/bionic/ejabberd (suggestions)\n* https://docs.ejabberd.im/admin/databases/mysql/\n* https://docs.ejabberd.im/developer/sql-schema/\n* https://hub.docker.com/_/postgres/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjack12816%2Fejabberd-postgresql-prototype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjack12816%2Fejabberd-postgresql-prototype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjack12816%2Fejabberd-postgresql-prototype/lists"}