Upgrading to Keycloak 19.0.0 from 18.0.1

When I try to upgrade keycloak from 18.0.1 to 19.0.0, the application starts from in-memory database.
The db configuration was working fine with 18.0.1, but not in 19.0.0.

My docker file looks like below.

FROM Quay as builder

ENV KC_HEALTH_ENABLED=true
ENV KC_METRICS_ENABLED=true
ENV KC_FEATURES=token-exchange,docker
ENV KC_DB=postgres
ENV KC_CACHE_STACK=kubernetes
ENV KC_TRANSACTION_XA_ENABLED=false
WORKDIR /opt/keycloak
RUN curl -O -k https:///themes/mytheme.jar
RUN cp *.jar /opt/keycloak/providers/
RUN /opt/keycloak/bin/kc.sh build

FROM Quay
COPY --from=builder /opt/keycloak/lib/quarkus/ /opt/keycloak/lib/quarkus/
COPY --from=builder /opt/keycloak/providers/ /opt/keycloak/providers/

WORKDIR /opt/keycloak
ENV KC_SPI_EVENTS_LISTENER_JBOSS_LOGGING_SUCCESS_LEVEL=INFO
ENV KC_SPI_EVENTS_LISTENER_JBOSS_LOGGING_ERROR_LEVEL=ERROR

ENTRYPOINT [“/opt/keycloak/bin/kc.sh”, “start”]

The database configuration in the helm chart is given below:

    - name: KC_DB_URL_HOST
      value: DB-URL
    - name: KC_DB_URL_DATABASE
      value: DB-NAME
    - name: KC_DB_URL_PROPERTIES
      value: "?sendStringParametersAsUnicode=false"
    - name: KC_DB_USERNAME
      value: "<username>"
    - name: KC_DB_PASSWORD
      value: "<password>"
    - name: KC_DB_POOL_MIN_SIZE
      value: "1"
    - name: KC_DB_POOL_MAX_SIZE
      value: "50"

Anybody faced this issue, or is there any change in configuration while upgrading to version 19.0.0?
Please help.

@akr I faced similar issue with keycloak 18.0.1 when I was trying to start the server in non-strict mode (no HTTPS) on my local. But when I started in strict mode it worked fine. I didn’t spend too much time investigating the behavior. Can you please let me know if you find any resolution?

kc 19 made changes to start, you now need to pass the --optimized flag (or similar, please check the docs) to avoid auto-build kicking in.

2 Likes

I added the --optimized flag and it worked!! thanks @bpedersen2 .