Skip to content

Commit

Permalink
Merge branch 'fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpern committed Dec 16, 2020
2 parents df8f7f8 + 3ad4e5b commit b9fff14
Show file tree
Hide file tree
Showing 491 changed files with 30,025 additions and 6,831 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# CCv2 Template Repository

- Best-practice setup
- Based on `b2c_acc_plus` recipe
- Based on SAP Commerce 2011
- Generates Demo B2C accelerator modules, OCC extension and OCC tests extension
- Includes Spartacus storefront
- Fully automated setup for local development
- [docker-compose](https://docs.docker.com/compose/)-based setup for:
Expand Down
7 changes: 6 additions & 1 deletion core-customize/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Folders to ignore, whatever the place they are
.DS_Store
.metadata
classes
testclasses
eclipsebin
gensrc

Expand Down Expand Up @@ -52,11 +53,15 @@ base.properties
**/tld/addons
**/tags/addons
**/messages/addons
**/lib/addons
**/web/addonsrc
**/_ui-src/addons
**/web/addontestsrc
**/web/commonwebsrc/*/
**/web/webroot/WEB-INF/lib/addon-*
wro_addons.xml

# Backoffice artifacts
*_bof.jar

# project ignore
Expand Down
147 changes: 138 additions & 9 deletions core-customize/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,150 @@
# SAP Commerce Project Template for CCv2

> **Initial project bootstrap**
>
> 1. Download the latest SAP Commerce 2011 release zip file and put it into the `platform` folder
> using the correct file name, e.g.
>
> ```bash
> cp ~/Downloads/CXCOMM201100P*.ZIP ./platform/hybris-commerce-suite-2011.0.zip
> ```
>
> 1. Bootstrap the starting point for your Commerce project by running the following command:
>
> ```bash
> ./gradlew -b bootstrap.gradle.kts \
> -PprojectName=<name, e.g. coolshop> \
> -ProotPackage=<package, e.g. com.cool.shop>
> ```
>
> (N.B.: If you use a headless setup: You can delete the generated `<something>storefront` extension
> afterwards. Don't forget to remove it from `localextensions.xml` / `manifest.json`)
> 1. Review the generated configuration in `hybris/config`, especially the `hybris/config/environment/*.properties`
> files and `localextensions.xml` (search for `TODO:` comments)
> 1. Update the `manifest.jsonnet` (again, search for `TODO:` comments).\
> You can use the jsonnet file to update the `manifest.json` for your project.
> 1. Delete all bootstrap files, you don't need them anymore:
>
> ```bash
> rm -r bootstrap*
> ```
>
> 1. Delete this quote
> 1. Commit and push the changes to your project repository :)
We use Gradle + [commerce-gradle-plugin][plugin] to automate whole project setup.
[plugin]: https://github.com/SAP/commerce-gradle-plugin
## Setup local development
```sh
git clone <project>
cd <project>
docker-compose up
cd core-customize
./gradlew setupLocalDevelopment
./gradlew yclean yall
./gradlew yinitialize
```
## FAQ

### How to use manifest.jsonnet?

To generate the `manifest.json` with [Jsonnet](https://jsonnet.org/):

```bash
jsonnet --output-file manifest.json manifest-generator.jsonnet
jsonnet --output-file manifest.json manifest.jsonnet
```

**Alternatively**, if you don't want to install Jsonnet, run
### 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][addon])
1. Run `./gradlew installManifestAddon`
1. Reformat `<storefront>/extensioninfo.xml` (unfortunately, the the platform build messes it up when adding addons)
1. Commit/push your changes
1. Tell your team to run `./gradlew installManifestAddon` after pulling your changes, it this is not standard.

[addon]: https://help.sap.com/viewer/1be46286b36a4aa48205be5a96240672/LATEST/en-US/9a3ab7d08c704fccb7fd899e876d41d6.html

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

By combining the [configuration reuse][reuse] mechanism of CCv2, the [optional configuration folder][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/environments/*.properties` to configure properties per CCv2 aspect.
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/environments` (by default: `common.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/environments/local-dev.properties`
- The default cloud solr configuration set is contained in the correct folder structure for CCv2 ([documentation][solr]).
A symlink in `hybris/config/solr` allows to use the same configuration locally.

```
core-customize
├── ...
├── hybris
├── ...
│ ├── config
│ │ ├── environments
+--------------------> 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
└── ...
```bash
./gradlew -b generate-manifest.gradle.kts
```

[reuse]: https://help.sap.com/viewer/1be46286b36a4aa48205be5a96240672/LATEST/en-US/2311d89eef9344fc81ef168ac9668307.html
[folder]: https://help.sap.com/viewer/b490bb4e85bc42a7aa09d513d0bcb18e/LATEST/en-US/8beb75da86691014a0229cf991cb67e4.html
[solr]: https://help.sap.com/viewer/b2f400d4c0414461a4bb7e115dccd779/LATEST/en-US/f7251d5a1d6848489b1ce7ba46300fe6.html

## Demo Setup

1. Generate the sample `manifest.json` as described above
1. Download the latest Commerce platform 1905 zip file and save it as `platform/hybris-commerce-suite-1905.6.zip`
1. Download the latest cloud extension pack 1905 zip file and save it as `platform/hybris-cloud-extension-pack-1905.5.zip`
1. Generate `demoshop` storefront and `hybris/config` folder: `./gradlew generateProprietaryCode`
1. Setup local development `./gradlew setupLocalDevelopment`
The file `bootstrap-demo.gradle.kts` bootstraps a demo storefront based on the `cx` [recipe][recipe],
including the `spartacussampledataaddon` (necessary to demo the Spartacus storefront; [documentation][spartacussample])

To generate the demo, run:
```
./gradlew bootstrap-demo.gradle.kts
```
[spartacussample]: https://sap.github.io/spartacus-docs/spartacussampledataaddon/
[recipe]: https://help.sap.com/viewer/a74589c3a81a4a95bf51d87258c0ab15/2011/en-US/f09d46cf4a2546b586ed7021655e4715.html
18 changes: 0 additions & 18 deletions core-customize/after-deploy.impex

This file was deleted.

Loading

0 comments on commit b9fff14

Please sign in to comment.