Merge pull request #328728 from NickCao/keycloak-metrics-spi

keycloak.plugins.keycloak-metrics-spi: 5.0.0 -> 6.0.0
This commit is contained in:
Nick Cao 2024-07-26 19:21:59 -04:00 committed by GitHub
commit 84fa4de5d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 12 deletions

View File

@ -44,6 +44,7 @@ let
};
plugins = with config.services.keycloak.package.plugins; [
keycloak-discord
keycloak-metrics-spi
];
};
environment.systemPackages = with pkgs; [
@ -121,6 +122,14 @@ let
| jq -r '"Authorization: bearer " + .access_token' >admin_auth_header
""")
# Register the metrics SPI
keycloak.succeed(
"""${pkgs.jre}/bin/keytool -import -alias snakeoil -file ${certs.ca.cert} -storepass aaaaaa -keystore cacert.jks -noprompt""",
"""KC_OPTS='-Djavax.net.ssl.trustStore=cacert.jks -Djavax.net.ssl.trustStorePassword=aaaaaa' kcadm.sh config credentials --server '${frontendUrl}' --realm master --user admin --password "$(<${adminPasswordFile})" """,
"""KC_OPTS='-Djavax.net.ssl.trustStore=cacert.jks -Djavax.net.ssl.trustStorePassword=aaaaaa' kcadm.sh update events/config -s 'eventsEnabled=true' -s 'adminEventsEnabled=true' -s 'eventsListeners+=metrics-listener'""",
"""curl -sSf '${frontendUrl}/realms/master/metrics' | grep '^keycloak_admin_event_UPDATE'"""
)
# Publish the realm, including a test OIDC client and user
keycloak.succeed(
"curl -sSf -H @admin_auth_header -X POST -H 'Content-Type: application/json' -d @${realmDataJson} '${frontendUrl}/admin/realms/'"

View File

@ -1,21 +1,21 @@
{ maven, stdenv, lib, fetchFromGitHub }:
{
maven,
lib,
fetchFromGitHub,
}:
maven.buildMavenPackage rec {
pname = "keycloak-metrics-spi";
version = "5.0.0";
version = "6.0.0";
src = fetchFromGitHub {
owner = "aerogear";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-iagXbsKsU4vNP9eg05bwXEo67iij3N2FF0BW50MjRGE=";
hash = "sha256-MMonBRau8FpfCqija6NEdvp4zJfEub2Kwk4MA7FYWHI=";
};
mvnHash = {
aarch64-linux = "sha256-zO79pRrY8TqrSK4bB8l4pl6834aFX2pidyk1j9Itz1E=`";
x86_64-linux = "sha256-+ySBrQ9yQ5ZxuVUh/mnHNEmugru3n8x5VR/RYEDCLAo=";
}.${stdenv.hostPlatform.system} or (throw "Unsupported system ${stdenv.hostPlatform.system} for ${pname}");
mvnHash = "sha256-u+UAbKDqtlBEwrzh6LRgs8sZfMZ1u2TAluzOxsBrb/k=";
installPhase = ''
runHook preInstall
@ -23,11 +23,11 @@ maven.buildMavenPackage rec {
runHook postInstall
'';
meta = with lib; {
meta = {
homepage = "https://github.com/aerogear/keycloak-metrics-spi";
description = "Keycloak Service Provider that adds a metrics endpoint";
license = licenses.asl20;
maintainers = with maintainers; [ benley ];
platforms = [ "aarch64-linux" "x86_64-linux" ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ benley ];
platforms = lib.platforms.linux;
};
}