Fixes #19563. Add a validation check to the Keycloak DS.

This commit is contained in:
Andrea Dell'Amico 2020-07-01 12:56:13 +02:00
parent 9bd5a14648
commit b029045dda
3 changed files with 24 additions and 2 deletions

View File

@ -12,6 +12,7 @@ keycloak_java_min_heap: '2048m'
keycloak_java_max_heap: '{{ keycloak_java_min_heap }}' keycloak_java_max_heap: '{{ keycloak_java_min_heap }}'
keycloak_use_external_db: True keycloak_use_external_db: True
# postgresql is the only supported choice for the time being
keycloak_db: 'postgresql' keycloak_db: 'postgresql'
keycloak_db_module_name: 'org.{{ keycloak_db }}' keycloak_db_module_name: 'org.{{ keycloak_db }}'
keycloak_db_module_path: 'org/{{ keycloak_db }}' keycloak_db_module_path: 'org/{{ keycloak_db }}'
@ -24,6 +25,7 @@ keycloak_database_user: keycloak_u
#keycloak_database_password: 'define it into a vault file' #keycloak_database_password: 'define it into a vault file'
keycloak_database_host: 'localhost' keycloak_database_host: 'localhost'
keycloak_database_max_pool_size: '50' keycloak_database_max_pool_size: '50'
keycloak_database_jboss_connection_checker: True
keycloak_admin_user: kadmin keycloak_admin_user: kadmin
#keycloak_admin_password: 'define it into a vault file' #keycloak_admin_password: 'define it into a vault file'

View File

@ -139,7 +139,17 @@
<pool> <pool>
<max-pool-size>{{ keycloak_database_max_pool_size }}</max-pool-size> <max-pool-size>{{ keycloak_database_max_pool_size }}</max-pool-size>
</pool> </pool>
<validation>
{% if keycloak_database_jboss_connection_checker %}
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"></valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>
{% else %}
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>10000</background-validation-millis>
{% endif %}
</validation>
<security> <security>
<user-name>{{ keycloak_database_user }}</user-name> <user-name>{{ keycloak_database_user }}</user-name>
<password>{{ keycloak_database_password }}</password> <password>{{ keycloak_database_password }}</password>

View File

@ -137,7 +137,17 @@
<pool> <pool>
<max-pool-size>{{ keycloak_database_max_pool_size }}</max-pool-size> <max-pool-size>{{ keycloak_database_max_pool_size }}</max-pool-size>
</pool> </pool>
<validation>
{% if keycloak_database_jboss_connection_checker %}
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"></valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>
{% else %}
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>10000</background-validation-millis>
{% endif %}
</validation>
<security> <security>
<user-name>{{ keycloak_database_user }}</user-name> <user-name>{{ keycloak_database_user }}</user-name>
<password>{{ keycloak_database_password }}</password> <password>{{ keycloak_database_password }}</password>