Configuring FTP or file system copy for extracting managed assets

This task describes the method by which FTP or the file system copy function can be configured to extract managed web assets from the WebSphere Commerce database to a file system. After you complete this task, static content is extracted and moved by using the specific file transfer method, and is no longer deployed to the WebSphere Commerce EAR.It is recommended that site administrators configure one of the following methods to maintain WebSphere Commerce performance in a production environment. For more information, see Managed asset deployment.

Procedure

  1. Determine whether an implementation is specified for the interface. Run the following SQL query:
    select * from cmdreg where interfaceName='com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentCmd'
  2. Complete one of the following actions:
    • If an implementation is specified, choose one of the file transfer methods and run the command:
      FTP
      update cmdreg set className='com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentUsingFTPCmdImpl' 
      where interfaceName='com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentCmd';
      FileSystemCopy
       update cmdreg set className='com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentUsingFileSystemCmdImpl' 
      where interfaceName='com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentCmd';
    • If an implementation is not specified, choose one of the file transfer methods and run the command:
      FTP
      insert into cmdreg (storeent_id,interfacename,description,classname) 
      values 
      (0, 'com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentCmd', 'FTP implementation for UpdateStaticEARContentCmd', 'com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentUsingFTPCmdImpl');
      FileSystemCopy
       insert into cmdreg (storeent_id,interfacename,description,classname) 
      values 
      (0, 'com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentCmd', 'FileSystemCopy implementation for UpdateStaticEARContentCmd', 'com.ibm.commerce.wc.appmanagement.commands.UpdateStaticEARContentUsingFileSystemCmdImpl');
    Note: The storeend_id value must be set to 0 because the command is only applicable as a site administrator task.
  3. Configure the file transfer function selected:
    • For FTP:
      The FTP service must be configured on the web server node.
      Note: If you are using the FTP method, FTP server software that is not fully compliant with the FTP standard (RFC 959) might not work correctly.
      1. Locate the file: WC_eardir/xml/config/FTP.xml.
      2. Create a backup of the file in a temporary location on your system.
      3. Edit the WC_eardir/xml/config/FTP.xml file and provide values for the following attributes. If you plan to use Quick Publish, then you need set values for the <FTPServer> and <ProdFTPServer> attributes. Otherwise, you need to only specify a value for the <FTPServer> attribute.
        proceedOnlyWhenAllServersAreWorking
        Set this value to false. This attribute is only applicable to the root element of FTP servers.
        FTPHost
        The fully qualified host name of the remote web server system. The application server must be able to access this host name. Ensure that any configured firewalls allow FTP communication between the web server and application server.
        FTPPort
        The port of the FTP server. If the port is not specified, a default port of 21 is used.
        FTPUser
        A user to connect to the FTP server. Ensure that the logon directory for this user has the same value as the FTPTargetDir attribute.
        FTPPassword
        The encrypted password of the FTP user. Encrypt the password with the wcs_encrypt utility, without specifying the merchant key.
        FTPTargetDir
        The directory on the web server system that represents the wcsstore alias. This is the directory in which static content is placed.
        For instance, on an IBM HTTP Server, the directory name is determined by completing these steps on the web server system:
        1. Open the httpd.conf file that is found in the following directory:
          • WC_installdir/instances/instance_name/httpconf/
          • For IBM i OS operating systemWC_userdir/instances/instance_name/httpconf/
        2. In the httpd.conf file, and search for a line similar to:
          Alias /wcsstore "temp/filehold/Stores.war"
        3. Record the full directory. In this example, the directory is temp/filehold/Stores.war. Enter this directory for the FTPTargetDir attribute.
        4. Ensure the value for the FTPTargetDir attribute is the same as the FTPUser logon directory.
        An example of the FTP.xml file:
        <FTPServers xmlns="http://www.ibm.com/xmlns/prod/WebSphereCommerce"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce xsd/FTP.xsd"
             proceedOnlyWhenAllServersAreWorking="false">
        
             <FTPServer FTPHost=""
                  FTPPort=""
                  FTPUser=""
                  FTPPassword=""
                  FTPTargetDir=""
             />
             <ProdFTPServer FTPHost=""
                  FTPPort=""
                  FTPUser=""
                  FTPPassword=""
                  FTPTargetDir=""
             />
        </FTPServers>
         
        Note: If you are on WebSphere Commerce Version 8.0.0 Fix Pack 5 or earlier, you might not see the <ProdFTPServer> block. Add the attribute if needed.
      4. Save the changes to the WC_eardir/xml/config/FTP.xml file.
      5. Update the master configuration file so that changes are not lost with the next deployment.
    • For file system copy:
      Note: If you are using the Windows mapped drive feature with Windows hosting both local and remote systems, ensure that security configurations allow for activities such as accessing remote folders and locally mapped drives for the following accounts:
      • Local service
      • Network service
      • System service
      The mentioned built-in accounts are commonly used when running a process as a Windows service.
      1. Locate the file: WC_eardir/xml/config/FileSystem.xml.
      2. Create a backup of the file in a temporary location on your system.
      3. Edit the WC_eardir/xml/config/FileSystem.xml file and provide values for the following attributes:
        proceedOnlyWhenAllServersAreWorking
        Set this value to false. This attribute is only applicable to the root element of FTP servers.
        FSLocation (and ProdFSLocation)
        A local directory on the WebSphere Commerce system that is mapped or mounted to a remote directory on the web server system.
        If you plan to use Quick Publish, then you need to also set a value for the ProdFSLocation attribute. Otherwise, you need to only specify a value for the FSLocation attribute.
        To determine the local directory:
        1. On the web server system, open:
          • WC_installdir/instances/instance_name/httpconf/httpd.conf
          • For IBM i OS operating systemWC_userdir/instances/instance_name/httpconf/httpd.conf
        2. Within the httpd.conf file, search for a line similar to the following line:
          Alias /wcsstore "temp/filehold/Stores.war"
          Record this directory but remove Stores.war. In this example, directory for the FSLocation and ProdFSLocation attributes is temp/filehold.
        3. On the WebSphere Commerce system, map or mount the directory from step 3.c.ii to a local drive or directory. Use this local drive or directory as the value for FSLocation and ProdFSLocation.
          An example of the FileSystem.xml file:
          <FSLocations xmlns="http://www.ibm.com/xmlns/prod/WebSphereCommerce"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce xsd/FileSystem.xsd"
                   proceedOnlyWhenAllServersAreWorking="false">
                 
                   <FSLocation dir="/temp/filehold"/> 
                   <ProdFSLocation dir="/temp/filehold"/>
             
           </FSLocations>
           
        Note: If you are on WebSphere Commerce Version 8.0.0 Fix Pack 5 or earlier, you might not see the <ProdFSLocation> attribute. Add the attribute if needed.
      4. Save the changes to the WC_eardir/xml/config/FileSystem.xml file.
      5. Update the master configuration file so that changes are not lost with the next deployment.
  4. To specify what files are flagged as static content, review and update the UpdateEARFilter.properties file. Complete the following steps:
    1. Open the following file and review the contents:
      • WC_eardir/properties/com/ibm/commerce/wc/appmanagement/properties/UpdateEARFilter.properties
    2. In the sample file, name-value pairs are defined. If an extension is flagged true, any file with this specific extension is treated as static content. This sample file indicates that any file with an extension of .gif is static content.
      #-------------------------------------------------------------------
      # Licensed Materials - Property of IBM
      #
      # WebSphere Commerce
      #
      # (c) Copyright IBM Corp. 2006
      #
      # US Government Users Restricted Rights - Use, duplication or
      # disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
      #-------------------------------------------------------------------
      #
       .gif=true
       .jpg=true
       .js=true
       .swf=true
       .GIF=true
       .JPG=true
       .JS=true
       .SWF=true
      
    3. If you must update or specify additional name-value pairs, complete the following steps:
      1. Create an UpdateEARFilter.properties file that stores the updated or additional name-value pairs. Ensure that the file is stored in file:Temp_dir/properties/extensions/appmanagement/UpdateEARFilter.properties The contents of this file are merged with the file version in step 4.a.
      2. Follow the sample file in step 4.b to update your new UpdateEARFilter.properties file with name-value pairs by following these guidelines:
        • Extensions that are flagged as true are considered static content. Extensions that are flagged as false are non-static content.
        • If you are adding custom value pairs, ensure that you add an entry for uppercase and lowercase.

Results

When you update content through any WebSphere Commerce tool, the static assets are automatically transferred to the remote web server through the method that was configured.

What to do next

  1. Set the transfer frequency values for your managed web assets. For more information about changing these values, see Changing managed file WebSphere Commerce EAR updater parameters. Due to the reduced load of uploading assets to the WebSphere Commerce EAR, the frequency of uploading assets can be increased through setting lower values of the following variables:
    minNumOfFileForUpdate=1
    minSecFromLastUpload=300
  2. Restart the WebSphere Commerce application.