Configuring PostgreSQL connection

You must configure PostgreSQL for the chat data to be saved in the database.

Before you begin

You must install PostgreSQL and configure database. For more information, see Installing PostgreSQL and Configuring database.

Procedure

  1. Go to the Z ChatOps configuration directory.
    • For container users:
      1. Go to the directory where you extract the IBM Z® ChatOps container archive.
      2. Run the following command to open an interactive shell on the IBM Z ChatOps container that is running.
        ./bnzContainer.sh shell
      3. Go to the configuration directory.
        cd config
        Tip: If you are familiar with docker/podman commands, you can use commands to open the interactive bash shell. You can also edit the configuration files directly in the mounted path of the zchatops-configuration-1144, zchatops-configuration-1143, zchatops-configuration-1142, zchatops-configuration-1141, or zchatops-configuration-114 volume.
    • For native installation users:
      Run the following command:
      cd $ZCHATOPS_HOME/config
  2. Edit the configuration file, for example, ZCHATOPS_HOME/config/postgresql-server.yaml.
    # Specify the host name or IP address of your PostgreSQL server.
    hostName: Your host name
    
    # Specify the port number of your PostgreSQL server.
    # The default value is 5432.
    port: 5432
    
    # Specify the database that you want to connect on your PostgreSQL server.
    # The default value is zchatops.
    databaseName: zchatops
    
    # Specify the user used to access your database on your PostgreSQL server.
    # The default value is bnzdb.
    userName: bnzdb
    
    # Specify the password of the user.
    password: Your password
    
    # Specify the pool max size.
    # The default value is 20.
    max: 20
    
    # Specify the value that idle clients will close after <value>(ms).
    # The default value is 1000.
    idleTimeoutMillis: 1000
    
    # Specify the value that will return an error after <value>(ms) if connection could not be established.
    # The default value is 1000.
    connectionTimeoutMillis: 1000
    
    # Close (and replace) a connection after it has been used <value> times.
    # The default value is 7500.
    maxUses: 7500
    
    # Specify the configuration of Secure Sockets Layer.
    ssl:
      # Specify enable ssl or not.
      # The default value is false.
      enabled: false
    
      # If true the server will request a certificate from clients that connect and attempt to verify that certificate.
      # The default value is false.
      requestCert: false
    
      # If true the server will reject any connection which is not authorized with the list of supplied CAs. This option only has an effect if requestCert is true.
      # The default value is true.
      rejectUnauthorized: true
    
      # Specify the absolute file path of the CA certificate of your Kafka server.
      ca: Your absolute ca file path of the kafka server
    
      # Specify the absolute file path of the key of your Kafka server.
      key: Your absolute key file path of the kafka server
    
      # Specify the absolute file path of the TLS certificate of your Kafka server.
      cert: Your absolute certificate file path of the kafka server
    
    Update the values for each field in the JSON file:
    hostName
    Specifies the host name or IP address of your PostgreSQL server.
    port
    Specifies the port number of your PostgreSQL server. The default number is 5432.
    databaseName
    Specifies the database that you want to connect on your PostgreSQL server. The default value is zchatops.
    userName
    Specifies your user name that is used to access the database on your PostgreSQL server. The default value is bnzdb.
    password
    Specifies your password.
    max
    Specifies the maximum size of the pool. The default value is 20.
    idelTimeoutMillis
    Specifies after how many milliseconds idle clients will close. The default value is 1000.
    connectionTimeoutMillis
    Specifies after how many milliseconds an error will return if the connection cannot be established. The default value is 1000.
    maxUses
    Specifies how many times a connection is used before it is closed and replaced. The default value is 7500.
    enabled
    Specifies to enable SSL or not. The default value is false.
    requestCert
    Specifies if the server will request a certificate from clients that it connects to and verify that certificate. The default value is false.
    rejectUnauthorized
    Specifies if the server will reject any connection that is not authorized with the list of supplied CAs. This option takes effect only when requestCert is set to true. The default value is true.
    ca
    Specifies the absolute file path of the CA certificate of your Kafka server.
    key
    Specifies the absolute file path of the key of your Kafka server.
    cert
    Specifies the absolute file path of the TLS certificate of your Kafka server.