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
-
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
-
For the WebSphere Commerce EAR package, configure the server deployment settings.
-
In a file manager utility, go to the
wcbd-deploy-server-local-profit_margin_wc package directory.
-
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.
-
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
-
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.
-
Open the deploy-profit_margin_wc.private.properties file. Set the correct
user names and passwords.
-
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.
-
Customize the script for the deployment.
-
Create the following Ant build file:
WCBD_deploy_server_common_dir/profit_margin_wc-common.xml
-
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.
-
Save and close the file.
-
Update the wcbd-deploy.xml file to use the new
profit_margin_wc-common.xml file.
-
Go to the wcbd-deploy-server-local-profit_margin_wc directory within your
temporary directory.
-
Open the wcbd-deploy.xml file for editing
-
Locate the following line of code;
<import file="${basedir}/wcbd-deploy-common.xml" />
-
Change the value for the
file
attribute.
<import file="${basedir}/profit_margin_wc-common.xml" />
-
Locate the following line of code;
<!-- Create partial app zip for wsadmin deployment -->
<antcall target="build.partial.app" />
-
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.
-
Run the server deployment process.
-
Start the WebSphere Commerce server.
-
Open a command prompt and navigate to the following directory:
C:/wcbd-deploy-server-local-profit_margin_wc
-
Run the wcbd-ant command:
wcbd-ant.bat -buildfile wcbd-deploy.xml -Dtarget.env=profit_margin_wc
Wait until the deployment process completes successfully.
-
For the WebSphere Commerce search EAR package, configure the server deployment
settings.
-
In a file manager utility, go to the
wcbd-deploy-server-local-profit_margin_solr package directory.
-
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.
-
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
-
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.
-
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
-
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.
-
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" />
-
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">
-
Create the following Ant build file:
wcbd-deploy-server-local-profit_margin_wc/profit_margin_solr-common.xml
-
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.
-
Save and close the file.
-
Update the wcbd-deploy.xml file to use the new
profit_margin_solr-common.xml file.
-
Go to the wcbd-deploy-server-local-profit_margin_solr directory within
your temporary directory.
-
Open the wcbd-deploy.xml file for editing
-
Locate the following line of code;
<import file="${basedir}/wcbd-deploy-common.xml" />
-
Change the value for the
file
attribute.
<import file="${basedir}/profit_margin_solr-common.xml" />
-
Locate the following line of code:
<!-- Create partial app zip for wsadmin deployment -->
<antcall target="build.partial.app" />
-
Add the following code before the line of code that you found.
<!--CUSTOMIZATION TARGETS before deploy -->
<antcall target="wc_deploy_tasks" />
-
Locate the following line of code:
<!-- Clean working directory -->
<antcall target="clean.working.dir" />
-
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.
-
Run the server deployment process.
-
Start the WebSphere Commerce server.
-
Open a command prompt and navigate to the following directory:
C:/wcbd-deploy-server-local-profit_margin_solr
-
Run the wcbd-ant command:
wcbd-ant.bat -buildfile wcbd-deploy.xml -Dtarget.env=profit_margin_solr
Wait until the deployment process completes successfully.
-
Restart the WebSphere Commerce server and the WebSphere Commerce search server to
ensure customization changes.