SAP Commerce Cloud provides many self-service capabilities to configure, build, and deploy commerce solutions. There seems to be a lot to know when you first get started. In this article, we'll walk you through how to use self-service features to configure your application, then how to build and deploy to your development environment. After following the steps in this article, you should be able to easily add any other customizations and deploy them to the environment of your choice. Before reading this article, we recommend you to read our article on Getting Started with SAP Commerce Cloud which covers some of the concepts/terms that we will mention in this article. You may also want to review the Initial Setup and Storefront Verification sections of the product document , which this article will expand upon.
Initial Access to SAP Cloud Portal
Before considering building and deploying projects, you should take some time to familiarize yourself with the Cloud Portal, a self-service tool for managing SAP Commerce Cloud solutions. To access the Cloud Portal, you need to have an SAP user ID (S-user) and have been granted access by someone with the Customer System Administrator role. If you are not sure who your super administrator is, you can navigate to https://launchpad.support.sap.com/#/user/management , select "Key Contacts", and look for "Super Administrator" "Identity People" role. They can then grant you access.
Assuming you are a super administrator or someone has granted you the role, you can visit . If you're having trouble with your password, see this page in the product documentation. Make sure you are also using a supported browser.
After logging in, you should make sure some environments are configured. You can do this by clicking the "Environments" button in the upper left corner of the cloud portal. You should have at least 1 development, 1 staging, and 1 production environment (if you need more, you can buy it). If you do not see any configured environments, you will need to find your super administrator to use the self-service environment configuration in the SAP Customer Experience Cockpit.
Connect an Empty Git Repository
The next step is to connect the empty Git repository that you will use to maintain the code that will be built and deployed on SAP Commerce Cloud. Each subscription to SAP Commerce Cloud is able to connect to a Git-based repository. The git repository needs to be on a publicly accessible server (not behind a firewall in a corporate environment). Access is possible via SSH and HTTPS methods.
Set Up Your Git Repository
Now that your Git repository is connected, this section will help you through the steps to populate the repository with code. There is an extensive section in the product documentation where you can populate the repository in various ways, but if you're looking for a working template to get you started then you can download the various code samples to initially populate the repository. This section shows how to get started with the sample code, which includes the structure of the Spartacus-based job storefront and the accelerator-based sample storefront.
Get it Working Locally
Given that your development team is likely to develop and test customizations locally, you should try to structure your repository to allow builds both locally and in your SAP Commerce Cloud environment. To do this, you need to keep the following in mind:
Make sure you use the gitignore file to upload to your repository only items that were not automatically added as part of the SAP Commerce Cloud build automation process.
For example, you should not add the SAP Commerce "bin" folder, as the relevant extensions you declare in the manifest file (see below) will be added automatically as part of the build.
The sample code assumes that you want to develop locally with Cloud Hot Folders. If you are using SAP Commerce core version 2005, the sap-ccv2-hotfolder module is included. If you are using Commerce core 1905, you will need to get the extension from the Cloud Extension Pack.
You will need to download this artifact even if you are not using the optional cloud extension, as you will need the sap-ccv2-hotfolder module that comes with it. If you are using Cloud Extension Packs then you will need all the code. To download search for "CX Comm" at launchpad.support.sap.com and select the "Ext Pack" for your version. For more information, see Testing Cloud Hot Folders in a Local Environment in the product documentation. If you are using Commerce core 6.7-1811, see this SAP Note .
You will need a copy of the latest patch version of the SAP Commerce core that you will be using. See this page for how to download.
Now that you are ready to start locally, do the following:
- Clone the empty git repository where you will store your code
- (Optional) If you want to start your code review process right from the start, you may want to create a "develop" and "feature" branch where you will store your code
- Use our open source examples repository to choose a branch and download the zip of this code example. Note: The code samples repository contains multiple branches, each covering a different use case (datacenter, spartacus, vanilla). You can choose a different branch, but in this example we are using the Spartacus branch.
- Extract the sample code files to the location where you cloned the git repository
- Unzip a copy of the SAP Commerce core elsewhere
- Move the following folders from the unzipped SAP Commerce core directory to core-customize/hybris/bin in step #4: hybris/bin/modules and hybris/bin/platform
- (Optional) If you are using the Cloud Extension Pack, extract the contents of "hybris/bin/modules/" from step 4 and copy it into the "hybris/bin/modules-cep" directory
Complete the steps in the following section of the installation steps in the product documentation: Setting up Apache Ant - Run the following code to make sure your add-on is loaded correctly:
ant addoninstall -Daddonnames="promotionenginesamplesaddon,smarteditaddon,textfieldconfiguratortemplateaddon,assistedservicestorefront,assistedservicepromotionaddon,customerticketingaddon,orderselfserviceaddon,adaptivesearchsamplesaddon,multicountrysampledataaddon,pcmbackofficesamplesaddon,personalizationaddon" -DaddonStorefront.yacceleratorstorefront="yacceleratorstorefront"
- Proceed to the following section of the installation steps in the product documentation:
(1) Execute the build process
(2) Start the application server and deploy the application
(3) Initialize SAP Commerce
- Once your SAP Commerce Cloud solution is running locally (for example, you can access localhost:9001/hac), you can now build and run your Spartacus storefront locally. To do this, navigate to js-storefront/spartacusstore
Execute the following command, this will build and run your storefront:
yarn build
yarn start
You should now have local instances running SAP Commerce and Spartacus storefronts. To confirm that the Spartacus storefront is running, navigate to http://localhost:4200
Review and Configure Your Build Manifest
Build manifests enable you to configure your SAP Commerce Cloud solution to your exact specifications. You define the build process using the manifest.json file, which is stored in your code repository. A sample manifest.json file is included in the sample code we provided above. For this step, you should review the manifest file to make sure you understand what each component is for and how the example is configured. It is recommended that you start with as few changes as possible to ensure that it works with the Cloud Automation tools first. Some of the changes you might make in the future include:
- commerceSuiteVersion - the version of SAP Commerce Core you are using
- useCloudExtensionPack - if you want to enable cloud extension pack
- storefrontAddons - if you have any other add-on extensions enabled in the localextensions.xml file, you should make sure they are included in your manifest
- aspects - define any properties and web application for any of the predefined aspects
- tests - If you have any tests in your extension that you want to run as part of your Cloud Automation build, you should include them here
Commit to Your Git Repository
At this point you can now build locally, so you should commit the code and push it to your git repository.
The Initial Build
At this point, you've confirmed that your code is running locally, you've checked in to your Git repository, you've configured endpoints, and managed your security settings. The next step is to build the code. These steps the product documentation. If for some reason your build fails, you can view the build log, fix any issues and retry the build.
The Initial Deploy
Once your build is successful, you should first try to deploy it to your development environment. Given that this is your first deployment, you should set it to "Initialize Database".
Once deployed, you can open the URL of the JS Storefront endpoint and you should see the Project Spartacus storefront.
More Jerry's original articles, all in: "Wang Zixi":
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。