Customizing the server deployment process
Advanced users can customize the server deployment process by using the Apache Ant scripting language. This task guides you through creating your customization files for use with the WebSphere Commerce Build and Deployment tool.
About this task
WCBD_deploy_server_dir/wcbd-deploy-common.xml provides helper Ant targets that are reusable and serves as examples for customization. For more information, refer to the comments within the file.
Procedure
- Set up the static
web assets deployment Ant script. If the file transfer protocol
used in your customization project is not a protocol that has sample scripts provided,
you must develop custom scripts. The following steps develop custom
scripts, where protocol refers to an identifier
that represents the file transfer protocol that you intend to use.
- Copy WCBD_deploy_server_dir/static-web-deploy/wcbd-static-web-deploy.private.properties.template as WCBD_deploy_server_dir/static-web-deploy-protocol.private.properties.
- Copy WCBD_deploy_server_dir/static-web-deploy/wcbd-static-web-deploy.properties.template as WCBD_deploy_server_dir/static-web-deploy-protocol.properties.
- Copy WCBD_deploy_server_dir/static-web-deploy/wcbd-static-web-deploy.xml.template as WCBD_deploy_server_dir/static-web-deploy-protocol.xml.
- Change the file permission
with the following commands:
chmod 755 WCBD_deploy_server_dir/static-web-deploy-protocol.*
- Open WCBD_deploy_server_dir/static-web-deploy-protocol.xml with
a text editor and replace the name attribute of the root project element
from
wcbd-static-web-deploy
tostatic-web-deploy-
protocol. Then, write the custom logic to transfer the static web server asset to the web server with the protocol you require. Refer to comments in the file for details. - Open WCBD_deploy_server_dir/static-web-deploy-protocol.private.properties with a text editor and add any security-sensitive properties (for instance, user names and passwords) that might be needed by WCBD_deploy_server_dir/static-web-deploy-protocol.xml. Properties in this file are encoded when the deployment process is executed.
- Open WCBD_deploy_server_dir/static-web-deploy-protocol.properties with a text editor and add any properties that might be needed by WCBD_deploy_server_dir/static-web-deploy-protocol.xml.
- Likewise, for setting up the WebSphere
Commerce configuration file synchronization Ant script:
- Copy WCBD_deploy_server_dir/wc-server-sync/wcbd-wc-server-sync.private.properties.template as WCBD_deploy_server_dir/wc-server-sync-protocol.private.properties.
- Copy WCBD_deploy_server_dir/wc-server-sync/wcbd-wc-server-sync.properties.template as WCBD_deploy_server_dir/wc-server-sync-protocol.properties.
- Copy WCBD_deploy_server_dir/wc-server-sync/wcbd-wc-server-sync.xml.template as WCBD_deploy_server_dir/wc-server-sync-protocol.xml.
- Change the file permission
with the following commands:
chmod 755 WCBD_deploy_server_dir/wc-server-sync-protocol.*
- Open WCBD_deploy_server_dir/wc-server-sync-protocol.xml with
a text editor and replace the name attribute of the root project element
from
wcbd-wc-server-sync
towc-server-sync-
protocol. Then, write the custom logic to transfer the configuration file to the WebSphere Commerce server with the protocol you require. Refer to comments in the file for details. - Open WCBD_deploy_server_dir/wc-server-sync-protocol.private.properties with a text editor and add any security-sensitive properties (for instance, user names and passwords) that might be needed by WCBD_deploy_server_dir/wc-server-sync-protocol.xml. Properties in this file are encoded when the deployment process is executed.
- Open WCBD_deploy_server_dir/wc-server-sync-protocol.properties with a text editor and add any properties that might be needed by WCBD_deploy_server_dir/wc-server-sync-protocol.xml.
- Likewise, for setting up the data load
utility customization deployment Ant script:
- Copy WCBD_deploy_server_dir/dataload-cust-deploy/wcbd-dataload-cust-deploy.private.properties.template as WCBD_deploy_server_dir/dataload-cust-deploy-protocol.private.properties.
- Copy WCBD_deploy_server_dir/dataload-cust-deploy/wcbd-dataload-cust-deploy.properties.template as WCBD_deploy_server_dir/dataload-cust-deploy-protocol.properties.
- Copy WCBD_deploy_server_dir/dataload-cust-deploy/wcbd-dataload-cust-deploy.xml.template as WCBD_deploy_server_dir/dataload-cust-deploy-protocol.xml.
- Change the file permission
with the following commands:
chmod 755 WCBD_deploy_server_dir/dataload-cust-deploy-protocol.*
- Open WCBD_deploy_server_dir/dataload-cust-deploy-protocol.xml with
a text editor and replace the name attribute of the root project element
from
wcbd-dataload-cust-deploy
todataload-cust-deploy-
protocol. Then, write the custom logic to transfer the configuration file to the WebSphere Commerce server with the protocol you require. Refer to comments in the file for details. - Open WCBD_deploy_server_dir/dataload-cust-deploy-protocol.private.properties with a text editor and add any security-sensitive properties (for instance, user names and passwords) that might be needed by WCBD_deploy_server_dir/dataload-cust-deploy-protocol.xml. Properties in this file are encoded when the deployment process is executed.
- Open WCBD_deploy_server_dir/dataload-cust-deploy-protocol.properties with a text editor and add any properties that might be needed by WCBD_deploy_server_dir/dataload-cust-deploy-protocol.xml.
- If new functionality is needed in the
wsadmin
deployment process:- Create a helper
wsadmin
Jython script WCBD_deploy_server_dir/project-wsadmin-common.py and add the new methods to the file. - If a modified version of existing helper methods (and
any method that might depend on it) is needed, copy the target from WCBD_deploy_server_dir/wcbd-wsadmin-common.py to
the new helper
wsadmin
Jython script, then modify the methods.
- Create a helper
- To include the new or modified functionality in the
wsadmin
deployment process:- Copy WCBD_deploy_server_dir/scripts/wcbd-wsadmin.py as WCBD_deploy_server_dir/scripts/project-wsadmin.py.
- Modify the logic in WCBD_deploy_server_dir/scripts/project-wsadmin.py to
incorporate the new changes. Ensure that WCBD_deploy_server_dir/scripts/project-wsadmin-common.py is
imported by using the
execfile
method. Refer to comments in the file for details.
- If new functionality is needed in the Ant build:
- Create a helper Ant build file that is called WCBD_deploy_server_dir/project-deploy-common.xml.
- Open the file with a text editor and add the following
line after the root project element open tag:
<import file="${basedir}/wcbd-deploy-common.xml" />
- Add new targets to the file as needed. Existing helper target and any target that might depend on it can be overridden with the specification of the Ant importtask.
- If new security-sensitive properties (for instance, user
names and passwords) are needed for the new changes:
- Copy WCBD_deploy_server_dir/wcbd-deploy.private.properties.template as WCBD_deploy_server_dir/project-deploy.private.properties.template.
- Add the new properties to the end of the file. Refer to comments in the file for details.
This file becomes the new properties template file for configuration. - If new properties are needed for the new changes, complete
the following step.
- Copy WCBD_deploy_server_dir/wcbd-deploy.properties.template as WCBD_deploy_server_dir/project-deploy.properties.template.
- If the new
wsadmin
script WCBD_deploy_server_dir/scripts/project-wsadmin.py is created, update thewsadmin.deploy.script.file
property to point to the new file. - Add the new properties to the end of the file. Refer to comments in the file for details.
This file becomes the new properties template file for configuration. - If new libraries are needed by Ant for the new changes,
copy the template files.
- Copy WCBD_deploy_server_dir/wcbd-setenv*.template as WCBD_deploy_server_dir/project-setenv*.template.
- Update the
CLASSPATH
variable in WCBD_deploy_server_dir/project-setenv*.template.
These files become the new setenv template files for configuration. - To include the new or modified functionality in the overall
server deployment process:
- Copy WCBD_deploy_server_dir/wcbd-deploy.xml as WCBD_deploy_server_dir/project-deploy.xml.
- If the new helper Ant build file WCBD_deploy_server_dir/project-deploy-common.xml is
created, change the following line in WCBD_deploy_server_dir/project-deploy.xml:
to:<import file="${basedir}/wcbd-deploy-common.xml" />
<import file="${basedir}/project-deploy-common.xml" />
- Modify the logic of the server deployment process to incorporate the new changes. Refer to comments in the file for details.
Customizing the files for Configuring the server deployment settings and Running the server deployment process is performed in the same manner as for default assets, except that the project-* files are used instead of the wcbd-* files.
- Optional: If your custom
build process performs any database operations through Ant tasks,
use the WCSQL task to acquire the database connections for the Ant
task operations.By using the WCSQL task, you can use a unified method for acquiring the database connections for utilities and Ant tasks operations. The WCSQL task is defined within the wcbd-deploy-common.xml. To use the tasks, reference the task as you would the SQL or SQLExec task. For example, the following code references the WCSQL task:
<code> <!-- The following invocation prints the contents of the SITE table --> <wcsql driver="${jdbc.driver}" url="${jdbc.url}" userid="${db.user.name}" password="${db.user.password}" print="true" classpath="${jdbc.driver.path}"> SELECT * FROM SITE; </wcsql> </code>
For more information about the unified method for acquiring database connections for utilities and Ant tasks, see Database connection acquisition for utilities and Ant tasks.
What to do next
After you complete the customization, you must copy the new files to the WCBD_installdir/deploy/server directory on the build system. If applicable, check the files into your SCM to ensure that your changes are available in a subsequent build.