[keycloak-dev] Extension for Health-Checks in Keycloak

Thomas Darimont thomas.darimont at googlemail.com
Tue Apr 4 16:45:40 EDT 2017


Hello group,

I wrote a small Keycloak extension [0] that exposes a health endpoint
with health-checks as a RealmResource.
Health Checks can be contributed with a dedicated SPI.
(I took some inspiration from Spring Boot and Wildfly Swarm Health-Checks:
[1])

I'm now looking for general feedback and suggestions for additional health
checks
that could be added (infinispan?) - perhaps this could even be added to
Keycloak directly.

Some things I noticed:
1) RealmResourceProvider allows to expose custom JAX-RS resources on realm
level but
there is no equivalent for "global" Resources, e.g. something like
KeycloakResourceProvider / PublicResourceProvider is missing.
I wanted to add health-check for the whole Keycloak Server not just a
realm...

2) It seems that many requests lead to a database tx being commited via
org.keycloak.services.filters.KeycloakTransactionCommitter, even if there
is no write to the database.
Is this intended?

3) The keycloak-server BOMs didn't work for me. Even if I declare

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.keycloak.bom</groupId>
                <artifactId>keycloak-spi-bom</artifactId>
                <version>${keycloak.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
in my pom.xml I need to provide <version> settings to keycloak
dependencies, e.g.
  <dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-server-spi-private</artifactId>
    <version>${keycloak.version}</version>
  </dependency>
which shouldn't be the case with a correct maven BOM.

I tried this with keycloak version 2.5.5.Final and 3.0.0.Final

Cheers,
Thomas

[0] https://github.com/thomasdarimont/keycloak-health-checks
[1]
https://wildfly-swarm.gitbooks.io/wildfly-swarm-users-guide/advanced/monitoring.html


More information about the keycloak-dev mailing list