Packaging and Unpacking Commerce Server Sites through PUP Package

Introduction

    Commerce server provides PUP.exe to automate the process of packing and un-packing a commerce site. Tool has its existence from the days of Site Server. Complete Meta data of a commerce site is managed by pup package. Using the pup package in GUI mode is straight forward and it's quite simple. Every commerce server engagement demands for an automated process to pack and un-pack a commerce server site in an unattended mode. I tried the same in one of my commerce server engagement and tried pup.exe to automate the above process. I faced many hurdles while automating the process and got good support from Commerce Server PSS team in overcoming the hurdles. I would like to share my learning's in this article.

Configuration files

    PUP package can be executed in un-attended / silent mode through a configuration file. Configuration file has complete information about the site to be unpacked. The configuration file doesn't play any role in the process of packing the site.PUP.exe packs the entire site content configured in commerce server manager. Profile resource is driven through an additional configuration file which has the information about the profile schema and profile SQL definition. Following are the list of configuration files expected by pup.exe to run in unattended mode.

File Name

Comment

Site Configuration file

Used only in the process of unpacking a site and instructs pup.exe with the information about the site resources to be unpacked. Configuration file should adhere to the format identified by the packaging tool and the same will be discussed later in the article.

BizData.ini – Profile specific configuration file

Used to provide information specific to the profiles (Global resource). Configuration file contains information's like profile schema definition, SQL schema definition, Site Terms definition xml etc. To achieve un-attended process we need to place this file in the commerce server installation directory (C:\Program Files\Microsoft Commerce Server 2007) and in the executing directory of pup.exe . Pup package tries to locate the profile information from this file and expects the file to be in the directories. If the file is not available, pup.exe pops up a UI to locate the same.

 

Site Configuration File

Site configuration file instructs the packager about the resources and applications needs to be unpacked. Following configuration file can be used to unpack the EmpySite in command line. The same file can be modified to unpack any commerce site through command line. Connection strings specified in the below configuration should be in the same format. PUP.exe expects the connection string only in that format.

 
 

[General]

SiteName=GameServiceSetup1

Description=Silent CSharpSite Install with Windows Authentication

NumOfResources= 7

NumOfApplications= 5

Resource0=Product Catalog

Resource1=Transactions

Resource2=Transaction Config

Resource3=Biz Data Service

Resource4=Site CS Authentication

Resource5=Marketing

Resource6=Inventory

Application0=CatalogWebService

Application1=CSharpSite

Application2=MarketingWebService

Application3=OrdersWebService

Application4=ProfilesWebService

NumOfConnStrs= 7

[ConnStrs]

ConnStrResourceName0=Product Catalog

ConnStrPropertyName0=connstr_db_Catalog

ConnStrFriendlyResourceName0=Product Catalog

ConnStrFriendlyPropertyName0=connstr_db_Catalog

ConnStrValue0=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_ProductCatalog;Data Source=localhost;

ConnStrResourceName1=Transactions

ConnStrPropertyName1=connstr_db_Transactions

ConnStrFriendlyResourceName1=Transactions

ConnStrFriendlyPropertyName1=connstr_db_Transactions

ConnStrValue1=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_Transactions;Data Source=localhost;

ConnStrResourceName2=Transaction Config

ConnStrPropertyName2=connstr_db_TransactionConfig

ConnStrFriendlyResourceName2=Transaction Config

ConnStrFriendlyPropertyName2=connstr_db_TransactionConfig

ConnStrValue2=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_Transactionconfig;Data Source=localhost;

ConnStrResourceName3=Biz Data Service

ConnStrPropertyName3=connstr_db_bds

ConnStrFriendlyResourceName3=Profiles

ConnStrFriendlyPropertyName3=connstr_db_bds

ConnStrValue3=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_Profiles;Data Source=localhost;

ConnStrResourceName4=Marketing

ConnStrPropertyName4=connstr_db_Marketing

ConnStrFriendlyResourceName4=Marketing

ConnStrFriendlyPropertyName4=connstr_db_Marketing

ConnStrValue4=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_Marketing;Data Source=localhost;

ConnStrResourceName5=Inventory

ConnStrPropertyName5=connstr_db_inventory

ConnStrFriendlyResourceName5=Inventory

ConnStrFriendlyPropertyName5=connstr_db_inventory

ConnStrValue5=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_ProductCatalog;Data Source=localhost;

ConnStrResourceName6=Marketing

ConnStrPropertyName6=connstr_db_Lists

ConnStrFriendlyResourceName6=Marketing

ConnStrFriendlyPropertyName6=connstr_db_Lists

ConnStrValue6=Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=CSharpSite_Marketing_Lists;Data Source=localhost;

[Product Catalog]

ResourceFlags=2

PupFlags=1

ProgidPUP=Commerce.CatalogPUP

ResourceType=Catalog

FriendlyName=Product Catalog

[Transactions]

ResourceFlags=2

PupFlags=1

ProgidPUP=Commerce.OrdersPup

ResourceType=Transactions

FriendlyName=Transactions

[Transaction Config]

ResourceFlags=2

PupFlags=1

ProgidPUP=Commerce.OrdersPup

ResourceType=TransactionConfig

FriendlyName=Transaction Config

[Biz Data Service]

ResourceFlags=7

PupFlags=1

ProgidPUP=Commerce.UPMPuP

ResourceType=BizDataStore

FriendlyName=Profiles

GlobalResourceName= (Add new global resource)

[Site CS Authentication]

ResourceFlags=3

PupFlags=1

ProgidPUP=Commerce.AuthPuP

ResourceType=AuthManager

FriendlyName=CS Authentication

GlobalResourceName= (Add new global resource)

[Inventory]

ResourceFlags=2

PupFlags=1

ProgidPUP=Commerce.CatalogPUP

ResourceType=Inventory

FriendlyName=Inventory

[Marketing]

ResourceFlags=2

PupFlags=1

ProgidPUP=Commerce.MarketingPup

ResourceType=Marketing

FriendlyName=Marketing

[CatalogWebService]

ResourceFlags=5130

PupFlags=1

ProgidPUP=Commerce.AddressPuP

ResourceType=Address

FriendlyName=Address

AccessFlags=513

AuthFlags=4

AppIsolated=0

AspCodePage=0

VRoot=CatalogWebService

CSAppName=CatalogWebService

Website=Default Web Site

Machine=localhost

[CSharpSite]

ResourceFlags=10

PupFlags=1

ProgidPUP=Commerce.AddressPuP

ResourceType=Address

FriendlyName=Address

AccessFlags=513

AuthFlags=7

AppIsolated=0

AspCodePage=0

VRoot=CSharpSite

CSAppName=CSharpSite

Website=Default Web Site

Machine=localhost

[MarketingWebService]

ResourceFlags=9226

PupFlags=1

ProgidPUP=Commerce.AddressPuP

ResourceType=Address

FriendlyName=Address

AccessFlags=513

AuthFlags=4

AppIsolated=0

AspCodePage=0

VRoot=MarketingWebService

CSAppName=MarketingWebService

Website=Default Web Site

Machine=localhost

[OrdersWebService]

ResourceFlags=3082

PupFlags=1

ProgidPUP=Commerce.AddressPuP

ResourceType=Address

FriendlyName=Address

AccessFlags=513

AuthFlags=4

AppIsolated=0

AspCodePage=0

VRoot=OrdersWebService

CSAppName=OrdersWebService

Website=Default Web Site

Machine=localhost

[ProfilesWebService]

ResourceFlags=17418

PupFlags=1

ProgidPUP=Commerce.AddressPuP

ResourceType=Address

FriendlyName=Address

AccessFlags=513

AuthFlags=4

AppIsolated=0

AspCodePage=0

VRoot=ProfilesWebService

CSAppName=ProfilesWebService

Website=Default Web Site

Machine=localhost

 
 

BizData.ini – Profile specific configuration file

This file needs to be placed in the commerce server installation directory and in the executing directory of pup.exe.

[BizDataSchema]

catalogSchema=catalogSchema.sql

expressionSchema=es_create.sql    

expressionSprocs=es_stored_procs.sql

profileDefs=ProfileSQL_Starter.xml

siteTermDefs=SiteTerms.xml

expressionDefs=ExpressionDefinition.xml

[BizDataStoreFlags]

IsSilentMode=True

[UPM_SQLSource.SQLSource]

IsBizDataStore=True

ProviderString=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=StarterSite_Profiles;Data Source=localhost;

schemaDefs=ProfileSQL_Starter.sql

dataDefs=

PUP Log File

Pup.exe creates a log file named pup.log in C drive and logs information to the file during the process of packing and unpacking a commerce site. The information in the file will be of great use for troubleshooting.

Packing a commerce site

Following command should be used to pack a commerce site in command prompt. Execute the below command in Commerce Server Command prompt.

PUP.exe /p /f:<valid siten ame>/i:Config.ini /s:<SiteName>

Config.ini is of no use in the process of packing a commerce site. Pup.exe packs the entire site content. If we are not using the /i: parameter, pup.exe will pop up the UI. To make the packing process silent, we need to use /i: option J

Unpacking a Commerce Site

Following command should be used to un-pack a commerce site in command prompt. Execute the below command in Commerce Server Tools Command prompt.

PUP.exe /u /f:<pup package path> /i:<Full path of the configuration file>/s:<New Site Name>

Sample Automation Tool

I have created a sample automation tool to automate the process of packing and unpacking commerce site. The Batch file takes parameters needed by pup.exe and calls the pup.exe with appropriate parameters. Following are the details about the tool. Automation tool has the configuration file in the Master Template folder with needed place holders. For every environment I have created a separated folder (Test, Staging etc) which contains the following files.

File Name

Comments

FindAndReplace.exe

.Net console app used to do replacement in the configuration file based on the parameters passed. Can be replaced with some dos commands J

InsallCommerce.bat

Unpacks a commerce site. Takes site name as a parameter. Other parameters like pup package file path are hard coded in the batch file. Can be parameterized based on the requirement. Bat file does the following tasks.

  1. Resets IIS
  2. Copies all the files to the executing folder from master template folder.
  3. Copies bizdata.ini to C:\Program Files\Microsoft Commerce Server 2007 folder.
  4. Replaces ~SiteName~ place holder with the appropriate site name.
  5. Executes pup.exe with appropriate parameter for unpacking a commerce site.

Currently the tool unpacks empty.pup and can be modified to unpack any valid commerce server sites.

PackCommerce.bat

Takes existing commerce server site name as parameter and packs the site through pup.exe

Using Automation Tool

  1. Download PUP Automation.zip .
  2. Extract the file content to a directory.
  3. Exaction process will create the following directories.
    1. Master Template &
    2. Test
  4. Use Commerce Server Tools prompt to execute installcommerce.bat with site name as parameter. (Batch file is located in the test directory).
  5. Above command will a new commerce site using empty.pup.

Packaging tool limitation

PUP.exe cannot be used to unpack a commerce server site in silent mode which has AD integration in profiles. The same is supported in GUI mode. It's a limitation in the tool.

Conclusion

PUP.exe is the not recommended way to deploy commerce sites in production environment. We need to use staging for the same. This can be used only to setup the initial site and further updates should be done through staging. To set-up the base commerce site pup package is the only option and can be automated with the command line options. Development stage of commerce server engagement demands for the above automation. The above process should be used only in the stage of development.

PUP Automation.zip