Lost User and Realm Data After Upgrading Keycloak from 17 to 22

Hello everyone,

I’ve recently upgraded Keycloak from version 17 to 22 and encountered a problem where I’m unable to view user and realm data. I’m utilizing Docker Compose with PostgreSQL for my setup.

Interestingly, when I revert to the previous version of Keycloak, all the user and realm data appears intact and accessible as expected. This leads me to believe that the upgrade process might be missing a step or requires additional configuration.

I’m aware that there have been changes to the environment variables in the newer version of Keycloak. However, I suspect that this might not be the root cause of the issue.

Below is my Docker Compose configuration:

version: '3'

volumes:
  postgres_data:
  keycloak_data:
  keycloak_logs:
  keycloak_config:
  keycloak_themes:

services:
   postgres:
    image: postgres
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - 5432:5432
    environment:
      POSTGRES_DB: keycloak
      POSTGRES_USER: keycloak
      POSTGRES_PASSWORD: password
    restart: always

   keycloak:
    image: quay.io/keycloak/keycloak:22.0.0
    environment:
      KC_DB: postgres
      KC_DB_URL: jdbc:postgresql://postgres:5432/keycloak?useSSL=false
      KC_DB_USERNAME: keycloak
      KC_DB_PASSWORD: password
      KC_PROXY: edge
    ports:
      - 80:8080
    depends_on:
      - postgres
    volumes:
      - keycloak_data:/opt/jboss/keycloak/standalone/data
      - keycloak_logs:/opt/jboss/keycloak/standalone/log
      - keycloak_config:/opt/jboss/keycloak/standalone/configuration
      - keycloak_themes:/opt/jboss/keycloak/themes
    command:
      - start
      - --auto-build
      - --db=postgres
    restart: alway

I’m reaching out to see if anyone has experienced similar issues or has insights into what additional steps might be necessary to successfully upgrade Keycloak while retaining access to user and realm data.

Thank you in advance for any help or guidance you can provide!

Hey @mateusaugusto

That is kind of a big jump. I know few change took place between those versions. What was your upgrade path to v22?

I tried to update to 18.0.0, same thing.