Recommended: Preparing databases and secrets for your chosen capabilities by running a script

The cp4a-prerequisites.sh script automates the preparation of databases and secrets for your Cloud Pak for Business Automation deployment. The script operates in three distinct modes to guide you through the preparation process.

About the script

Instead of manually creating databases and secrets for each capability in your deployment, use the cp4a-prerequisites.sh script to generate SQL statement files and YAML template files. Run the script before you install your deployment.

The script is located in the cert-kubernetes/scripts directory after you download the cert-kubernetes repository.

Script modes

The cp4a-prerequisites.sh script has three modes that you run sequentially:

property
Generates property files for your selected capabilities and database servers. You then edit these files to match your infrastructure.
generate
Uses the modified property files to generate DB SQL statement files and YAML templates for secrets.
validate
Checks whether the generated databases and secrets are correct and ready for a CP4BA deployment.

Before you begin

Before you run the script in property mode, complete the following steps.

  • Review the requirements for your chosen capabilities and target database.
  • Make sure that all required utility tools are installed (kubectl, OpenSSL External link opens a new window or tab, and the Java Runtime Environment (JRE) 17+).

    If you prepared your client machine for an online deployment, then kubectl is already installed. For more information, see Preparing a client to connect to the cluster.

    If the script detects that the JRE 17 or later is not installed, then you must install a compatible JRE.
    • If a valid Java version cannot be found, install JRE 17 or later. When you rerun the script, it validates that the detected Java version is at least JRE 17.
    • You can specify a custom Java installation directory by using --java-path flag:
      ./cp4a-prerequisites.sh -m validate --java-path=/custom-java-path -n cp4a-ns
    Tip: The script searches for a Java installation in the following order:
    1. A custom Java path set by the --java-path option.

      If the --java-path option sets /opt/java17, the script uses /opt/java17/bin/java. The script validates that the path exists and contains the needed Java files.

    2. The JAVA_HOME environment variable.

      If the --java-path option is not provided, the script checks the JAVA_HOME environment variable. If JAVA_HOME is set, for example JAVA_HOME=/usr/lib/jvm/java-17, the script uses $JAVA_HOME/bin/java. JAVA_HOME can be set by using the export command.

      export JAVA_HOME=/usr/lib/jvm/java-17
    3. The system PATH.

      If the script cannot find a custom Java path or the JAVA_HOME environment variable, the script searches for Java in all the directories that are listed in the PATH environment variable.

For more information about supported databases, see the Software Product Compatibility Reports External link opens a new window or tab.

Note: If the script detects missing tools, it reports the names and versions required. If you deployed operators in a separate namespace from the target CP4BA namespace, create secrets in the CP4BA deployment namespace (operands namespace).

Script usage

The script has the following command syntax:

Usage: cp4a-prerequisites.sh -m [modetype] -n [CP4BA_NAMESPACE]
Options:
  -h  Display help
  -m  The valid mode types are: [property], [generate], or [validate]
  -n  The target namespace of the CP4BA deployment.

Running the modes in the correct order

Follow these steps to prepare your databases and secrets:

  1. Run the script in the property mode.
  2. Edit the generated property files with your environment values.
  3. Run the script in the generate mode to generate the DB SQL scripts and secret YAML templates.
  4. Create the databases and secrets by running the SQL scripts and applying the YAML templates.
  5. Run the script in the validate mode to verify that the databases and secrets are ready.

Running the script on different clients

You can run the property and generate modes on different clients. If you use different clients, copy the following files to the other client:

cert-kubernetes/scripts/.tmp/.TEMPORARY.property
cert-kubernetes/cp4ba-prerequisites/project/$NAMESPACE
Note: Some properties use absolute paths. If you copy the script to a different computer, update the following properties in the property files:
  • <DB_PREFIX_NAME>.DATABASE_SSL_CERT_FILE_FOLDER in cp4ba_db_server.property
  • LDAP_SSL_CERT_FILE_FOLDER in cp4ba_LDAP_server.property
  • APP_ENGINE.SESSION_REDIS_SSL_CERT_FILE_FOLDER in cp4ba_user_profile.property

After you modified the property files, run the cp4a-prerequisites.sh -m generate command again to re-create the SSL secret templates with updated paths.