Installing SAP Commerce Cloud 2205 for use with Composable Storefront

The following instructions describe how to install and configure SAP Commerce Cloud release 2205 for use with a composable storefront. In these instructions, SAP Commerce Cloud is installed to your local computer, so localhost is used in the browser URLs.

Important Disclaimers

  • Starting with release 2005, SAP Commerce Cloud ships with all users inactive and without passwords. These users may need to be restored for certain back end functionality to work. For example, although you will be able to add products to cart and check out, certain users are required to fulfill orders with Order Management as used in the default cx recipe. For more information, and for a sample ImpEx that enables such users, see Setting Passwords for Default Users.

  • Starting with release 1905, SAP Commerce Cloud ships without a default admin password. You must specify a password when running recipe commands, or you can specify a password in a file named custom.properties that is stored in CXCOMM*\installer\customconfig. The sample custom.properties file included in these instructions contains the default password nimda. We strongly recommend you change this password to suit your requirements, as it should not be used for production servers.

  • The sample custom properties file and OCC credentials supplied here are for evaluation purposes only. Aside from a default password, for example, the CORS settings are permissive to prevent access issues. We strongly recommend that a professional SAP Commerce Cloud administrator review these settings to suit your requirements, as they should not be used for production servers.

Installation and Configuration Instructions

Summary:

  • Step 1: Download, unzip, and create the new recipe

  • Step 2: Build and initialize the recipe

  • Step 3: Import OCC credentials

  • Step 4: Update system and user credentials (optional)

Step 1: Downloading, Unzipping, and Creating the New Recipe

Procedure

  1. Download and unzip the following files:
  2. Move the custom.properties file from spartacussampledata/resources/installer/customconfig to hybris-commerce-suite-2205/installer/customconfig.
  3. In hybris/bin:
    • Create the folder custom.

    • Move the entire spartacussampledata folder to hybris/bin/custom.

  4. In the installer/recipes folder:
    • Duplicate the cx folder.

    • Change the name of the duplicate folder to cx-for-spa.

  5. In the new cx-for-spa folder:
    • Open build.gradle with a text editor.

    • Uncomment // extName 'spartacussampledata' in the list of extensions.

    • Save and close the file.

Step 2: Building and Initialize the New Recipe

Procedure

  1. Open a terminal or command prompt window inside the installer folder.
  2. Set up the recipe using the following command:

    ./install.sh -r cx-for-spa

    If you are using Windows, change ./install.sh to install.bat.

  3. Initialize the system using the following command:

    ./install.sh -r cx-for-spa initialize

  4. Start SAP Commerce Cloud using the following command:

    ./install.sh -r cx-for-spa start

    (Using spartacussampledata and the full cx recipe, startup may take approximately 30 minutes, depending on your system.)

  5. Verify that SAP Commerce Cloud is working. To do this, you can:
    • Display the Admin Console: https://localhost:9002

    • Display Backoffice: https://localhost:9002/backoffice (can take 15-20 seconds to start the first time)

    • Display the Accelerator Electronics storefront: https://localhost:9002/yacceleratorstorefront/?site=electronics

  6. Verify that the composable storefront versions of the sample stores were created.
    • Display Backoffice.

    • Go to WCMS > Website. You should see "-spa" versions of the sample stores.

Step 3: Importing OCC Credentials

Composable storefront uses OCC REST API calls to get information from and make changes to the backend. To do this, the backend must be configured with certain credentials.

Procedure

  1. Open the Hybris Administration Console for your local SAP Commerce Cloud, in a web browser at the following address:

    https://localhost:9002

  2. Point to the Console tab, then click Impex Import.
  3. Copy-paste the following code into the Import content field.
    INSERT_UPDATE OAuthClientDetails;clientId[unique=true] ;resourceIds ;scope  ;authorizedGrantTypes  ;authorities ;clientSecret ;registeredRedirectUri
                                    ;client-side              ;hybris            ;basic        ;implicit,client_credentials                                  ;ROLE_CLIENT             ;secret          ;http://localhost:9001/authorizationserver/oauth2_implicit_callback;
                                    ;mobile_android           ;hybris            ;basic        ;authorization_code,refresh_token,password,client_credentials    ;ROLE_CLIENT             ;secret          ;http://localhost:9001/authorizationserver/oauth2_callback;
    
  4. Click the Import content button

    You can verify that the OAuth client has been successfully defined by entering the following curl command in a terminal or command prompt window:

    curl -k -d "client_id=mobile_android&client_secret=secret&grant_type=client_credentials" -X POST https://localhost:9002/authorizationserver/oauth/token
    

    The curl command sends a POST request for an access token, using the client ID and password that you added to the back end. The command should return something similar to the following:

    {
      "access_token" : "550d9a25-87c8-4e76-af21-6174a1e56d5c",
      "token_type" : "bearer",
      "expires_in" : 41809,
      "scope" : "basic openid"
    }
    

Step 4: Updating System and User Credentials (Optional)

You may need to enable users and passwords for certain functionality to work.

See Setting Passwords for Default Users for more information.

All Done

You can now start composable storefront. After you have configured SAP Commerce Cloud to accept OCC REST API calls, you can set up and start your storefront. See Building the Composable Storefront From 6.0 Libraries for more information.

Notes

General

  • Some of the steps in this procedure are derived from the documentation for installing SAP Commerce Cloud using recipes. For more information, see Installing SAP Commerce Cloud Using Installer Recipes.

  • The default cx recipe is used to create the recipe for composable storefront. Among other extensions, the cx recipe uses the Order Management Services feature (OMS). If you make an order, OMS doesn't ship the order, so orders remain in processing. To ship the order, a Warehouse Agent must confirm order shipment. For more information, see Order Management Services Module.

Spartacus Sample Data Extension

  • The Spartacus Sample Data extension contains sample data modifications used by the composable storefront and by the project "Spartacus" open source software. The extension makes a copy of any existing sample stores, if present. You can also use you own sample data as long as it includes extensions that support OCC APIs like commercewebservices.

  • The Spartacus Sample Data extension copies data from the electronicsstore, apparelstore, or powertoolstore extensions. Note that the time to initialize is longer because SAP Commerce Cloud first builds the standard stores, then the stores for composable storefront. If you do not need all sample stores, you can comment them out in your recipe's build.gradle file. At a minimum, one sample store is required.

  • For more information about the changes that are implemented with the Spartacus Sample Data extension, see Spartacus Sample Data Extension.

Sample Configuration Properties

The sample custom properties file is meant for development and evaluation purposes only. Please be careful to at least review the following properties:

  • The admin password (initialpassword.admin) (default is nimda).

  • CORS settings as described further in this document, and in the composable storefront documentation.

The following table summarizes the settings included in this file:

Setting Description

initialpassword.admin

Admin password so you can access the console and Backoffice

occ.rewrite.overlapping.paths.enabled

Defines if certain B2B OCC calls are prefixed with 'org' to avoid endpoint conflicts (the default is set to true to ensure that both B2C and B2B storefronts can run in parallel)

sop.post.url

Defines where to send mock payment creation requests, so you can check out

corsfilter*

Defines various CORS settings required for composable storefront functionality to work (see more information below) - note that the settings are permissive and should be changed to match your site configuration

mockup.payment.label.billTo*

Defines extra state and phone number fields for payment, used by composable storefront

yacceleratorordermanagement.fraud*

Increases the fraud score limits so you mock purchases are not cancelled

task.polling.interval.min

Defines how long the system waits to kick off a new task - smaller values speed up order processing

build.parallel

Speeds up initialization if your system has multiple cores

Sample OCC credentials

By default, SAP Commerce Cloud successfully replies to OCC REST API calls that do not require authentication. For example, you can do the following:

  • Display Open API documentation: https://localhost:9002/occ/v2/swagger-ui.html

  • Display information about the Electronics base store: https://localhost:9002/occ/v2/electronics/basestores/electronics

To be able to register users and check out, SAP Commerce Cloud must be configured with a client ID and password. When required, your composable storefront sends this client ID and password when communicating with the back end.

  • When you import the OCC credentials ImpEx in Step 3: Importing OCC Credentials, you add the client ID mobile_android and password (or secret): secret. The values for client ID and password are samples. You would use different values for your production environments.

  • For more information on this topic, see Configuring OAuth Clients.

CORS Settings

  • CORS settings are very important for security. We strongly recommend that a professional SAP Commerce Cloud administrator review these settings to suit your requirements, as the sample properties should not be used for production servers.

  • CORS (Cross-Origin Resource Sharing) defines a way for a browser and a server to decide which cross-origin requests for restricted resources can or cannot be allowed. Certain composable storefront functionality, such as checkout and consent management, may not work properly if the CORS OCC REST API settings are not configured properly in SAP Commerce Cloud.

  • You can add these settings using the Hybris Administration Console. Hover your mouse over the Platform tab, click Configuration, then update the CORS settings.

  • For information on composable storefront and CORS settings, see Cross-Origin Resource Sharing (CORS).

  • There are a number of other composable storefront features that also require additional CORS settings. For more information about CORS, see ycommercewebservices Extension.

Troubleshooting

  • If SAP Commerce Cloud installer doesn't work, make sure there are no spaces in the path to the SAP Commerce Cloud folder.

  • If composable storefront starts or partially starts, check all CORS settings. For more information, see Cross-Origin Resource Sharing (CORS).