0

I was using Keycloak 16. Now that I want to upgrade to Keycloak 20, I see that they have changed a lot.

This is my docker-compose.yml file from 16:

version: "3.9"
services: 
    accounts:
        image: jboss/keycloak:latest
        container_name: Accounts
        ports: 
            - 8080:8080
        environment: 
            - KEYCLOAK_FRONTEND_URL=https://accounts.example.local/auth
            - PROXY_ADDRESS_FORWARDING=true
            - KEYCLOAK_USER=user
            - KEYCLOAK_PASSWORD=pass
            - DB_VENDOR=mariadb
            - DB_ADDR=database
            - DB_DATABASE=accounts
            - DB_USER=db_user
            - DB_PASSWORD=db_pass
        logging:
            driver: none
        restart: always
    database:
        image: mariadb
        container_name: AccountsDatabase
        ports:
            - 3306:3306
        environment:
            - MARIADB_ROOT_PASSWORD=root_pass
            - MYSQL_DATABASE=accounts
            - MYSQL_USER=db_user
            - MYSQL_PASSWORD=db_pass
        volumes:
            - /Temp/AccountsDatabases:/var/lib/mysql 
        logging:
            driver: none
        restart: always
    admin:
        image: adminer
        container_name: AccountsAdminer
        restart: always
        logging:
            driver: none
        ports:
            - 8080:8080
        environment:
            - ADMINER_DEFAULT_SERVER=database      

Now it seems that Keycloak needs a database URL.

I can't find out how can I connect MariaDB to Keycloak. I can't find out the URL of my MariaDB URL and the Keycloak blog says that they won't provide examples for any database other than their first class PostreSQL.

I'm stuck at this point. Any help is appreciated.

1 Answer 1

1

Their documents show KC_DB_URL is a JDBC URL.

So the simple form of jdbc:mariadb://host/database seems used in their tests, so for you:

     environment: 
        - KEYCLOAK_FRONTEND_URL=https://accounts.example.local/auth
        - PROXY_ADDRESS_FORWARDING=true
        - KEYCLOAK_USER=user
        - KEYCLOAK_PASSWORD=pass
        - KB_DB_URL=jdbc:mariadb://database/accounts
        - KB_DB_USER=db_user
        - KB_DB_PASSWORD=db_pass

note: I'm hoping/assuming the JDBC driver for MariaDB is in their container which it may not be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.