Database

Database

Our helm chart supports external and containerized PostgreSQL.

Containerized PostgreSQL

This is enabled by default. The PostgreSQL will be installed on the cluster as part of the riaapps helm chart.


database:
  postgresql:
    enabled: true
    # To set a default storage class for the PostgreSQL database,
    uncomment the line below and set the desired storage class.
    # If not set, the default storage class of the cluster will be used.
    # global:
    # defaultStorageClass: ""
    # To use an existing PersistentVolumeClaim for the PostgreSQL
    database, uncomment the lines below and set the name of the existing
    claim.
    # If you want to use a PersistentVolumeClaim, ensure that the claim
    exists in the same namespace as the PostgreSQL deployment.
    # Default size is set to 100Gi, but you can adjust it as needed.
    # primary:
    #   persistence:
    #     enabled: true
    #     existingClaim: ""
    #     size: 100Gi
  • database.postgresql.global.defaultStorageClass — storage class to be used for persistent storage of PostgreSQL and backup.
  • database.postgresql.primary.existingClaim — existing PVC in the cluster.
  • database.postgresql.primary.size — size of the PVC.

External PostgreSQL database

To initialize and use an external PostgreSQL database for your Test Automation, use the following configuration.

database:
  config:
    DB_HOST: "IP_OR_HOST_OF_THE_DB_SERVER"
  admin:
    DB_ADMIN_USER: "ADMIN_USERNAME"
    DB_ADMIN_PASSWORD: "ADMIN_PASSWORD"
  • database.config.DB_HOST — IP Address or hostname of the PostgreSQL database that is accessible from the cluster.
  • database.admin.DB_ADMIN_USER — PostgreSQL database admin user that has access to create roles, users, and databases.
  • database.admin.DB_ADMIN_PASSWORD — PostgreSQL database admin password.

Existing TA V3 database

To use a pre-initialized database or existing test automation v3 database, use the following configuration.

database:
  config:
    DB_HOST: "IP_OR_HOST_OF_THE_DB_SERVER"
    DB_PASSWORD: "password"
    DB_NAME: "db-name"
    DB_USERNAME: "username"
  initDb:
    enabled: false
  • database.config.DB_HOST — IP Address or Hostname of the PostgreSQL database that is accessible from the cluster.
  • database.config.DB_USERNAME — username that has access to the existing database.
  • database.config.DB_PASSWORD — password of the specified username.
  • database.config.DB_NAME — database name of the existing database.

Configure your resources

Configure the volume size, resources limits, and resources requests. To configure these values, see Recommended Resources Configuration.

The Test Automation is pre-configured with the following resource requests and limits:

Microservice Replicas CPU Requests(m) Memory Requests (Mi) CPU Limits (m) Memory Limits (Mi)
fw-auth 1 1000 2000 1000 2000
fw-eureka 1 500 1000 500 1000
fw-fwssoui 1 100 100 100 100
fw-gateway 3 1000 2000 1000 2000
fw-notification 500 1000 500 1000
fw-ssologin 1 100 100 100 100
fw-tms 1 500 1000 500 1000
fw-tmsui 1 100 100 100 100
fw-ui 1 100 100 100 100
fw-utilities 1 500 1000 500 1000
ta-api-executor 1 1000 2000 1000 2000
ta-batch-executor 1 1000 2000 1000 2000
ta-core 1 1000 2000 1000 2000
ta-exec-dispatcher 1 1000 2000 1000 2000
ta-external-db 1 1000 2000 1000 2000
ta-ui 1 100 500 100 500
ta-ui-executor 1 1000 2000 1000 2000
ta-doc-hub 1 1000 2000 1000 2000
kafka 3 1000 2000 2000 3000
hazelcast 3 500 1000 1000 2000

Initialize the database using a script

To initialize your database using a scipt, follow these steps:

  1. Locate the db-init.zip file.

  2. Extract the contents to a directory of your choice. This will create a db-init directory containing the script and SQL files.
    unzip db-init.zip -d db-init

  3. Navigate to the directory where the files were extracted.
    cd db-init

  4. Ensure the run_scripts.sh script is executable.
    chmod +x run_scripts.sh

  5. Execute the script.
    ./run_scripts.sh

Example execution

$ ./run_scripts.sh
Enter database name: testautomationdb
Enter database host: 10.101.2.101
Enter database user: postgres
Enter database password: ********
Testing connectivity to the database server...
Checking if the database 'testautomationdb' exists...
Database 'testautomationdb' does not exist. Creating it...
Database 'testautomationdb' created successfully.
Running SQL scripts...
SQL scripts executed successfully.

Considerations

Database

  • This script is intended for PostgreSQL databases only.
  • Use strong passwords for database users.
  • Review the TA_PREREQ.sql and FW_PREREQ.sql files to ensure requirements are met before execution.

Dynamic Paths

  • The script dynamically determines its directory and uses it to locate the SQL files.
  • Ensure the TA_PREREQ.sql and FW_PREREQ.sql files are in the same directory as the script after extraction.

Database Privileges

  • The user specified in the script must have the CREATE DATABASE privilege to create a new database, if it does not exist.

Error Handling

  • If the script fails to connect to the database server, verify the host, username, and password.
  • If the database creation fails, ensure the user has sufficient privileges.

Troubleshooting

Connection Issues

  • Ensure the PostgreSQL server is running and accessible from the host where the script is executed.
  • Verify that the firewall or network settings allow connections to the PostgreSQL server on port 5432.

Permission Errors

  • Ensure that the database user has the necessary privileges to create databases and execute SQL scripts.

File Not Found

  • If the script reports missing SQL files, ensure the db-init.zip file was extracted correctly, and all files are in the same directory.