eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

keycloak not starting #15346

Closed rabi112 closed 4 years ago

rabi112 commented 4 years ago

Describe the bug

Configuring Keycloak by modifying realm and user templates...
Creating Admin user...
Added 'admin' to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json', restart server to load user
Starting Keycloak server...
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
-Dkeycloak.migration.action=import -Dkeycloak.migration.provider=dir -Dkeycloak.migration.strategy=IGNORE_EXISTING -Dkeycloak.migration.dir=/scripts/ -Djboss.bind.address=0.0.0.0
=========================================================================
  Using PostgreSQL database
=========================================================================
14:43:39,506 INFO  [org.jboss.modules] (CLI command executor) JBoss Modules version 1.9.0.Final
Cannot start embedded server: WFLYEMB0022: Cannot invoke 'start' on embedded process: WFLYSRV0126: Could not create server content directory: /opt/jboss/keycloak/standalone/data/content
14:43:41,137 INFO  [org.jboss.modules] (CLI command executor) JBoss Modules version 1.9.0.Final
Cannot start embedded server: WFLYEMB0022: Cannot invoke 'start' on embedded process: WFLYSRV0126: Could not create server content directory: /opt/jboss/keycloak/standalone/data/content
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /opt/jboss/keycloak
  JAVA: /usr/lib/jvm/java/bin/java
  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 
=========================================================================
14:43:41,987 INFO  [org.jboss.modules] (main) JBoss Modules version 1.9.0.Final
java.lang.IllegalStateException: WFLYSRV0126: Could not create server content directory: /opt/jboss/keycloak/standalone/data/content
    at org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:491)
    at org.jboss.as.server.Main.determineEnvironment(Main.java:388)
    at org.jboss.as.server.Main.main(Main.java:96)
    at org.jboss.modules.Module.run(Module.java:352)
    at org.jboss.modules.Module.run(Module.java:320)
    at org.jboss.modules.Main.main(Main.java:593)

Che version

che-server:7.4.0 chectl/7.4.0 linux-x64 node-v10.17.0

Runtime

Environment

benoitf commented 4 years ago

@rabi112 is that postgresql pods is working ? Also I'm not reproducing the error

rabi112 commented 4 years ago

@benoitf yes postgresql pod is up. Is it related to user permission of persistence volume mount directory?

che-bot commented 4 years ago

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

rodolfoap commented 3 years ago

Found same bug when starting container. My docker-compose.yaml contains:

        volumes:
            - ./keycloak/db/:/opt/jboss/keycloak/standalone/data/

So, I had to mkdir -p ./keycloak/db/content which would create /opt/jboss/keycloak/standalone/data/ before running the container, and that worked. I just can notice this occurs since I've added x509 certificates to Keycloak to run it over https.

leolopez89 commented 3 years ago

Same bug, I solved the problem with:

chmod 777 ./keycloak/db/ -R
jmurrayrs commented 9 months ago

If you run the docker to wake up a server, probabilty your user isn't root privileges ( and it is right). The problem is caused because the folder structure is created with root privileges and when jboss wants to run a command to create the folder structure, an error is thrown. So, it's only run chown command to the directory giving "write powers" to the user.

For example

sudo chown $(whoami) -R volume-folder

BUT, it's a not good idea to run it in a production environment, because your user can't be a safe user.