Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for UNIX sockets #7

Closed
jeroenhabets opened this issue May 12, 2024 · 5 comments
Closed

Add support for UNIX sockets #7

jeroenhabets opened this issue May 12, 2024 · 5 comments
Assignees

Comments

@jeroenhabets
Copy link

As per processone/ejabberd#3716 (comment) this library lacks support for UNIX sockets, thus blocking adding PostgreSQL UNIX socket support to ejabberd (also requested in processone/ejabberd#3165).

Now that Erlang has (stable) UNIX socket support for a while, a.o. used by ejabberd itself, it should be feasible.

@badlop badlop self-assigned this May 13, 2024
@badlop
Copy link
Member

badlop commented May 13, 2024

Ok, I wrote a small patch, it's committed in badlop@35550c5

And the corresponding update in ejabberd is badlop/ejabberd@b90e7fa

With that, ejabberd.yml may be configured with

sql_server: "unix:/var/run/postgresql/.s.PGSQL.5432"

It worked for me, please give it a try. If you need binary installers or containers for testing, tell me.

@jeroenhabets
Copy link
Author

Wow @badlop 🥇! Amazing response time here.

As I had never run ejabberd from source before it took my an hour to get it running as I wanted to help out testing. But then I got it to run successfully using both the old TCP/IP and new UNIX domain socket connection for PostgreSQL. NOTE: I just did a smoke test and my conversejs is happy with either server 👍 .

@Jieiku
Copy link

Jieiku commented May 13, 2024

Thank you very much for this @badlop , that is Awesome!

@jeroenhabets did you keep any notes for compiling/running from source? My instance of ejabberd is installed from a .deb file.

@jeroenhabets
Copy link
Author

@Jieiku I did :)

My starting point was:
https://github.com/processone/ejabberd/blob/master/COMPILE.md

For the tests I did:

git clone git@github.com:badlop/ejabberd.git ejabberd_badlop
cd ejabberd_badlop
git checkout pgsql-unix-socket

./autogen.sh
## Depends on your config / modules of course:
./configure --enable-pgsql --enable-zlib --enable-redis  --enable-stun --enable-sip --enable-new-sql-schema 
make prod

## Copy my config for this test (make a db backup first ;)) 
sudo cp /opt/ejabberd/conf/ejabberd.yml _build/prod/rel/ejabberd/conf/ejabberd.yml
## Don't forget to edit it (e.g. sql_server: "unix:/var/run/postgresql/.s.PGSQL.5432")
_build/prod/rel/ejabberd/conf/ejabberd.yml

## Run in foreground: (shutdown using Ctrl-C then choose a)
_build/prod/rel/ejabberd/bin/ejabberdctl live

Hope this is of any help to you...

@badlop
Copy link
Member

badlop commented May 27, 2024

This was committed in 996001d, and will be available in the next p1_pgsql release.

@badlop badlop closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants