Loading the HCL Commerce+ database schema
Loading the HCL Commerce+ database schema is a important step in setting up the Commerce+ environment. This process involves creating the required database schema, loading bootstrap data, and configuring default users. A script (initdb_db2_sample.sh) is provided to automate these tasks.
Before you begin
Before proceeding, ensure the following:
- Installing and configuring an IBM Db2 database.
- You have created an administrative database user (by default, named
wcs). This user will be used by HCL Commerce+ to connect to the database. - Ensure that you have access to a running Utility server Docker container. This container is required to obtain the needed scripts.
About this task
The database schema is the foundation of the Commerce+environment. It includes
tables, views, stored procedures, and other database objects required for the application to
function. Additionally, the schema loading process creates two essential users:
- wcsadmin
- The site administrator account used to manage the Commerce+ environment.
- spiuser
- The internal user with the role "RemoteConfigurationReaders". This user is used for
inter-component server API invocation only. The
spiuseruser is configured in the Store server, Search server and Customization (xC) server, and is used in the API invocation from those servers to the Transaction server. This user cannot be disabled. In the event that this user is disabled, the necessary component servers cannot connect to the Transaction server.
Important:
- Sample Data
- Loading sample data (sampleData) is recommended for testing and validation. For production environments, use noSample and populate the database with your own data.
- Security
- Always use custom values for the merchantKey, wcsadminPassword, and spiuserPassword. Do not use default values provided in examples.
- SSL Configuration
- By default SSL is enabled on the database server, provide the SSL key file and password when running the script.
Procedure
-
Copy the initdb_db2_sample.sh script from the Utility server Docker container to the
machine running the IBM Db2 server.
Replace container_name with the name of your Utility server container.bash docker cp container_name:/opt/CommerceUtilities/bin/initdb_db2_sample.sh /path/to/destination/Ensure the script has execute permissions:bash chmod +x /path/to/destination/initdb_db2_sample.sh -
Execute the script with the required parameters to create the database schema and load
data. The command syntax is as follows:
Where:bash ./initdb_db2_sample.sh type dbName dbServer dbPort dbaUser dbaPassword dbUser dbPassword merchantKey wcsadminSalt wcsadminPassword spiuserSalt spiuserPassword withSample [sslKeyFile sslKeyPassword]Parameter Description type The type of environment. Valid values: staging(enables workspaces) orproduction.dbName The name of the database (e.g., mall).dbServer The hostname of the database server. dbPort The port number of the database server (default: 50000).dbaUser The database administrator username. dbaPassword The database administrator password. dbUser The database username (e.g., wcs).dbPassword The database user password. merchantKey A 32-character hexadecimal key used for encryption. Example: 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b.wcsadminSalt A random string used to encrypt the wcsadminPassword. wcsadminPassword The password for the wcsadminuser.spiuserSalt A random string used to encrypt the spiuserPassword. spiuserPassword The password for the spiuseruser.withSample Determines whether to load sample data. Valid values: sampleDataornoSample.sslKeyFile (Optional) Path to the SSL key file if SSL is enabled on the database server. sslKeyPassword (Optional) Password for the SSL key file. bash ./initdb_db2_sample.sh staging mall mydb.hcl.com 50000 db2inst1 myunguessablepassword wcs wcs1 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b 3h8x876vd8g3 wcs1admin 7j2lhm2vjpoc QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi sampleData /opt/java/openjdk/lib/security/cacerts changeit -
After running the script, encrypt the merchant key using the wcs_encrypt.sh script:
Where:bash ./wcs_encrypt.sh merchantKey KeyEncryptionKey- merchantKey
- The plain text merchant key used in the initdb_db2_sample.sh script.
- KeyEncryptionKey
- Is your custom 32-character hexadecimal key.
bash ./wcs_encrypt.sh 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b 3c3c3c3c3c3c3c3c4d4d4d4d4d4d4d4d -
For Kubernetes deployments, store the encrypted merchant key in your environment
configuration.
- In Vault: Store the value at the Tenant/EnvName/EnvType/merchantKeyEncrypted key path.
- In values.yaml: Uncomment and update the merchantKey field with the encrypted
value:
yaml merchantKey: ASCII_encrypted_string