Skip to content
This repository was archived by the owner on May 30, 2020. It is now read-only.

Update Keycloak

Adrian Matei edited this page May 8, 2017 · 4 revisions

This guide provides instructions for Keycloak Update from version 2.5.5.Final to 3.1.0.Final. It is based on the official recommendation - Migration from older versions, tailored for the project's needs.

Backup the database

I use the mysqldump utility with alias:

alias mysql-backup-keycloak-local='mysqldump keycloak -u keycloak -p keycloak -h 127.0.0.1 --port 3306 --single-transaction > ~/backup/db/keycloak_db_local_$(date "+%Y-%m-%d_%H:%M").sql'
$ mysql-backup-keycloak-local
Enter password:
$ ls -lrt ~/backup/db/
total 776
-rw-r--r--  1 ama  staff  199220 Mar 10 06:45 keycloak_db_prod_2017-03-10_06:44.sql
-rw-r--r--  1 ama  staff  191281 May  8 06:21 keycloak_db_local_2017-05-08_06:21.sql

Setup the new server

Download the newer version of keycloak

$ cd /opt
$ wget https://downloads.jboss.org/keycloak/3.1.0.Final/keycloak-3.1.0.Final.zip
$ unzip keycloak-3.1.0.Final.zip
$ ls -lrt
total 2308416
drwxr-xr-x@ 17 ama   staff        578 Feb 25  2016 keycloak-1.7.0.Final
-rw-r--r--@  1 ama   staff  150604116 Mar  3  2016 keycloak-1.9.0.Final.tar.gz
drwxr-xr-x  14 ama   staff        476 Mar 14 11:00 keycloak-2.5.5.Final
-rw-r--r--   1 ama   staff  175024577 Mar 14 13:13 keycloak-2.5.5.Final.zip
drwxr-xr-x@ 19 ama   staff        646 Apr  8 11:44 keycloak-1.9.0.Final
lrwxr-xr-x   1 ama   staff         20 Apr  8 11:45 keycloak -> keycloak-2.5.5.Final
drwxr-xr-x  15 ama   staff        510 May  3 06:10 keycloak-3.1.0.Final
-rw-r--r--   1 ama   staff  173667072 May  3 08:53 keycloak-3.1.0.Final.zip

Adjust the symbolic link

$ rm /opt/keycloak
$ cd /opt
$ ln -s keycloak-3.1.0.Final keycloak

Configure MySql on new server

Please see Move keycloak database from H2 to MySql

Do a diff on the old and new standalone.xml files

$ diff /opt/keycloak/standalone/configuration/standalone.xml /opt/keycloak-2.5.5.Final/standalone/configuration/standalone.xml
394a406
>                 <default-provider>jpa</default-provider>
400a413,421
>             <spi name="realm">
>                 <default-provider>jpa</default-provider>
>             </spi>
>             <spi name="user">
>                 <default-provider>jpa</default-provider>
>             </spi>
>             <spi name="userFederatedStorage">
>                 <default-provider>jpa</default-provider>
>             </spi>
406a428,430
>             <spi name="authorizationPersister">
>                 <default-provider>jpa</default-provider>
>             </spi>
455c479
<     <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
---
>     <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:300}">

Initially just adjust the offset to 300, as previously and then start the server. Looks all right.

Clone this wiki locally