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

small QoL additions for running a SysML-v2 API server #109

Closed
wants to merge 2 commits into from

Conversation

wucke13
Copy link

@wucke13 wucke13 commented Jan 29, 2024

While setting up our API server for some toying around, there where some things that bugged us around the database setup. These two commits address our pain-points. As both changes should not break any existing behavior, we would like to upstream them. I'd be happy for a review, @ivan-gomes 😄

Wanja Zaeske added 2 commits January 29, 2024 14:29
This commit adds the `junixsocket` library to the dependencies. This
allows the usage of a UNIX domain socket connection to a `postgresql`
server. This promises both better performance, and it allows to use
a Linux user identity for authentication against the DB (versus
username/password auth for TCP/IP based communication to the DB).

The change is non-intrusive, i.e. per default TCP/IP is still used and
works as intended.

For more information, checkout:

- https://jdbc.postgresql.org/documentation/use/#unix-sockets
- https://kohlschutter.github.io/junixsocket/dependency.html#postgresql

In particular, setting the following two properties in the
`persistence.xml` suffices to connect to a postgresql via a socket file:

```
javax.persistence.jdbc.url='jdbc:postgresql://localhost/db-name?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$SystemProperty'
org.newsclub.net.unix.socket.default=/run/postgresql/.s.PGSQL.5432
```
Prior to this change, the only way to change the persistence settings
was to edit the `persistence.xml`. In case of a pre-build .jar, the
`persistence.xml` has to be contained in the .jar with the persistence
module [1], and can not be overridden. However, the current repo
hard-codes the DB connection details in the persistence.xml, which
makes it impossible to override the DB connection details for a fully
built .jar without changing that .jar file.

This change enable the overriding of the properties used for the JPA
`EntityManagerFactory` with system properties, so that DB connection
details can be altered without changing the .jar file.

[1] https://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_conf_specify.html
@seidewitz
Copy link
Member

Thank you for your interest in creating this proposed update. However, we are not accepting pull requests from outside our development team at this time. But, if you submit your proposal as a GitHub issue with your proposal, then we can add it to our internal development backlog to be considered for inclusion in a future release.

@seidewitz seidewitz closed this Jan 29, 2024
@wucke13
Copy link
Author

wucke13 commented Jan 29, 2024

@seidewitz Thank you for the quick answer. What a bummer. Anyhow, I quickly created #110 and #111. Is there any eta when/if the development will be opened up further?

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

Successfully merging this pull request may close these issues.

2 participants