Skip to content

Latest commit

 

History

History
156 lines (133 loc) · 7.9 KB

File metadata and controls

156 lines (133 loc) · 7.9 KB

SAP Commerce Project Template for CCv2

Initial project bootstrap

  1. Download the latest SAP Commerce 2011 release zip file and put it into the dependencies folder using the correct file name, e.g.

    cp ~/Downloads/CXCOMM201100P*.ZIP ./dependencies/hybris-commerce-suite-2011.6.zip

    Or configure your S-User (e.g. using gradle.properties) and run ./gradlew downloadAndVerifyPlatform

  2. Bootstrap the starting point for your Commerce project by running the following command:

    ./gradlew -b bootstrap.gradle.kts \
      -PprojectName=<name, e.g. coolshop> \
      -ProotPackage=<package, e.g. com.cool.shop> \
      -PintExtPackVersion=2102.1    # (optional) enable "SAP Commerce Cloud, Integration Extension Pack"

    Read the output!

    (If you use a headless setup: You can delete the generated <projectName>storefront extension afterwards. Don't forget to remove it from localextensions.xml / manifest.jsonnet too)

  3. Review the generated configuration in hybris/config, especially the hybris/config/environment/*.properties files and localextensions.xml (search for TODO: comments)

  4. Update the manifest.jsonnet (again, search for TODO: comments).
    You can use the jsonnet file to update the manifest.json for your project.

  5. Delete all bootstrap files, you don't need them anymore:

    rm -r bootstrap*
  6. Delete this quote

  7. Commit and push the changes to your project repository :)

We use Gradle + commerce-gradle-plugin to automate whole project setup.

Setup local development

git clone <project>
cd <project>
docker-compose up -d
cd core-customize
./gradlew setupLocalDevelopment
./gradlew yclean yall
./gradlew yinitialize

FAQ

How to use manifest.jsonnet?

To generate the manifest.json with Jsonnet:

jsonnet --output-file manifest.json manifest.jsonnet

How do I add an addon to my storefront?

  1. Add the addon to the manifest.json (either by hand or via manifest.jsonnet, documentation)
  2. Run ./gradlew installManifestAddon
  3. Reformat <storefront>/extensioninfo.xml (unfortunately, the the platform build messes it up when adding addons)
  4. Commit/push your changes
  5. Tell your team to run ./gradlew installManifestAddon after pulling your changes.

Why does the configuration work for local development and the cloud?

By combining the configuration reuse mechanism of CCv2, the optional configuration folder of Commerce and a bit of clever symlinking of files and folders, we can use the same configuration locally and in the cloud.

This setup uses:

  • hybris/config/localextensions.xml to configure extensions
  • hybris/config/cloud/**/*.properties to configure properties per CCv2 aspect and/or persona. There is one file per aspect, plus the special file local-dev.properties that configures the local development environment.
  • hybris/config/local-config is configured as hybris.optional.config.dir and contains symlinks to the relevant property files in hybris/config/cloud (by default: common.properties, persona/development.properties and local-dev.properties).
    Important local.properties must not be modified at all (that's why it is in .gitignore).
    • If you have any configuration specific to your local machine, put it in hybris/config/local-config/99-local.properties.
    • If the local setup changes for the whole project, update hybris/config/cloud/local-dev.properties
  • If you enabled solr customization during bootstrap (./gradle -b boostrap.gradle.kts enableSolrCustomization), the default cloud solr configuration set is moved to the correct folder structure for CCv2 (documentation). A symlink in hybris/config/solr allows you to use the same configuration locally.
                                  core-customize
                                  ├── ...
                                  ├── hybris
                                  ├── ...
                                  │  ├── config
                                  │  │  ├── cloud
                        +--------------------> accstorefront.properties
                        +--------------------> admin.properties
                        +--------------------> api.properties
                        +--------------------> backgroundprocessing.properties
                        +--------------------> backoffice.properties
                        +--------------------> common.properties     <---+
                        |         │  │  │  └── local-dev.properties <--+ |
                        |         │  │  ├── ...                        | | symlinks
                        |         │  │  ├── local-config               | |
manifest.json           |         │  │  │  ├── 10-local.properties +-----+
  useConfig             |         │  │  │  ├── 50-local.properties +---+
    properties          |         │  │  │  └── 99-local.properties
      ... +-------------+         │  │  ├── local.properties
    extensions +--------------------------> localextensions.xml
    solr +---------+              │  │  ├── readme.txt
                   |              │  │  ├── solr
                   |              │  │  │  └── instances
                   |              │  │  │     └── cloud
                   |              │  │  │        ├── configsets +-------+
                   |              │  │  │        ├── ...                |
                   |              │  │  │        └── zoo.cfg            |
                   |              │  │  └── ...                         |
                   |              ├── ...                               |  symlink
                   +----------------> solr                              |
                                  │  └── server                         |
                                  │     └── solr                        |
                                  │        └── configsets <-------------+
                                  │           └── default
                                  │              └── conf
                                  │                 ├── lang
                                  │                 ├── protwords.txt
                                  │                 ├── schema.xml
                                  │                 ├── solrconfig.xml
                                  │                 ├── stopwords.txt
                                  │                 └── synonyms.txt
                                  └── ...

Demo Setup

The file bootstrap-demo.gradle.kts bootstraps a demo storefront based on the cx recipe, including the spartacussampledata extension (necessary to demo the Spartacus storefront; documentation)

To generate the demo, run:

./gradlew -b bootstrap-demo.gradle.kts