2

我有一个自定义的 SPI javascript 提供程序,打包在.jar文件中,如官方 Keycloak 文档中所述。对于本地开发,我通过 docker-compose 文件使用 jboss/keycloak docker 映像,并将卷映射到standalone/deployments文件夹集。该软件包已部署并且工作正常,但 Keycloak 会每 5 秒重新部署一次相同的文件:

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

这是一种期望的行为,还是我可以以某种方式阻止它?

4

2 回答 2

3

显然,docker-composevolumes是问题所在。随着.jarWildfly AS 自动部署包,文件的属性发生了变化,这导致 Wildfly 将其作为更新文件使用。将特定卷映射更改为“绑定”类型

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

成功了

于 2021-03-23T09:06:39.093 回答
0

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

于 2021-11-09T19:45:11.900 回答