Thursday, October 15, 2015

Resetting and Configuring development environment for Websphere Commerce

A clean development environment is one of the first thing a developer must have. If the workspace is having a lot of errors, warnings, unwanted files etc, it is pretty tough to code and troubleshoot. This post explores a way to set up a proper developement environment for Websphere Commerce.

1. Install WCS base product. 
You can find the instructions in the below link

Installing Websphere Commerce

2. Install the latest available fix pack. 
The fix pack contains the fixes for bugs in the product and it is really important that we keep the FP level updated. Also FPs will be a prerequisite for the feature packs. For example : to install FEP8, we need FP9.
Installing Websphere Commerce Fix Packs

3. Install the feature pack. 
A feature pack contains new features added to the product. This differs from fix packs as it doesn't contain fixes to the base commerce product. After installing we have to enable the features one by one. Foundation, management-center, store-enhancements, social-commerce, content-version, sterling-integration, location-services are the features available.
Installing Websphere Commerce Feature Packs

4. Reset the development environment to bootstrap data.
Once the installations are complete the workspace will have a lot of stores(like Madisons,consumer direct, Elite etc) published and will contain the assets(jsp, js, properties files etc) for all of them. Usually we would require only one store and hence all these assets are not used. Also the DB would be populated with a lot of data for all these stores which we are not interested in. The below steps needs to be carried out in order reset the environment.

Here an assumption is made that we switch from derby to DB2 database. Steps would be similar for Oracle as well.

4.1. Execute restoreDefault.bat
This utility will restore the development environment to bootstrap data.It will internally run setup.bat as well and will make sure that you have the default setup.
Make sure the test server is stopped and RAD is closed. Navigate to WC_InstlDir\bin and execute restoreDefault.bat force.

4.2. Execute setdbtype.bat
This is required only if you are changing the developer DB from derby to DB2 or Oracle. Changing dev DB does not carry over any schema customization or custom data to the new DB. Below is a sample of command to be executed for DB2
Example: C:\IBM\WCDE_ENT70\bin>setdbtype.bat db2 C:\IBM\SQLLIB mall db2admin passw0rd db2admin passw0rd createdb

4.3. Execute resetstores.bat
This utility resets the Stores web module in the workspace to its original configuratiojn. All published and pre-published store assets are deleted from the workspace. Navigate toWC_InstlDir\bin and execute resetstores.bat

4.4. Execute updatedb.bat
This updates the WCS database to the latest fix pack level that is installed in the system. Navigate to WC_InstlDir\bin and execute updatedb.bat
 Example :
C:\IBM\WCDE_ENT70\bin\updatedb.bat db2 database_name database_user_name database_user_password

4.5. Enable features
Even though you have installed a feature back, restoreDefault utility would have disabled all the features and hence we have to re-enable them. the below commands can be used for the same.
Navigate toWC_InstlDir\bin  
enableFeature.bat -DfeatureName=foundation
enableFeature.bat -DfeatureName=management-center
enableFeature.bat -DfeatureName=content-version
enableFeature.bat -DfeatureName=store-enhancements
enableFeature.bat -DfeatureName=location-services

OR
To enable all the features in one go run the below script
enableFeature.bat -DfeatureName=ALL
 
enabling features

5. Build and re-publish the application
Do a clean and build (build open lazlo project as well). Start the server and re-publish the application.

6. Publish the store you need. 
The below link has the step by step description on how to publish an extended site

7. Configure search
To configure search feature for our store, we need to perform the below steps. On a very high level this includes setting up the solr indexes, per-populating the data in to temp tables and populating Solr indexes.

7.1 Setting up search index
SetupSearchIndex utility configures the Solr cores by creating all core instances for the specified master catalog. Ensure the test server is stopped.
Navigate to WC_InstlDir\components\foundation\subcomponents\search\bin and execute setupSearchIndex.bat

Example ; setupSearchIndex.bat –masterCatalogId 10001 –solrhome C:\IBM\WCDE_ENT70\search\solr\home  

7.2. Pre-process search index data
di-preprocess utility extracts and flattens websphere commerce data and then outputs it to a set of temporary tables. The data in these temp tables are then used to populate Solr. Ensure that the server is stopped. Navigate to  WC_InstlDir\bin and execute di-preprocess.bat
Example : di-preprocess.bat C:\IBM\WCDE_ENT70\search\pre-processConfig\MC_10001\DB2 

7.3. Build the search index
 The build index utility fetches the data from temporary tables and populates the Solr indexes. It uses Data Import Handler (DIH) for this. We can either build partially through delta updates or can do a full build as well. Navigate to  WC_InstlDir\bin and execute di-buildindex.bat
Example : di-buildindex.bat –masterCatalogId 10001


Note : If you are not planning to switch the DB and go ahead with derby itself, execute restoreDefault, resetStores, resetdb, setdbtype, updatedb and enablfeatures utility in the order respectively.





 

Cross transactional cache invalidation across WCS and Search applications

Introduction Cache invalidation is one of the key and tedious part of software development. It is really important that we purge the inval...