protegeproject / webprotege

The webprotege code base
Other
628 stars 253 forks source link

Keycloak container fails to create directory? #813

Open sorenwacker opened 3 weeks ago

sorenwacker commented 3 weeks ago

I am trying to run webprotege with docker compose.

Unfortunately, the setup suggested at git@github.com:protegeproject/webprotege-deploy.git does not work out-of-the-box without modifications. I mainly change the volumnes to be local subdirectories. And all containers now start, except for keycloak.

This is my setup:

  keycloak:
    image: protegeproject/keycloak
    # ports:
    #   - 8080:8080
    environment:
      KEYCLOAK_USER: admin
      KEYCLOAK_PASSWORD: password
      PROXY_ADDRESS_FORWARDING: "true"
      KEYCLOAK_LOGLEVEL: DEBUG
      KEYCLOAK_FRONTEND_URL: "http://webprotege-local.edu/auth"
      KEYCLOAK_IMPORT: /tmp/webprotege.json
      KEYCLOAK_HOSTNAME_ADMIN_URL: "http://webprotege-local.edu/auth"
    volumes:
      - ./data/keycloak-h2:/opt/jboss/keycloak/standalone/data
      - ./data/keycloak-tmp:/tmp
    healthcheck:
      test: [ "CMD", "curl", "--fail", "http://localhost:8080/auth/realms/master" ]
      interval: 30s
      timeout: 10s
      retries: 5

But then it fails with:

keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  |   Using Embedded H2 database
keycloak-1  | 
keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  |   JBoss Bootstrap Environment
keycloak-1  | 
keycloak-1  |   JBOSS_HOME: /opt/jboss/keycloak
keycloak-1  | 
keycloak-1  |   JAVA: java
keycloak-1  | 
keycloak-1  |   JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true   --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED
keycloak-1  | 
keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  | 08:55:52,933 INFO  [org.jboss.modules] (main) JBoss Modules version 1.11.0.Final
keycloak-1  | java.lang.IllegalStateException: WFLYSRV0126: Could not create server content directory: /opt/jboss/keycloak/standalone/data/content
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:494)
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.Main.determineEnvironment(Main.java:407)
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.Main.main(Main.java:96)
keycloak-1  |   at org.jboss.modules.Module.run(Module.java:353)
keycloak-1  |   at org.jboss.modules.Module.run(Module.java:321)
keycloak-1  |   at org.jboss.modules.Main.main(Main.java:617)
keycloak-1  | 08:55:53,590 FATAL [org.jboss.as.server] (main) WFLYSRV0239: Aborting with exit code 1
keycloak-1  | 
keycloak-1 exited with code 1

I tried to create that folder for the tool manually as suggested here.

data/keycloak-h2/
└── content

But then another error is raised:

keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  |   Using Embedded H2 database
keycloak-1  | 
keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  |   JBoss Bootstrap Environment
keycloak-1  | 
keycloak-1  |   JBOSS_HOME: /opt/jboss/keycloak
keycloak-1  | 
keycloak-1  |   JAVA: java
keycloak-1  | 
keycloak-1  |   JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true   --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED
keycloak-1  | 
keycloak-1  | =========================================================================
keycloak-1  | 
keycloak-1  | 09:09:17,634 INFO  [org.jboss.modules] (main) JBoss Modules version 1.11.0.Final
keycloak-1  | java.lang.IllegalStateException: WFLYSRV0231: Could not read or create the server UUID in file: /opt/jboss/keycloak/standalone/data/kernel/process-uuid
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:594)
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.Main.determineEnvironment(Main.java:407)
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.Main.main(Main.java:96)
keycloak-1  |   at org.jboss.modules.Module.run(Module.java:353)
keycloak-1  |   at org.jboss.modules.Module.run(Module.java:321)
keycloak-1  |   at org.jboss.modules.Main.main(Main.java:617)
keycloak-1  | Caused by: java.nio.file.AccessDeniedException: /opt/jboss/keycloak/standalone/data/kernel
keycloak-1  |   at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
keycloak-1  |   at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
keycloak-1  |   at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
keycloak-1  |   at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389)
keycloak-1  |   at java.base/java.nio.file.Files.createDirectory(Files.java:690)
keycloak-1  |   at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:797)
keycloak-1  |   at java.base/java.nio.file.Files.createDirectories(Files.java:783)
keycloak-1  |   at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.operations.common.ProcessEnvironment.obtainProcessUUID(ProcessEnvironment.java:193)
keycloak-1  |   at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:592)
keycloak-1  |   ... 5 more
keycloak-1  | 09:09:18,260 FATAL [org.jboss.as.server] (main) WFLYSRV0239: Aborting with exit code 1
keycloak-1  | 
keycloak-1 exited with code 1