Inherited an legacy keycloak (v10). I need to move some of the realm which some of the applications are current using, into a new server.
My initial plan is to do a clean v19 install, and do an realm export from v10, and import to v19. However, after doing some research, I think it’s not compatible. Please correct me if I’m wrong.
Has anyone has done similar upgrade before? What would be the best approach here?
Keycloak is designed with a migration mechanism that should work to upgrade between versions. People have reported various degrees of success with “big” upgrades. I would recommend the following steps:
back up your database and import the backup to a test database instance
try running v19 against that database, and see if the automatic db migration works
if it doesn’t work, go incrementally by major version, one at a time (this is pretty easy if you just have a docker-compose file where you update the docker image every time you start)
assuming you can get some combinations of upgrades to work, run the same series in production
build an optimized Keycloak docker image with the db connection config into the dockerfile.
go with http only for now
My question now is, do I config the docker(keycloak) to be able to access the db on the server? I assume I need to somehow open 3306 from docker image to access it?
After many attempt, the docker keycloak fails to connect to the local MYSQL instance, keep getting:
Caused by: java.net.ConnectException: Connection refused (Connection refused)
I’ve now used Docker MYSQL and Docker Keycloak with success.
Here’s a quick summary
docker network create keycloak-network
docker run -v /opt/docker/volume:/var/lib/mysql -p 3306:3306 --name mysql -d --net keycloak-network -e MYSQL_DATABASE=keycloak -e MYSQL_USER=keycloak -e MYSQL_PASSWORD= -e MYSQL_ROOT_PASSWORD= mysql