Packaging the customization

In this lesson, you package your customization to prepare it for deployment. You can package and deploy your profit margin-related customization files into your production environment with the HCL Commerce Build and Deployment tool.

About this task

The HCL Commerce Build and Deployment tool is designed to address the error-prone and time-consuming nature of customized asset deployment. The tool provides a starting point for you to automate your build and deployment processes in a standardized, controlled manner. For more information, see Packaging customized code for deployment.

Important: The package and deployment process replaces files on the deployment target server. Ensure that no previous customization will be removed or replaced by the customization changes that you made in this tutorial.

Procedure

Prepare the source package for both the HCL Commerce EAR customization and HCL Commerce search EAR customization.
  1. HCL Commerce EAR package:
    1. Create the source code repository to include the Data Load utility files and code packages for your updated product recommendation widget customization code.
      1. Copy the WCDE_installdir\wcbd folder to a temporary location, such as under C:\.
      2. Rename the directory to be wcbd-deploy-server-local-profit_margin_wc.

        This directory is referred to as the wcbd_wc directory in this task.

      3. Create the following directory structure: wcbd_wc/source/workspace.
    2. Add the Data Load utility files, which load customized data on the server side, into your source code repository for the HCL Commerce Build and Deployment tool.
      1. Create the file structure wcbd_wc/source/workspace/dataload/dataload/common for your Data Load utility files.
      2. Add the Data Load utility files for your custom widget into your source code repository for the Build and Deployment tool. The new directory resembles the following structure in the wcbd_wc/source/workspace/dataload/dataload/common directory:
        • dataload_cost_price directory
        • dataload_price_list directory
        • wc-dataload-env.xml file
        The dataload_cost_price and dataload_price_list must include the price list and cost price data that you previously loaded. For more information about creating the wc-dataload-env.xml file, see Configuring the data load environment settings. The environment settings in this file must match the environment settings for your target environment where you are deploying your customization.
    3. Copy all of the customization folders and files to the wcbd_wc/source/workspace directory.
      1. Create the directory structure: wcbd_wc/source/workspace/Stores
      2. Copy the following files from the workspace_dir/Stores directory to the wcbd_wc/source/workspace/Stores directory.
        • WebContent/widgetdir/com.ibm.commerce.store.widgets.CatalogEntryRecommendation/CatalogEntryRecommendation_Data.jspf
        • WebContent/widgetdir/Common/PriceDisplay/PriceDisplay_Data.jspf
        • WebContent/widgetdir/Common/PriceDisplay/PriceDisplay_UI.jspf
        The new directory resembles the following structure in the wcbd_wc/source/workspace directory:
        • dataload directory
        • Stores directory
    The contents of your packaged wcbd_wc assets can resemble the contents of the following sample file.
  2. Refer to the following sample extract properties and build properties in the sample package compressed file:
    • build-local-search.properties
    • extract-local-search.properties
  3. Copy all customized search project to wcbd_wc\search\workspace
    Note: You need to copy all the files under search-config-ext and search-logic-ext into this folder. All the files under these two projects are included.
  4. Copy your customized HCL Commerce project into wcbd_wc\ts\workspace

    Copy your customized preprocess configurations under WC\xml\search\dataImport\v3\db2. In example 1, copy wc-dataimport-preprocess-custom.xml and wc-dataimport-preprocess-x-finalbuild.xml into W:\Build_Local_Repository\ts\workspace\ WC\xml\search\dataImport\v3\db2 Copy all the files under WebSphereCommerceServerExtensionsLogic project to include all your customizations.

  5. Package your Search customization code:
    run wcbd_wc\wcbd>wcbd-ant.bat -buildfile wcbd-build.xml -Dbuild.label=test -Dbuild.type=local -Dapp.type=search
  6. Package your Transaction Server customization code:
    run wcbd_wc\wcbd>wcbd-ant.bat -buildfile wcbd-build.xml -Dbuild.label=test -Dbuild.type=local -Dapp.type=ts

Results

The packages are created under the wcbd_wc\wcbd\dist directory as follows:
  • wcbd-deploy-server-local-search-search.zip
  • wcbd-deploy-server-local-ts.zip

The Search customization code in the examples is built into the package search-logic-ext.jar search-config-ext.jar

The Transaction Server customization code in the examples is built as:
  • xml
  • ejb
  • WebSphereCommerceServerExtensionsLogic.jar

What to do next

Using your own CI/CD pipeline to build your customization package into docker image and deploy to your runtime environment.

Verify your customization code in your docker environment.
  1. Enter the Search container:
    1. Run docker ps to verify that your containers are running.
    2. Locate your Search container name in the NAMES column.
    3. Start a bash shell by running the command docker exec -it search_container_name bash.
    Your customization appears in the /opt/WebSphere/Liberty/usr/servers/default/apps/search-ear.ear directory.
  2. Enter the TS (Transaction) container. Your customization appears in the /opt/WebSphere/AppServer/profiles/default/installedApps/localhost/ts.ear directory.