Using a preconfigured PostgreSQL Docker image

You can use a preconfigured PostgreSQL Docker image to streamline the setup process and ensure consistency across environments. This approach simplifies database provisioning for both development and testing.

Important:

This PostgreSQL Docker container is intended for test environments only and should not be used for staging or production deployments.

The preconfigured PostgreSQL Docker image for HCL Commerce+ simplifies setting up a database. This environment is useful for development and testing purposes because it can be deployed and reset easily. While it works well for testing, for real production use, set up a more robust manually installed PostgreSQL system that can handle lots of users and keep data safe and always available. For production systems, see Installing and configuring PostgreSQL database.

Before you begin

Before setting up the PostgreSQL container, ensure the following requirements are met:

  1. Obtain the latest HCL Commerce+ Docker images, including the PostgreSQL image.
  2. Extract the PostgreSQL Docker Image and ensure that Docker is installed and running..

Procedure

  1. Load the PostgreSQL image into Docker using the following command:
    docker load -i PostgreSQL_Docker_Image 
    
  2. Update the values.yaml file.
    1. In the values.yaml file, make the following changes:
      • Set tsPostgres.enabled to true (default value is true, ts postgres sample db will be deployed along with Commerce containers).
      • Update:tsPostgres.repository, tsPostgres.image, tsPostgres.tag

    2. Configuration in the sample ts postgres Docker image.

      Update these values either in vault or in the values.yaml file:

      dbName: mall
      dbPort: 5432
      dbaUser: postgres
      dbaUserPassword: passw0rd
      dbUser: wcs
      dbUserPassword: wcs1
      wcsadminUser: wcsadmin
      wcsadminUserPassword: wcs1admin
      
  3. Verify the PostgreSQL Instance after deployment
    1. Ensure that the ts postgrespod is up and running.
    2. Use psql, pgAdmin, or any PostgreSQL-compatible client to connect to the running database.
    3. Log in to the PostgreSQL container and check the database status:
      docker exec -it <container_name> /bin/bash 
      psql -U <username> -d <database_name> 
      
      Run a sample query to confirm PostgreSQL is operational:
      SELECT version(); 
      

What to do next

Performance optimization

Improve PostgreSQL performance by tuning key parameters in the postgresql.conf configuration file.

  • shared_buffers: Adjust memory allocation.
  • work_mem: Optimize query performance.
  • maintenance_work_mem: Enhance database maintenance efficiency.
Security best practices

By default, Postgres is SSL enabled. You can verify this by running the query SHOW ssl;. If it returns an on state, SSL is enabled.