Ma1sd is super neat, but it'd be even better if I could use unix sockets. Even just for postgresql, but ideally for all database drivers.
I recently set up a Ma1sd instance with this requirement, and I got it working (yay!). This was done in conjunction with a homeserver installation that is also connecting to the same PostgreSQL cluster.
I did this by modifying the build.gradle file. Side note: I didn't even have full access to this file, just append-write (for reasons, okay...), but I was able to get it working by appending the following:
Where exampledbname is the name of the postgres database, and the path to the socket is /run/postgresql/.s.PGSQL.5432 (the default path after doing a fancypackaginator install-it postgresql on most *nix distros). Notes:
storage.provider.postgresql.username and ...password weren't required, because the username is given by the os kernel (peer authentication in postgres terms). I'm pretty sure those keys will still work correctly over a unix socket if needed, but I didn't test that.
It is not possible to use the "short" postgres socket path as some applications allow by specifying just /run/postgresql/, even with the default "port"
As much as I would have liked to, I couldn't figure out how to split the storage.provider.postgresql.database value onto multiple lines, but there are 356963 different ways of doing "multi-line strings" in YAML and I'm not going to try to wrap my small brain around all of them.
The path to the socket file may instead be specified by using a Java(tm) system property (ew, yuck!). On the plus side, this makes the database URI in the yaml file much shorter and slightly less ugly, and instead moves it to the SystemD unit file for example, where it is safely(ish) ignored if you do not make use of unix sockets in the config. Contrary to this, it uses Java system properties which I always thought were unsightly outside of the Spring framework, but I'm sure I'll receive excessive flak for that comment from the Java community. Shortening the socket path is still not allowed using this technique as far as I'm aware.
It'd still be neat if some instructions about how to connect using a UNIX socket, but low priority I guess, will open another ticket later if I come up with some ideas.
Hi!
Ma1sd is super neat, but it'd be even better if I could use unix sockets. Even just for postgresql, but ideally for all database drivers.
I recently set up a Ma1sd instance with this requirement, and I got it working (yay!). This was done in conjunction with a homeserver installation that is also connecting to the same PostgreSQL cluster.
I did this by modifying the build.gradle file. Side note: I didn't even have full access to this file, just append-write (for reasons, okay...), but I was able to get it working by appending the following:
I don't think RMI is required, but I didn't test it. Then for the config yaml, this was the entire storage section:
Where
exampledbname
is the name of the postgres database, and the path to the socket is/run/postgresql/.s.PGSQL.5432
(the default path after doing afancypackaginator install-it postgresql
on most *nix distros). Notes:storage.provider.postgresql.username
and...password
weren't required, because the username is given by the os kernel (peer
authentication in postgres terms). I'm pretty sure those keys will still work correctly over a unix socket if needed, but I didn't test that./run/postgresql/
, even with the default "port"storage.provider.postgresql.database
value onto multiple lines, but there are356963 different ways of doing "multi-line strings" in YAML and I'm not going to try to wrap my small brain around all of them.I'd be happy to answer questions if possible.
Thank you! :D