Configuring an external database for Plan and Control

You can configure an external PostgreSQL database for the Plan capability in DevOps Loop and provide the database connection details in the Helm chart so that Plan connects to the external database instead of using the default PostgreSQL service included with the chart.

Before you begin

You must have completed the following tasks:

  • Prepared the external PostgreSQL instance, and ensured that it is accessible from the Kubernetes cluster.
  • Ensured that the database user has permissions for insert, update, delete, select, and schema modifications (create, alter, drop tables and indexes).

  • Ensured that the Kubernetes cluster can reach the database host and port.

  • Ensured that the following information is available:
    • Database host name or IP address
    • Database port (default: 5432)
    • Database name
    • Database user name
    • Database password

About this task

You must update the installation script so that Plan connects to the external database. The modifications include defining database variables, creating a Kubernetes secret for the database credentials, and passing the database parameters to Helm during installation.

Procedure

  1. Add the required external database variables at the beginning of the installation script:
    PLAN_DB_HOST=<database-host>
    PLAN_DB_PORT=5432
    PLAN_DB_NAME=plan_db
    PLAN_DB_USER=plan_user
    PLAN_DB_PASSWORD=<database-password>

    These variables define the connection details for the external PostgreSQL database used by Plan.

  2. Set the Helm parameter postgresql.enabled=false to ensure the deployment does not create a database automatically.
  3. Create a devopsplan.yaml file that defines the external database connection, tenant datastore, and disables the internal PostgreSQL service:
    ## Spring datastore settings (PostgreSQL)
    ibm-devopsplan-prod:
      spring:
        datastore:
          url: "jdbc:postgresql://${PLAN_DB_HOST}:${PLAN_DB_PORT}/${PLAN_DB_NAME}"
          username: ${PLAN_DB_USER}
          password: ${PLAN_DB_PASSWORD}
    
    ## Tenant datastore settings (PostgreSQL)
      tenant:
        datastore:
          server: ${PLAN_DB_HOST}
          dbname: ${PLAN_DB_NAME}
          username: ${PLAN_DB_USER}
          password: ${PLAN_DB_PASSWORD}
    
    ## Optional SMTP settings
      global:
        platform:
          smtp:
            sender: ${EMAIL_FROM_ADDRESS}
            host: ${EMAIL_SERVER_HOST}
            port: ${EMAIL_SERVER_PORT}
            username: ${EMAIL_SERVER_USERNAME}
            password: ${EMAIL_SERVER_PASSWORD}
    
      postgresql:
        enabled: false
    
    ## CONTROL external database settings
      control:
        postgresql:
          host: "CONTROL_DB_HOST"
          dbName: "CONTROL_DB_NAME"
          username: "CONTROL_DB_USER"
          password: "CONTROL_DB_PASSWORD"
        postgresql:
          enabled: false
  4. Update the Helm install or upgrade command to use the external database by including the devopsplan.yaml file:
    helm upgrade devops-loop oci://hclcr.io/launch-helm/hcl-launch-plan-prod \
      --install \
      --namespace ${NAMESPACE} \
      -f devopsplan.yaml

Results

After you run the installation script, DevOps Loop is installed, and the Plan capability connects to the external PostgreSQL database by using the parameters defined in the script and the devopsplan.yaml file

What to do next

You must install DevOps Loop to apply the configuration. See Installation of DevOps Loop.