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
, 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-pathflag:./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:- A custom Java path set by the
--java-pathoption.If the
--java-pathoption sets/opt/java17, the script uses/opt/java17/bin/java. The script validates that the path exists and contains the needed Java files. - The
JAVA_HOMEenvironment variable.If the
--java-pathoption is not provided, the script checks theJAVA_HOMEenvironment variable. IfJAVA_HOMEis set, for exampleJAVA_HOME=/usr/lib/jvm/java-17, the script uses$JAVA_HOME/bin/java.JAVA_HOMEcan be set by using theexportcommand.export JAVA_HOME=/usr/lib/jvm/java-17 - The system
PATH.If the script cannot find a custom Java path or the
JAVA_HOMEenvironment variable, the script searches for Java in all the directories that are listed in thePATHenvironment variable.
For more information about supported databases, see the Software Product Compatibility Reports
.
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:
- Run the script in the property mode.
- Edit the generated property files with your environment values.
- Run the script in the generate mode to generate the DB SQL scripts and secret YAML templates.
- Create the databases and secrets by running the SQL scripts and applying the YAML templates.
- 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
<DB_PREFIX_NAME>.DATABASE_SSL_CERT_FILE_FOLDERin cp4ba_db_server.propertyLDAP_SSL_CERT_FILE_FOLDERin cp4ba_LDAP_server.propertyAPP_ENGINE.SESSION_REDIS_SSL_CERT_FILE_FOLDERin 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.