CloudNir

Home » Installing SAP Commerce Cloud for use with Spartacus

Installing SAP Commerce Cloud for use with Spartacus

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

The installation procedure includes steps for creating and using a b2c_for_spartacus recipe that makes use of the Spartacus Sample Data Addon, but you can use you own sample data or recipe as long as it includes the cmsoccaddon and ycommercewebservices extensions.

For more information about the changes that are implemented with the Spartacus Sample Data AddOn, see Spartacus Sample Data Addon.

Installing and configuring SAP Commerce Cloud for use with Spartacus involves the following procedures:

  1. Setting up SAP Commerce Cloud
  2. Configuring OCC credentials
  3. Configuring CORS

1. Setting Up SAP Commerce Cloud with the Spartacus Sample Data Addon

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 Using Installer Recipes in the SAP Help Portal.

  1. Unzip the SAP Commerce Cloud zip archive.

Note: The name of the zip archive for release 1905 starts with CXCOMM1905#…. This folder will be referred to as CXCOMM* for the rest of these instructions.

  1. Download the Spartacus Sample Data AddOn.
  2. Unzip the spartacussampledataaddon.zip archive.
  3. Move the spartacussampledataaddon folder to hybris/bin/modules/b2c-accelerator.

Tip:

The spartacussampledataaddon folder can be stored anywhere in the modules folder. The b2c-accelerator folder is chosen as it contains other B2C sample data.

  1. In the installer/recipes folder, duplicate the b2c_acc_plus folder.
  2. Rename the copy of the b2c_acc_plus folder to b2c_for_spartacus.
  3. In b2c_for_spartacus, open build.gradle with a text editor.
  4. In the list of extensions, add the following:
extName 'spartacussampledataaddon'

You can put the new entry anywhere in the list of extensions, but it’s usually added near electronicsstore. The following is an example:

extName 'electronicsstore'
extName 'apparelstore'
extName 'spartacussampledataaddon'

Note: 

If you do not need to install the Apparel store, you can remove extName ‘apparelstore‘ from the build.gradle file.

  1. In the addons { forStoreFronts(‘yacceleratorstorefront’) section of the build.gradle file, add ‘spartacussampledataaddon’ to the names list. The following is an example:

addons {
forStoreFronts('yacceleratorstorefront') {
names('spartacussampledataaddon', 'captchaaddon', ...

  1. Save the file.
  2. Open a terminal or command prompt window inside the CXCOMM*\installer folder.
  3. Set up the recipe using the following command:

./install.sh -r b2c_for_spartacus -A local_property:initialpassword.admin=nimda

Note:
nimda is a dummy password, you can change as per your choice

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

Note: 

Starting with release 1905, SAP Commerce Cloud releases do not ship with a default admin password. You must specify a password when running recipe commands (as shown above), or you can specify a password in a file named custom.properties stored in CXCOMM*\installer\customconfig. See the Alternate Method for Setting the SAP Commerce Cloud Admin Password procedure below for information on setting a password in the custom.properties file.

  1. Initialize the system using the following command:

./install.sh -r b2c_for_spartacus -A local_property:initialpassword.admin=nimda initialize

Have a Coffee 🙂

Initialization of the b2c_for_spartacus recipe can take about 30 minutes. Sample data for this recipe includes Electronics, Apparel, and Electronics for Spartacus sample stores.

  1. Start SAP Commerce Cloud with the following command:

./install.sh -r b2c_for_spartacus -A local_property:initialpassword.admin=nimda start

  1. Verify that the system is working.
    • Display the Admin Console: https://localhost:9002
    • Display Backoffice: https://localhost:9002/backoffice
    • Display the Accelerator Electronics storefront: https://localhost:9002/yacceleratorstorefront/?site=electronics

Note:

When setting up your Spartacus storefront, set the base site in app.module.ts to electronics-spa. The following is an example:

context: {
baseSite: [‘electronics-spa’]
},