-
Notifications
You must be signed in to change notification settings - Fork 306
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
Make MPCONFIG usable in *all* DataSourceDefinition properties / FISH-862 #5024
Comments
…ONFIG. IQSS#7418 Due to payara/Payara#5024 this is currently not possible. Needs to be addressed in a later enhancement when Payara provides a solution.
Hi, @poikilotherm, Thank you for your enhancement request. I have raised an internal issue 'FISH-862', however, I will stress that this feature request may take a long time before it is worked on by our engineering team, due to the sheer number of requests and our priority being customer requests. I highly recommend that you attempt to implement this feature yourself in a community contribution, as it may be faster in that sense. Thank you, |
Hi @AlanRoth Yet I would love some guidance to avoid misconcepts and heading down the wrong road. This is also a TCK relevant part and I don't want people to fix bugs I created in this code largely dated back to 2011. |
@poikilotherm Every help is welcome. I think you are on the right track with |
|
The only thing I would be concerned about in that area is there is also bean validation on the properties. It may be that it won't work with non-String properties but I can't quite remember. |
A very simple fix for the annotation only is likely in the DataSourceDefinition annotation handler here Another good enhancement could be hijacking the properties section of the annotation and loading a specified properties file using Properties props = Properties.load(this.getClass().getResourceAsStream(...)); as this would enable changing properties without recompiling code e.g. the definition could be; @DataSourceDefinition(
name = "java:app/jdbc/dataverse",
className = "org.postgresql.ds.PGConnectionPoolDataSource",
user = "${MPCONFIG=dataverse.db.user}",
password = "${MPCONFIG=dataverse.db.password}",
url = "jdbc:postgresql://${MPCONFIG=dataverse.db.host}:${MPCONFIG=dataverse.db.port}/${MPCONFIG=dataverse.db.name}",
minPoolSize = 10,
maxPoolSize = 100,
maxIdleTime = 300,
properties = {
"properties-to-load.properties"
}
) |
Hi @poikilotherm, starting today we are introducing some relevant changes to our Github Issues Community Policy, which you can read here. The most significant change is that we want to introduce open votes for all suggested enhancements and improvements to the Payara Platform, like the one described in this issue. To this effect we are going to transition this issue to Voting status and gauge the community interest on your proposal. We know that previously we accepted your requested and escalated it to the our Platform Development team, but after careful deliberation and analysis we want to improve our community engagement in a way that’s productive and relevant for our overall user community. We hope that you understand this decision. |
I think the idea is very good that, in addition to the previous configuration options, i can also define integer values or payara-specific properties via the MP Config. We have different database configurations (e.g. PoolSize) in our different environments. Unfortunately it is impossible for us to define this via the elegant MP Config way. So far we used asadmin commands in docker file for payara full depending on the enviroment. So we hope that in the future we will be able to define our environment-dependent database properties via the Miroprofile Config. Both for integer values and Payara specific parameters. |
Hi @poikilotherm, While working on a fix for #5059 I also tried the MPCONFIG configuration. I also found that when you provide the settings by creating the microprofile-config.properties file in META-INF in your application it won't work. The reason for this is that the 'application' config properties are only available after the application has been deployed. So if you used the META-INF/microprofile-config.properties approach then this is probable the reason. |
Hi @thehpi, not so sure about the availability of values from Yet, this enhancement request is about adding support to configure properties that the Jakarta EE interface defines as integers (no way to override those by string substitution for most of 'em) and use MPCONFIG with the Based on my code research, I'm very sure this is not possible yet, but it would be great to see your workaround. |
@thehpi I looked at #5142 and it does a lot more than just replacing the classname via var substitution... Thank you very much for your work on this!
Looks like there is just one thing left from my enhancement request here: setting integer only properties like pool sizes etc. @AlanRoth I'd be happy to add some code for this, using non-portable properties with prefix "fish.payara...." like the other special props. Sounds good? |
Hi @poikilotherm, sounds good. Submit a PR and we'll gladly have a look! |
Hi @poikilotherm, Yes #5142 is accepted and merged into master. It fixes #5095 but also does ENV/MPCONFIG etc expansion in all other DatasourceDefinition settings but also in the properties. So if you have a property to replace the DatasourceDefintion setting for 'minPoolSize' etc, then you can use that in a new release. So you could use something like: @DataSourceDefinition(
name = "java:global/myDS",
className = "${MPCONFIG=nl.thehpi.jdbc.db.class_name}",
user = "${MPCONFIG=nl.thehpi.jdbc.db.user}",
password = "${MPCONFIG=nl.thehpi.jdbc.db.password}",
url = "jdbc:${MPCONFIG=nl.thehpi.jdbc.db.type}:${MPCONFIG=nl.thehpi.jdbc.db.url}",
properties = {
"fish.payara.pool-resize-quantity=${MPCONFIG=nl.thehpi.jdbc.pool-resize-quantity}",
"fish.payara.is-connection-validation-required=${MPCONFIG=nl.thehpi.jdbc.validation-required}",
"fish.payara.connection-validation-method=${MPCONFIG=nl.thehpi.jdbc.validation-method}",
"fish.payara.validation-table-name=${MPCONFIG=nl.thehpi.jdbc.validation-table-name}",
"fish.payara.min-pool-size=${MPCONFIG=nl.thehpi.jdbc.db.minPoolSize}",
"fish.payara.max-pool-size=${MPCONFIG=nl.thehpi.jdbc.db.maxPoolSize}",
"fish.payara.idle-timeout-in-seconds=${MPCONFIG=nl.thehpi.jdbc.db.maxIdleTime}"
}
) And in payara you could use a post-boot-script like e.g.
|
Using a data source definition in
web.xml
or@DataSourceDefinition
does not allow to use${MPCONFIG=...}
(or${ENV}
) for Payara specific options ("fish.payara.xxx") or integer values used i. e. formaxIdleTime
.This should be changed to allow for more flexible configuration and fine-tuning in deployments.
Expected Outcome
Successfull deployment with JDBC pools configured via MicroProfile Config API for any kind of setting. Usually non-portable, but most options aren't portable anyway.
Provide an option to set the integer based pool settings (
minPoolSize, maxPoolSize
, ...) from a Payara specific properties setting using a String and thus enable variable substitution. (e. g.fish.payara.max-pool-size
, ...)Current Outcome
When using a data source like
this will fail to deploy with quite generic errors:
Context (Optional)
The idea is to enable Dataverse admins to configure certain things like monitoring for slow queries etc by configuring simple settings via MicroProfile Config API.
Digging through
I come to the conclusion, that MPCONFIG (or ENV or ALIAS) is only usable for options using
TranslatedConfigView
inJdbcConnectionPoolDeployer.getMCFConfigProperties()
. (Please correct me if I'm missing sth. here.)Environment
The text was updated successfully, but these errors were encountered: