Deploying the customization

In this lesson, you deploy your customization. You can package and deploy your profit margin tutorial related customization into your production environment with the WebSphere Commerce Build and Deployment tool.

Procedure

  1. Copy and extract the wcbd_wc/dist/server/wcbd-deploy-server-local-profit_margin_wc.zip and wcbd_solr/dist/server/wcbd-deploy-server-local-profit_margin_solr.zip packages to a temporary location in your target deployment environment, such as C:.
    If your target deployment environment is a IBM WebSphere Commerce Developer environment, use the packages that are in the wcbd_wc/dist/toolkit directory on the development environment where you created the package.
    The following directories are now available in the temporary directory where you extracted the packages:
    • wcbd-deploy-server-local-profit_margin_wc
    • wcbd-deploy-server-local-profit_margin_solr
  2. For the WebSphere Commerce EAR package, configure the server deployment settings.
    1. In a file manager utility, go to the wcbd-deploy-server-local-profit_margin_wc package directory.
    2. Create a copy of the following files.
      • wcbd-deploy.properties.template. Rename the copy to be deploy-profit_margin_wc.properties.
      • wcbd-deploy.private.properties.template. Rename the copy to be deploy-profit_margin_wc.private.properties.
      • wcbd-setenv.bat.template. Rename the copy to be setenv.bat.
    3. Open the setenv.bat file. Modify the ANT_HOME and WAS_HOME environmental properties to the correct values.
      
      ANT_HOME=C:\apache-ant-1.9.2
      WAS_HOME=C:\WebSphere\AppServer
      
    4. Open the deploy-profit_margin_wc.properties files. Set the following properties according to the configuration of your subordinate server.
      
      existing.web.module.list= Stores
      wc.home=WC_home (For example, C:/WebSphere/CommerceServer80)
      wc.instance.name=WC_instance_name (For example, demo)
      was.home=WAS_home (For example, C:/WebSphere/AppServer)
      was.profile.name=WAS_profile_name (For example, demo)
      was.host.list=Host name of the machine where deployment is to be performed
      was.port=WAS_SOAP_port (For example, 9065)
      was.jvm.max.memory=1024M
      db.type=db2
      db.name=DB_name (For example, mall)
      db.schema.name=DB_schema (For example, the database user name)
      jdbc.url=DB_JDBC_URL (For example, jdbc:db2://<hostname>.com:50000/mall)
      jdbc.driver=com.ibm.db2.jcc.DB2Driver
      jdbc.driver.path=DB_JDBC_Driver (For example, C:/WebSphere/DB2/java/db2jcc4.jar;C:/WebSphere/DB2/java/db2jcc_license_cu.jar)
      datasource.jndi.name=jdbc/WebSphere Commerce DB2 DataSource ${wc.instance.name}
      static.web.deploy=false
      run.wc.server.sync=false
      dataload.dataload.common.order=true
      dataload.dataload.common.ordered.list=the dataload task your are going to perform, For instance, All of the wc-dataload.xml files under folder 
                  wcbd-deploy-server-local-profit_margin_wc/source/dataload/dataload/common need to be added in this list 
                 (For example, dataload_price_list/wc-dataload.xml,dataload_cost_price/wc-dataload.xml)
      Note: : If necessary, see WC_installdir/instances/instance_name/properties/createInstance.properties and WAS_installdir/profiles/WAS_profile_name/properties/portdef.props to obtain the correct values for your configuration.
    5. Open the deploy-profit_margin_wc.private.properties file. Set the correct user names and passwords.
    6. Open the wc-dataload-env.xml file within the wcbd-deploy-server-local-profit_margin_wc/source/dataload/dataload/common directory. Set or change the environment settings to match the values for your deployment environment.
      For example, update the values for your database within the <_config:Database> element.
      <_config:Database type="db2" name="mall" user="wcs" password="xK36ck80s6GbQL+aVIOszg==" server="localhost" port="50000" schema="wcs" />
      Note: The password for the database user is encrypted in this file. To obtain an encrypted password, open a command-line utility and go to the WC_installdir/bin. Run the following command:

      wcs_encrypt.bat db_password

      For more information about updating the wc-dataload-env.xml file, see Configuring the data load environment settings.
  3. Customize the script for the deployment.
    1. Create the following Ant build file: WCBD_deploy_server_common_dir/profit_margin_wc-common.xml
    2. Populate the file with the content from the sample profit_margin_wc-common.xml file. This sample file is included within the profit_margin_deploy_wc.zip compressed file that you downloaded in the previouse lesson.
    3. Save and close the file.
  4. Update the wcbd-deploy.xml file to use the new profit_margin_wc-common.xml file.
    1. Go to the wcbd-deploy-server-local-profit_margin_wc directory within your temporary directory.
    2. Open the wcbd-deploy.xml file for editing
    3. Locate the following line of code;
      <import file="${basedir}/wcbd-deploy-common.xml" />
    4. Change the value for the file attribute.
      <import file="${basedir}/profit_margin_wc-common.xml" />
    5. Locate the following line of code;
      <!-- Create partial app zip for wsadmin deployment -->
      <antcall target="build.partial.app" />
    6. Add the following code before the line of code that you found.
      <!--CUSTOMIZATION TARGETS before deploy -->
      <antcall target="wc_deploy_tasks" />
    For reference, review the sample wcbd-deploy.xml file within the following compressed file. The contents of this file can resemble your deployment package before you run the deployment command.
  5. Run the server deployment process.
    1. Start the WebSphere Commerce server.
    2. Open a command prompt and navigate to the following directory: C:/wcbd-deploy-server-local-profit_margin_wc
    3. Run the wcbd-ant command:

      wcbd-ant.bat -buildfile wcbd-deploy.xml -Dtarget.env=profit_margin_wc

      Wait until the deployment process completes successfully.

  6. For the WebSphere Commerce search EAR package, configure the server deployment settings.
    1. In a file manager utility, go to the wcbd-deploy-server-local-profit_margin_solr package directory.
    2. Create a copy of the following files.
      • wcbd-deploy.properties.template. Rename the copy to be deploy-profit_margin_solr.properties.
      • wcbd-deploy.private.properties.template. Rename the copy to be deploy-profit_margin_solr.private.properties.
      • wcbd-setenv.bat.template. Rename the copy to be setenv.bat.
    3. Open the setenv.bat file. Modify the ANT_HOME and WAS_HOME environmental properties to the correct values.
      
      ANT_HOME=C:\apache-ant-1.9.2
      WAS_HOME=C:\WebSphere\AppServer
      
    4. Open the deploy-profit_margin_solr.properties files. Set the following properties according to the configuration of your subordinate server.
      existing.web.module.list=Search-Rest
      wc.home=WC_home (For example, C:/WebSphere/CommerceServer80)
      wc.instance.name=WC_instance_name (For example, demo)
      was.home=WAS_home (For example, C:/WebSphere/AppServer)
      was.profile.name=WAS_profile_name (For example, demo_solr)
      was.host.list=Host name of the machine where deployment is to be performed
      was.port=WAS_SOAP_port (For example, 8880)
      was.jvm.max.memory=1024M
      db.type=db2
      db.name=DB_name (For example, mall)
      db.schema.name=DB_schema (For example, the database user name)
      jdbc.url=DB_JDBC_URL (For example, jdbc:db2://<hostname>.com:50000/mall)
      jdbc.driver=com.ibm.db2.jcc.DB2Driver
      jdbc.driver.path=DB_JDBC_Driver (For example, C:/WebSphere/DB2/java/db2jcc4.jar;C:/WebSphere/DB2/java/db2jcc_license_cu.jar)
      datasource.jndi.name=jdbc/WebSphere Commerce DB2 DataSource ${wc.instance.name}
      static.web.deploy=false
      run.wc.server.sync=false
      Note: : If necessary, see WC_installdir/instances/instance_name/properties/createInstance.properties and WAS_installdir/profiles/WAS_profile_name/properties/portdef.props to obtain the correct values for your configuration.
    5. Append the following properties to the end of the file that is used for customization. These properties are used for deploying the WebSphere Commerce search customization.
      Note: Verify that these values are correct for your environment. The values for the following properties are examples. Replace the values with the appropriate value for your environment.
      • master.catalog
      • solr.locale
      • solr.instance
      • solr.server.port
      • plugin.home
      • solr.http.port
      • solr.https.port
      • db.vendor
      • solrGlobalSecurityEnabled
      
      solr.home=${wc.home}/instances/${wc.instance.name}/search/solr/home
      solr.preprocess.dir=${wc.home}/instances/${wc.instance.name}/search/pre-processConfig
      master.catalog=3074457345616676668
      solr.locale=en_US
      solr.profile=${wc.instance.name}_solr
      solr.instance= solrServer
      solr.server.port=3737
      plugin.home=C:/WebSphere/Plugins
      solr.http.port=9080
      solr.https.port=9043
      db.vendor=DB2
      solrGlobalSecurityEnabled=true
      
    6. Open the deploy-profit_margin_solr.private.properties file. Set the correct user names and passwords.

      If global security is enabled on the search server, add solr.user and solr.password to the bottom of the deploy-app.private.properties file.

    7. Open the wc-dataload-env.xml environment configuration within the wcbd-deploy-server-local-profit_margin_solr/source/dataload/dataload/common directory. Update the values for the environment and database connection configuration to match the values for your target environment.
      For example, the following code snippet shows an example database connection configuration within the <_config:Database> element of the file:
      
      <_config:Database type="db2" name="mall" user="wcs" password="xK36ck80s6GbQL+aVIOszg==" server="localhost" port="50000" schema="wcs" />
  7. Customize the script for the WebSphere Commerce deployment.
    Note: The Build and Deployment tool does not support workspace deployment or the deployment of customized search files by default. You can use an Ant script to replace existing files with the configuration files that you included from outside your workspace_dir into your deployment package.
    These customized files are handled in the profit_margin_solr-common.xml file with the following target
    <target name="Replace_Indexing_Configuration">
    1. Create the following Ant build file: wcbd-deploy-server-local-profit_margin_wc/profit_margin_solr-common.xml
    2. Populate the file with the content from the sample profit_margin_solr-common.xml file. This sample file is included within the profit_margin_deploy_solr.zip compressed file that you downloaded in the previouse lesson.
    3. Save and close the file.
  8. Update the wcbd-deploy.xml file to use the new profit_margin_solr-common.xml file.
    1. Go to the wcbd-deploy-server-local-profit_margin_solr directory within your temporary directory.
    2. Open the wcbd-deploy.xml file for editing
    3. Locate the following line of code;
      <import file="${basedir}/wcbd-deploy-common.xml" />
    4. Change the value for the file attribute.
      <import file="${basedir}/profit_margin_solr-common.xml" />
    5. Locate the following line of code:
      <!-- Create partial app zip for wsadmin deployment -->
      <antcall target="build.partial.app" />
    6. Add the following code before the line of code that you found.
      <!--CUSTOMIZATION TARGETS before deploy -->
      <antcall target="wc_deploy_tasks" />
    7. Locate the following line of code:
      <!-- Clean working directory -->
      <antcall target="clean.working.dir" />
    8. Add the following code before the line of code that you found.
      <!--CUSTOMIZATION TARGETS after deploy-->
      <antcall target="after_deploy_tasks" />
      For reference, review the sample wcbd-deploy.xml file within the following compressed file. The contents of this file can resemble your deployment package before you run the deployment command.
  9. Run the server deployment process.
    1. Start the WebSphere Commerce server.
    2. Open a command prompt and navigate to the following directory: C:/wcbd-deploy-server-local-profit_margin_solr
    3. Run the wcbd-ant command:

      wcbd-ant.bat -buildfile wcbd-deploy.xml -Dtarget.env=profit_margin_solr

      Wait until the deployment process completes successfully.

  10. Restart the WebSphere Commerce server and the WebSphere Commerce search server to ensure customization changes.