Preparing a PostgreSQL database

Prepare your PostgreSQL Database for use with Commerce+ by creating a table space and user.

Before you begin

  • Ensure that you have a PostgreSQL Database server ready for use.
  • Create a database user (dbuser). By default, Commerce+ uses the specific username wcs to connect to the database.
  • Ensure that you have access to a running Utility server Docker container.

Procedure

  1. Log in to the PostgreSQL Database server.
  2. Copy the postgressetup folder from the Utility container to the your host system.
    • Copy setup scripts from the Utility container to a temporary location on your host system.
      docker cp utility_container_name:/opt/CommerceUtilities/postgressetup /postgressetup
    • Copy setup scripts from your host system to the database server.
      docker cp postgressetup postgresDB_container_name:/tmp/
  3. Locate the folder where executable scripts are kept (eg., /tmp/postgressetup) and execute the following commands to make the setup_database_transaction.sh script executable.
    chmod a+x setup_database_transaction.sh 
    chmod a+w . 
  4. Switch to the postgres user and issue the following commands.
    su - postgres 
    cd /tmp/postgressetup
  5. Run the script to create the database.
    setup_database_transaction.sh [options]
    Options:
      -h | --help
      --dbName <name>             Database name (default: mall)
      --user <name>               Database user name (default: wcs)
      --password <password>       Database user password (default: wcs1)
      --schema <name>             Schema name (defaults to user name)
      --createdb <true|false>     Create target database
      --createUser <true|false>   Create target user
      --postgresConfigFile <path> PostgreSQL config file path
      --psqlOptions <options>     psql conninfo/options string
      --outputPath <path>         Output path for logs and temp SQL files
      --loadSample <true|false>   Load sample data
    ```
    
    
    For Example:
    ./setupPostgres/setup_database_transaction.sh --dbName mall --user wcs --password wcs1