-
Notifications
You must be signed in to change notification settings - Fork 492
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
7000 mpconfig basic infra #8823
Conversation
It doesn't seem we are going to use MPCONFIG as the primary source of settings from the database for now. This commit removes the DbConfigSource which has had errors, too. Fixes IQSS#7680
The microbean implementation of MicroProfile Config has not been updated to MPCONFIG 2.0. Switching to the smallrye implementation for testing scope.
To be able to have more control over JVM settings names, avoid typos, maybe create lists of settings and so on, this enum will provide the place to add any old and new settings that are destined to be made at the JVM level. Further extensions of this class include adding aliases when renaming settings, adding predicates for validation and offering injecting parameters into keys (as used with the files subsystem).
To provide built-time static settings, property files under src/main/resources are now filtered by maven to replace any variables ${propertyname} known by Maven with their values before storing the file under /target.
To add JVM settings (system properties) during a test, this helper annotation ensures one is not using a wrong key and the setting is deleted after the test to avoid interfering with other tests.
Retrieving a setting as a simple String is a very often use case within the codebase. To make these lookups easier to write and comprehend, adding convenience methods here. These are simple wrappers around the MicroProfile Config lookup.
Save some CPU cycles for negligible memory consumption.
- When renaming older JVM settings, these should be still retrievable from an old config - The AliasConfigSource now takes aliased settings from JvmSettings for this - This is just for pure renaming but could be further extended with data manipulation.
Instead of only receiving a setting as String via the fluent lookup API, also allow to pass a target type to make use of Converters.
To simplify SystemConfig.getVersion, the MicroProfile Config property dataverse.version is set to the Maven project version via filtering the variable.
When the alias config properties file cannot be read and an IOException is thrown, the underlying reason will be logged in addition.
…aliases Before, the aliases from JVM settings enum where only read when the alias config file was successfully read. This made no sense - if this file is missing, we can still properly operate on the aliases from JvmSettings.
Hey @scolapasta as requested, merged latest develop. Is it fine to leave the other PRs for actual features untouched for now and rebase once this is merged? Oh and dear future reviewer: happy to do some demos for this stuff 🙃 |
@poikilotherm sure, since you'll want to rebase then, that makes perfect sense. (especially since there's a decent chance we'll have 5.12 out by then and you'd have to do it an even extra time...) |
Emphasize that the change is for devs for now. The idea is to migrate settings to the new framework over time.
I'm basically ready to approve this PR but I thought I'd try the new I looked at PR #8824 and played around with our First I tried changing the method to this...
... and added the following to domain.xml ...
... but at http://localhost:8080/api/info/version I got an empty JSON object ( Hmm. What did I miss? I noticed that PR #8824 also included this line...
... and while the Update: I pushed my scratch work of playing around with "lookup" and "dataverse.version" here: pdurbin@898dce1 |
@poikilotherm and I chatted. The bottom line is that I'm going to update to the version of Payara in PR #8949 (5.2022.3) to see if I can still reproduce the This time I reproduced it slightly differently. First, I made the following change to exercise "lookup":
As before I have "dataverse.version" defined in domain.xml:
Then I built and deployed with Somewhat surprisingly, it worked! I saw "awesome" as the version: $ curl http://localhost:8080/api/info/version But the I changed the version in domain.xml like this...
... and instead of seeing a new version, I got the same 500 error and Again, I'll try again with a newer Payara. |
Upgrading from Payara 5.2021.5 to 5.2022.3 made the This is ready for QA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments in the PR. No real change happens and devs should be ready to use "lookup" once they upgrade Payara.
Co-authored-by: Oliver Bertuch <poikilotherm@users.noreply.github.com>
At standup I said I'm basically ready to merge this (maybe after poking a bit more) but as the reviewer I'm happy to let someone else take another look and merge it. As people free up, someone might grab it. |
At standup I said I'm still ready to merge this so I assigned myself. Sounds like we want to merge another PR first. |
What this PR does / why we need it:
This will introduce the most basic infrastructure necessary for MicroProfile Config usage to replace any System.getProperty() calls - see also #7000. This enables configuring the JVM settings via the different MPCONFIG in a backward compatible manner (existing installations can keep their configuration but will receive infos in the logs about migrating).
This will ease container and (to some extent) development usage a lot. However, it will not interfere with Database Settings for now.
THIS PULL REQUEST IS THE MOST BASIC INFRASTRUCTURE FOR #8823, #8824, #8825, #8826, #8827, #8828
Which issue(s) this PR closes:
Closes #7680
Special notes for your reviewer:
This pull request is basically just setting the JVM settings retrieval infrastructure in place. It doesn't touch any existing code yet (this will be done in succeeding small pull requests). It has unit tests added where necessary.
Suggestions on how to test this:
As there are no changes to existing functionality and the whole thing is still decoupled from all of our code in this PR, there isn't much to test. You can run the test included and play around with
@JvmSetting
for JUnit 5 tests.Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Nope, this PR is only dev related.
Is there a release notes update needed for this change?:
Not from this PR IMHO. PRs following up that change actual code should contain hints if necessary.
Additional documentation:
Included.