3

I have a custom SPI javascript provider, packaged in the .jar file, as described in the official Keycloak docs. For the local development, I'm using jboss/keycloak docker image via docker-compose file with the volume mapping to the standalone/deployments folder set. The package is deployed and works OK, but Keycloak keeps to redeploy the same file every 5 seconds:

11:43:58,304 INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-8) Deploying Keycloak provider: custom-auth-provider.jar
11:43:58,320 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0013: Redeployed "custom-auth-provider.jar"
11:44:03,388 INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-4) Undeploying Keycloak provider: custom-auth-provider.jar
11:44:03,395 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028: Stopped deployment custom-auth-provider.jar (runtime-name: custom-auth-provider.jar) in 9ms
11:44:03,397 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "custom-auth-provider.jar" (runtime-name: "custom-auth-provider.jar")
11:44:03,409 INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-6) Deploying Keycloak provider: custom-auth-provider.jar
11:44:03,425 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "custom-auth-provider.jar" with deployment "custom-auth-provider.jar"
11:44:08,471 INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-1) Undeploying Keycloak provider: custom-auth-provider.jar
11:44:08,477 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment custom-auth-provider.jar (runtime-name: custom-auth-provider.jar) in 11ms
11:44:08,479 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "custom-auth-provider.jar" (runtime-name: "custom-auth-provider.jar")
11:44:08,493 INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-5) Deploying Keycloak provider: custom-auth-provider.jar
11:44:08,517 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0013: Redeployed "custom-auth-provider.jar"
11:44:13,573 INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-3) Undeploying Keycloak provider: custom-auth-provider.jar
11:44:13,581 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028: Stopped deployment custom-auth-provider.jar (runtime-name: custom-auth-provider.jar) in 11ms

Is this a desired behavior, or can I stop it somehow?

Jonas
  • 121,568
  • 97
  • 310
  • 388
st.lovas
  • 81
  • 7

3 Answers3

4

Apparently, the docker-compose volumes was the issue. With the automatic deployment of the .jar package by the Wildfly AS, properties of the file got changed, which caused Wildfly to consume it as an updated file. Changing the particular volume mapping to a 'bind' type

volumes:
      - type: bind  # bind mount type prevents file changes
        source: ./standalone/deployments/
        target: /opt/jboss/keycloak/standalone/deployments

did the trick

st.lovas
  • 81
  • 7
  • Doesn't work. I've just installed docker and don't do anything in docker configuration. Followed your comment and add volumes as you offered. But redeploying restarts all time. Do you have any other ideas? This comment https://stackoverflow.com/a/69904162/820262 doesn't fit my goals, because I have more than one jar and they can be added when I create a new plugin. – Artem Zubkov Jan 26 '22 at 14:51
2

I know this will be a late answer, but:

You should specify the .jar path in docker-compose like this:

volumes:
  - type: bind
    source: ./keycloak/spi/keycloak-event-listener-spi-0.1.jar
    target: /opt/jboss/keycloak/standalone/deployments/keycloak-event-listener-spi-0.1.jar

This solves the problem for me

Mahir Köle
  • 51
  • 1
  • 5
1

In my case, the issue was caused by using a folder outside of WSL.

The volume seams to act weirdly when it points on a windows folder.

Michaël COLL
  • 1,153
  • 13
  • 18