Bring Your Own Storage for Keycloak

Bring Your Own Storage (BYOS) for Keycloak allows you to use your own Postgres database instance instead of the default one. This section guides you through the process of setting up BYOS for Keycloak.

Before you begin

  • Do the Postgres database instance set up.
  • Get the credentials, host, database name, and username details.

Instructions

To set up BYOS for Keycloak, follow these steps:
  1. Export install directory.
    export INSTALL_DIR=<install_directory>/ibm-concert
  2. Run the /$INSTALL_DIR/concert-hub/bin/set-byo-kc-db.sh script with the required parameters:
      --db-host=<host>                    
      --db-database=<database>           
      --db-username=<username>            
    
    # Optional parameters
      --is-vm=<true/false>                
      --namespace=<namespace>             
      --db-schema=<schema>                
      --db-url-port=<port>                
      --db-ssl-mode=<mode>                
      --db-ssl-root-cert=<path>
    Table 1. BYOS for Keycloak parameters
    Parameter Description
    --db-host=<host> The --db-host parameter specifies the database host, which is the hostname that you want to use with Keycloak.
    --db-database=<database> The --db-database parameter specifies the name of the Postgres database that you want to use with Keycloak.
    --db-username The --db-username parameter specifies the username to use for authentication with the Postgres database.
    --is-vm=<true/false> Optional: The --is-vm parameter is an optional flag that indicates whether Keycloak is being installed on a Virtual Machine (VM) or not. The default value of this parameter is false, which means that if you don't specify this parameter, the script will assume that you are not installing on a VM. If you are installing Keycloak on a VM, you should set this parameter to true to ensure that the script configures the environment correctly for a VM-based installation.
    --namespace=<namespace> Optional: The --namespace parameter specifies the Kubernetes namespace where Keycloak will be deployed. This parameter is mandatory for Kubernetes (k8s) deployments, meaning that you must provide a valid namespace when running the script in a k8s environment.
    --db-schema=<schema> Optional: The --db-schema parameter specifies the database schema that Keycloak will use to store its data. The default value of this parameter is public, which means that if you do not specify a schema, Keycloak will use the public schema by default.
    --db-url-port=<port> Optional: The --db-url-port parameter specifies the port number that Keycloak will use to connect to the Postgres database.
    --db-ssl-mode=<mode> Optional: The --db-ssl-mode parameter specifies the SSL mode that Keycloak will use to connect to the Postgres database.
    --db-ssl-root-cert=<path> Optional: The --db-ssl-root-cert parameter specifies the path to the SSL root certificate file that Keycloak will use to verify the identity of the Postgres database server.

    The script will generate the necessary secrets in case of Kubernetes deployments or config files for VM deployments.

Next steps

Continue with the deployment process.
Note: You do not need to pass HUB_STORAGE_CLASS, as you are bringing your own Postgres.