Skip to content

Preparing the database

This section guides you through configuring the persistent database storage for your HCL Digital Experience (DX) IQ Integrator.

Production deployments require a PostgreSQL database to maintain conversation state and session memory across pod restarts and deployments. Select one of the three persistent storage options based on your deployment environment.

Warning

If you do not configure a persistent database, the system defaults to a temporary, in-memory SQLite database that deletes all session data whenever a pod restarts.

Choose from the following database configurations:

  • An internal PostgreSQL database provisioned automatically by your DX Persistence Node for Kubernetes-only deployments.
  • An external PostgreSQL instance located outside your DX deployment, such as a cloud-managed, on-premises, or separate Kubernetes cluster database.
  • A PostgreSQL database provisioned and managed automatically within your DX deployment by your DX Runtime Controller (RTC).

Configuring an internal database

Use this option to automatically provision a PostgreSQL database within your DX deployment. Upgrade the DX deployment to create the database, and then deploy DX IQ to connect to it.

Important

  • When upgrading the DX IQ release (<IQ_RELEASE_NAME>) in this section, always use -f custom-iq-values.yaml without --reuse-values. The --reuse-values flag can cause configuration drift by preserving old values not in your custom values file. In this topic, <IQ_RELEASE_NAME> is the DX IQ Helm release name (for example, dx-iq).
  • Use the same custom-iq-values.yaml file you created in Deploying DX IQ services. Add the database configuration values shown in this section to that file, then run all helm upgrade commands with -f custom-iq-values.yaml.

Prerequisites

Before configuring the internal database, verify that your DX deployment (<DX_RELEASE_NAME>) is fully operational within your target namespace (<DX_NAMESPACE>) and includes an active Persistence Node. In this topic, <DX_NAMESPACE> is the Kubernetes namespace where DX is deployed (for example, dxns).

Verifying an existing database setup

If your DX deployment was recently provisioned or upgraded with DX IQ database credentials and networking configuration, the iqdb database and user might already exist. Run the following commands to verify.

  1. Check for an existing DX IQ database:

    kubectl exec -n <DX_NAMESPACE> <DX_RELEASE_NAME>-persistence-node-0 -c persistence-node -- \
      psql -U postgres -c "\l" | grep iq
    
    • <DX_NAMESPACE>: The DX deployment namespace (for example, dxns).
    • <DX_RELEASE_NAME>: The DX Helm release name.
  2. Check for an existing DX IQ user:

    kubectl exec -n <DX_NAMESPACE> <DX_RELEASE_NAME>-persistence-node-0 -c persistence-node -- \
      psql -U postgres -c "\du" | grep -i iq
    

If both exist, you can go directly to Deploying DX IQ with database configuration. If either is missing, proceed to the following provisioning section.

Provisioning the database

DX configuration management

The custom-values.yaml file is the primary configuration file for DX deployments. For detailed information on how to create and manage this file, refer to Prepare Configuration.

  1. Add the DX IQ database configuration to your DX custom-values.yaml file:

    security:
      iq:
        dbUser: "dx_iq_db_user"
        dbPassword: "<SECURE_PASSWORD>"
    
    networking:
      dxIqService: "<IQ_SERVICE_NAME>"
    
    • <SECURE_PASSWORD>: A secure password for the DX IQ database user.
    • <IQ_SERVICE_NAME>: The Kubernetes service name for the DX IQ deployment, which typically follows the <IQ_RELEASE_NAME>-integrator format (for example, if the DX IQ release name is dx-iq, the service name is dx-iq-integrator).

    Important

    Setting networking.dxIqService enables the Persistence Node to pass the IQ_DB_USER and IQ_DB_PASSWORD environment variables to the PostgreSQL initialization script. This is required for automatic database and user creation.

  2. Upgrade your DX deployment to enable DX IQ database provisioning and automatically generate the database secret:

    helm upgrade <DX_RELEASE_NAME> \
      https://<YOUR_REPOSITORY_FQDN_AND_PATH>/<DX_HELM_CHART_VERSION>.tgz \
      --namespace <DX_NAMESPACE> \
      -f custom-values.yaml
    
    • <DX_RELEASE_NAME>: The DX Helm release name.
    • <YOUR_REPOSITORY_FQDN_AND_PATH>: The repository fully qualified domain name (FQDN) and path.
    • <DX_HELM_CHART_VERSION>: The DX Helm chart version.
    • <DX_NAMESPACE>: The DX deployment namespace (for example, dxns).

    Configuration management

    Do not use --reuse-values in production environments to prevent configuration drift.

    To find available Helm chart versions in your repository, search in the user interface or run a curl command. For example, in JFrog Artifactory:

    curl -u <USERNAME>:<TOKEN> "https://<YOUR_REPOSITORY_FQDN_AND_PATH>/"
    
    • <USERNAME>: The username for your repository.
    • <TOKEN>: The access token for your repository.
  3. Monitor the Persistence Node logs to track database and user initialization:

    1. Monitor the Persistence Node logs:

      kubectl logs -n <DX_NAMESPACE> <DX_RELEASE_NAME>-persistence-node-0 | grep -i "iq"
      

      Output:

      Creating IQ user "dx_iq_db_user"...
      Creating IQ database "iqdb"...
      
    2. Run the following command to verify database and user creation:

      kubectl exec -n <DX_NAMESPACE> <DX_RELEASE_NAME>-persistence-node-0 -c persistence-node -- \
        psql -U postgres -c "\du" | grep dx_iq_db_user
      

Deploying DX IQ with database configuration

  1. Update your custom-iq-values.yaml file with the database configuration using one of the following options:

    Add the following configuration block to your custom-iq-values.yaml file:

    configuration:
      database:
        enabled: true
        dbHost: "<DX_RELEASE_NAME>-persistence.<DX_NAMESPACE>.svc.cluster.local"
        dbPort: 5432
        dbName: "iqdb"
        dbUser: "dx_iq_db_user"
        dbPassword: "<SECURE_PASSWORD>"
    
    • <DX_RELEASE_NAME>: The DX Helm release name.
    • <DX_NAMESPACE>: The DX deployment namespace (for example, dxns).
    • dbUser: "dx_iq_db_user": The database user name. This name is fixed for the internal database, so use the same value you set in Step 1 of Provisioning the database.
    • <SECURE_PASSWORD>: The same dbPassword you configured in Step 1 of Provisioning the database.

    Add the following configuration block to your custom-iq-values.yaml file, referencing the secret generated by your DX deployment upgrade in Step 2 of Provisioning the database:

    configuration:
      database:
        enabled: true
        dbHost: "<DX_RELEASE_NAME>-persistence.<DX_NAMESPACE>.svc.cluster.local"
        dbPort: 5432
        dbName: "iqdb"
        dbCustomSecret: "custom-credentials-iq-db"
    
    • <DX_RELEASE_NAME>: The DX Helm release name.

    Same namespace required

    This option only works when your DX IQ deployment is in the same Kubernetes namespace as your DX deployment. Kubernetes secrets are namespace-scoped and cannot be referenced across namespaces. If DX IQ is deployed in a different namespace, use the database credentials option.

  2. Upgrade your DX IQ deployment with your updated custom-iq-values.yaml file:

    helm upgrade <IQ_RELEASE_NAME> \
      https://<YOUR_REPOSITORY_FQDN_AND_PATH>/<IQ_HELM_CHART_VERSION>.tgz \
      --namespace <DX_NAMESPACE> \
      -f custom-iq-values.yaml
    
    • <IQ_RELEASE_NAME>: The DX IQ Helm release name (for example, dx-iq).
    • <YOUR_REPOSITORY_FQDN_AND_PATH>: The repository FQDN and path.
    • <IQ_HELM_CHART_VERSION>: The DX IQ Helm chart version.
  3. Verify that the database credentials are configured based on your chosen configuration option:

    Verify that the ConfigMap was created:

    kubectl get configmap -n <DX_NAMESPACE> <IQ_RELEASE_NAME>-integrator
    kubectl describe configmap -n <DX_NAMESPACE> <IQ_RELEASE_NAME>-integrator
    

    Verify that the referenced DX secret exists in the namespace:

    kubectl get secret -n <DX_NAMESPACE> custom-credentials-iq-db
    kubectl describe secret -n <DX_NAMESPACE> custom-credentials-iq-db
    

Configuring an external database

Use this option to connect to an existing PostgreSQL database located outside of your DX deployment. Create a Kubernetes secret to store the credentials, and then deploy DX IQ to connect to it.

Network connectivity requirement

Your Kubernetes cluster must have outbound network access to reach the external database server. If your cluster is isolated or behind a firewall, ensure:

  • Egress rules allow outbound traffic on the database port (TCP port 5432 for PostgreSQL).
  • Security groups (AWS) or firewall rules (GCP or Azure) permit connections to the external database host.
  • Network policies allow egress traffic to external networks when using Calico or another Container Network Interface (CNI).

If connectivity fails with ENETUNREACH or Network is unreachable errors, contact your infrastructure team to enable outbound access to the external database.

  1. Create a Kubernetes secret to store your external database credentials:

    kubectl create secret generic <DB_SECRET_NAME> \
      --namespace <DX_NAMESPACE> \
      --from-literal=username=<DB_USERNAME> \
      --from-literal=password=<DB_PASSWORD>
    
    • <DB_SECRET_NAME>: The name of the Kubernetes secret that stores the external database credentials (for example, custom-external-db-credentials).
    • <DX_NAMESPACE>: The Kubernetes namespace where DX is deployed (for example, dxns).
    • <DB_USERNAME>: The database username.
    • <DB_PASSWORD>: The database password.
  2. Verify that the secret was created successfully:

    kubectl get secret <DB_SECRET_NAME> -n <DX_NAMESPACE>
    kubectl describe secret <DB_SECRET_NAME> -n <DX_NAMESPACE>
    
  3. Update your custom-iq-values.yaml file to define the external database connection settings, referencing the secret name (<DB_SECRET_NAME>) from Step 1:

    configuration:
      database:
        enabled: true
        dbHost: "<EXTERNAL_DB_HOST>"
        dbPort: 5432
        dbName: "<DB_NAME>"
        dbCustomSecret: "<DB_SECRET_NAME>"
    
    • <EXTERNAL_DB_HOST>: The hostname or IP address of the external PostgreSQL server. For example:

      External server Values
      AWS RDS PostgreSQL iq-postgres.c9akciq32.us-east-1.rds.amazonaws.com
      Azure Database for PostgreSQL myserver.postgres.database.azure.com
      Google Cloud SQL Use Cloud SQL Auth proxy or instance IP (for example, 10.0.1.5)
      Different Kubernetes cluster The fully qualified DNS name or IP address of the PostgreSQL server accessible from the cluster network
      On-premises or external The reachable hostname or IP address (for example, postgres.company.internal or 192.168.1.50)
    • <DB_NAME>: The name of the DX IQ database.

    • <DB_SECRET_NAME>: The secret name from Step 1.
  4. Upgrade your DX IQ deployment with your updated custom-iq-values.yaml file:

    helm upgrade <IQ_RELEASE_NAME> \
      https://<YOUR_REPOSITORY_FQDN_AND_PATH>/<IQ_HELM_CHART_VERSION>.tgz \
      --namespace <DX_NAMESPACE> \
      -f custom-iq-values.yaml
    
    • <IQ_RELEASE_NAME>: The DX IQ Helm release name (for example, dx-iq).
    • <YOUR_REPOSITORY_FQDN_AND_PATH>: The repository FQDN and path.
    • <IQ_HELM_CHART_VERSION>: The DX IQ Helm chart version.
  5. Upgrade your DX deployment to enable DX IQ:

    1. Retrieve your current DX deployment Helm chart version:

      helm list -n <DX_NAMESPACE>
      helm get all <DX_RELEASE_NAME> --namespace <DX_NAMESPACE>
      
    2. Add the DX IQ service configuration to your DX custom-values.yaml file:

      networking:
        dxIqService: "<IQ_SERVICE_NAME>"
      

      <IQ_SERVICE_NAME>: The Kubernetes service name for the DX IQ deployment, which typically follows the <IQ_RELEASE_NAME>-integrator format (for example, if the DX IQ release name is dx-iq, the service name is dx-iq-integrator).

    3. Upgrade the DX deployment with your updated custom-values.yaml file:

      helm upgrade <DX_RELEASE_NAME> \
        https://<YOUR_REPOSITORY_FQDN_AND_PATH>/<DX_HELM_CHART_VERSION>.tgz \
        --namespace <DX_NAMESPACE> \
        -f custom-values.yaml
      
      • <DX_RELEASE_NAME>: The DX Helm release name (for example, dx-deployment).
      • <DX_HELM_CHART_VERSION>: The DX Helm chart version.

      Configuration management

      Always use your custom-values.yaml file for configuration changes instead of --set flags. For more information refer to Prepare configuration.

      To find available Helm chart versions in your repository, search in the user interface or run a curl command. For example, in JFrog Artifactory:

      curl -u <USERNAME>:<TOKEN> "https://<YOUR_REPOSITORY_FQDN_AND_PATH>/"
      
      • <USERNAME>: The username for your repository.
      • <TOKEN>: The access token for your repository.

Configuring an RTC-managed database

Use this option to automatically provision and manage a PostgreSQL database within the DX deployment using the DX RTC.

  1. Create the DX IQ database credentials secrets:

    1. Delete the existing DX IQ database credentials secrets if they exist from a previous installation:

      kubectl delete secret custom-credentials-iq-db -n <DX_NAMESPACE> --ignore-not-found
      kubectl delete secret <DX_RELEASE_NAME>-custom-credentials-iq-db -n <DX_NAMESPACE> --ignore-not-found
      kubectl delete secret <DX_RELEASE_NAME>custom-credentials-iq-db-previous-value -n <DX_NAMESPACE> --ignore-not-found
      
      • <DX_NAMESPACE>: The DX deployment namespace (for example, dxns).
      • <DX_RELEASE_NAME>: The DX Helm release name (for example, dx-deployment).
    2. Create the new secrets:

      1. Create the base secret:

        kubectl create secret generic custom-credentials-iq-db \
        --namespace <DX_NAMESPACE> \
        --from-literal=username=<DB_USERNAME> \
        --from-literal=password=<DB_PASSWORD>
        
        • <DB_USERNAME>: The database username.
        • <DB_PASSWORD>: The database password.
      2. Create the release-specific secret:

        kubectl create secret generic <DX_RELEASE_NAME>-custom-credentials-iq-db \
        --namespace <DX_NAMESPACE> \
        --from-literal=username=<DB_USERNAME> \
        --from-literal=password=<DB_PASSWORD>
        
      3. Create the previous-value secret:

        kubectl create secret generic <DX_RELEASE_NAME>custom-credentials-iq-db-previous-value \
        --namespace <DX_NAMESPACE> \
        --from-literal=username=<DB_USERNAME> \
        --from-literal=password=<DB_PASSWORD>
        
  2. Verify that the secrets were created:

    1. Verify that the base secret exists:

      kubectl get secret custom-credentials-iq-db -n <DX_NAMESPACE>
      kubectl describe secret custom-credentials-iq-db -n <DX_NAMESPACE>
      
    2. Verify that the release-specific secret exists:

      kubectl get secret <DX_RELEASE_NAME>-custom-credentials-iq-db -n <DX_NAMESPACE>
      kubectl describe secret <DX_RELEASE_NAME>-custom-credentials-iq-db -n <DX_NAMESPACE>
      
    3. Verify that the previous-value secret exists:

      kubectl get secret <DX_RELEASE_NAME>custom-credentials-iq-db-previous-value -n <DX_NAMESPACE>
      kubectl describe secret <DX_RELEASE_NAME>custom-credentials-iq-db-previous-value -n <DX_NAMESPACE>
      
  3. Upgrade the DX deployment to enable RTC database management for DX IQ:

    1. Retrieve the current DX deployment Helm chart version:

      helm list -n <DX_NAMESPACE>
      helm get all <DX_RELEASE_NAME> --namespace <DX_NAMESPACE>
      
    2. Add the RTC database configuration to your DX custom-values.yaml file:

      configuration:
        digitalAssetManagement:
          newDbManagement: true
      
      networking:
        dxIqService: "<IQ_SERVICE_NAME>"
      
      security:
        iq:
          customDbSecret: "custom-credentials-iq-db"
      

      <IQ_SERVICE_NAME>: The Kubernetes service name for the DX IQ deployment, which typically follows the <IQ_RELEASE_NAME>-integrator format (for example, if the DX IQ release name is dx-iq, the service name is dx-iq-integrator).

    3. Upgrade the DX deployment with your updated custom-values.yaml file:

      helm upgrade <DX_RELEASE_NAME> \
        https://<YOUR_REPOSITORY_FQDN_AND_PATH>/<DX_HELM_CHART_VERSION>.tgz \
        --namespace <DX_NAMESPACE> \
        -f custom-values.yaml
      
      • <YOUR_REPOSITORY_FQDN_AND_PATH>: The repository FQDN and path to specified package or image.
      • <DX_HELM_CHART_VERSION>: The DX Helm chart version.

      To find available Helm chart versions in your repository, search in the user interface or run a curl command. For example, in JFrog Artifactory:

      curl -u <USERNAME>:<TOKEN> "https://<YOUR_REPOSITORY_FQDN_AND_PATH>/"
      
      • <USERNAME>: The username for your repository.
      • <TOKEN>: The access token for your repository.
  4. Monitor the RTC logs to track database creation:

    kubectl logs -n <DX_NAMESPACE> deployment/<DX_RELEASE_NAME>-runtime-controller | grep -i "iq"
    

    Output:

    IQ database setup completed successfully.
    

    To verify persistence layer initialization:

    kubectl logs -n <DX_NAMESPACE> deployment/<DX_RELEASE_NAME>-runtime-controller | grep -E "persistence|pgpool"
    
  5. After the RTC pod is running and the database is initialized, run a shell script to configure pgpool to recognize the DX IQ database user:

    1. Create the add-iq-user-to-pgpool.sh script file:

      #!/bin/bash
      
      IQ_USER="<DB_USERNAME>"
      IQ_PASS="<DB_PASSWORD>"
      POD_NAME=$(kubectl get pods -n <DX_NAMESPACE> -l app=<DX_RELEASE_NAME>-persistence-connection-pool -o jsonpath='{.items[0].metadata.name}')
      NAMESPACE="<DX_NAMESPACE>"
      
      echo "1. Generating MD5 hash..."
      HASH=$(echo -n "${IQ_PASS}${IQ_USER}" | md5sum | awk '{print $1}')
      
      echo "2. Appending credentials to ${POD_NAME}..."
      kubectl exec -n $NAMESPACE $POD_NAME -- sh -c "echo '${IQ_USER}:md5${HASH}' >> /conf/pool_passwd"
      
      echo "3. Reloading PgPool configuration smoothly..."
      # Automatically finds the main parent PgPool process and sends the reload signal
      kubectl exec -n $NAMESPACE $POD_NAME -- sh -c 'kill -HUP $(ps -o pid,args | grep "[b]in/pgpool" | awk "{print \$1}")'
      
      echo "Done! Current configuration:"
      kubectl exec -n $NAMESPACE $POD_NAME -- tail -n 1 /conf/pool_passwd
      
    2. Make the script executable:

      chmod +x add-iq-user-to-pgpool.sh
      
    3. Run the script:

      ./add-iq-user-to-pgpool.sh
      

      Expected output:

      1. Generating MD5 hash...
      2. Appending credentials to dx-deployment-persistence-connection-pool-666c7d8476-qn2s9...
      3. Reloading PgPool configuration smoothly...
      Done! Current configuration:
      
    4. Verify that the DX IQ user was added to the pgpool configuration:

      POD_NAME=$(kubectl get pods -n <DX_NAMESPACE> -l app=<DX_RELEASE_NAME>-persistence-connection-pool -o jsonpath='{.items[0].metadata.name}')
      kubectl exec -n <DX_NAMESPACE> $POD_NAME -- cat /conf/pool_passwd
      

      Verify that the output includes the DX IQ user entry with the MD5 hash (for example, <DB_USERNAME>:md5<HASH_VALUE>, where <HASH_VALUE> is the MD5 hash that the script generates).

  6. Verify that the database, user, environment variables, and secrets are successfully created and configured:

    1. Confirm the database and user roles exist in the persistence node:

      kubectl exec -n <DX_NAMESPACE> <DX_RELEASE_NAME>-persistence-node-0 -c persistence-node -- \
        psql -U postgres -c "\l" | grep iq
      
      kubectl exec -n <DX_NAMESPACE> <DX_RELEASE_NAME>-persistence-node-0 -c persistence-node -- \
        psql -U postgres -c "\du" | grep iq
      
    2. Confirm the database management flags are active and the credentials secret exists:

      kubectl exec -n <DX_NAMESPACE> deployment/<DX_RELEASE_NAME>-runtime-controller -- env | grep -E "IQ_|NEW_DB"
      kubectl get secret custom-credentials-iq-db -n <DX_NAMESPACE>
      
  7. Update your custom-iq-values.yaml file with the RTC-managed database configuration:

    Important

    The dbName must be iqdb. This is the fixed name that the RTC creates. Do not use a custom name.

    configuration:
      database:
        enabled: true
        dbHost: "<DX_RELEASE_NAME>-persistence.<DX_NAMESPACE>.svc.cluster.local"
        dbPort: 5432
        dbName: "iqdb"
        dbCustomSecret: "custom-credentials-iq-db"
    

    Different namespaces

    The DX IQ chart reads the custom-credentials-iq-db secret from the namespace where DX IQ is deployed. If DX IQ is deployed in a different namespace than DX, also create the custom-credentials-iq-db secret in the DX IQ namespace.

  8. Upgrade the DX IQ deployment with your updated custom-iq-values.yaml file:

    helm upgrade <IQ_RELEASE_NAME> \
      https://<YOUR_REPOSITORY_FQDN_AND_PATH>/<IQ_HELM_CHART_VERSION>.tgz \
      --namespace <DX_NAMESPACE> \
      -f custom-iq-values.yaml
    
    • <IQ_RELEASE_NAME>: The DX IQ Helm release name (for example, dx-iq).
    • <IQ_HELM_CHART_VERSION>: The DX IQ Helm chart version.

Next steps

After configuring your database:

  1. Verify that the DX IQ pod can connect to the database successfully.
  2. Configure DX IQ Integrator authentication for LiteLLM access.
  3. Run regular backups to ensure data recovery if a failure occurs.
Related information