|
| 1 | +# Overview |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Reference |
| 6 | + |
| 7 | +- [CAP Documentation](https://cap.cloud.sap/docs/get-started/) |
| 8 | +- [CAP Multitenancy](https://cap.cloud.sap/docs/guides/multitenancy/) |
| 9 | +- [Deploy to Kyma](https://cap.cloud.sap/docs/guides/deployment/to-kyma) |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +- [SAP BTP, Kyma runtime instance](../prerequisites/README.md#kyma) |
| 14 | + |
| 15 | +> [!Note] |
| 16 | +> If you're using an SAP BTP trial account, use a subaccount that supports SAP Hana Cloud. At the time of creating the sample (September 2025), SAP Hana Cloud is available in the US, but not in Singapore. |
| 17 | +
|
| 18 | +- [Docker](../prerequisites/README.md#docker) |
| 19 | +- [Kubernetes tooling](../prerequisites/README.md#kubernetes) |
| 20 | +- Kubectl configured to the namespace where you want to deploy the application |
| 21 | +- [Pack](../prerequisites/README.md#pack) |
| 22 | +- [NodeJS 22 or higher](https://nodejs.org/en/download/) |
| 23 | +- [SAP CAP](../prerequisites/README.md#sap-cap) |
| 24 | +- SAP Hana Cloud Instance |
| 25 | + |
| 26 | +> [!Note] |
| 27 | +> If you're using an SAP BTP trial account, make sure your subaccount location supports SAP Hana Cloud. |
| 28 | +
|
| 29 | +- Entitlement for `hdi-shared` plan for Hana cloud service in your SAP BTP subaccount. |
| 30 | +- [SAP Hana Cloud Instance mapped to Kyma](https://blogs.sap.com/2022/12/15/consuming-sap-hana-cloud-from-the-kyma-environment/) |
| 31 | + |
| 32 | +## Initial setup |
| 33 | + |
| 34 | +- **Navigate to bookshop-external directory**. |
| 35 | + |
| 36 | +> Note: All subsequent commands should be run from this directory. |
| 37 | +
|
| 38 | +```shell |
| 39 | +cd bookshop-external |
| 40 | +``` |
| 41 | + |
| 42 | +### Running the application locally |
| 43 | + |
| 44 | +- Start sidecar |
| 45 | + |
| 46 | +```shell |
| 47 | +cds watch mtx/sidecar |
| 48 | +``` |
| 49 | + |
| 50 | +- In another terminal, start CAP app |
| 51 | + |
| 52 | +```shell |
| 53 | +cds watch --profile local-multitenancy |
| 54 | +``` |
| 55 | + |
| 56 | +- Run the commands from a new terminal to add tenants. Run the following commands or use [test.rest](./test.rest) |
| 57 | + |
| 58 | +```shell |
| 59 | +cds subscribe t1 --to http://localhost:4005 -u yves: |
| 60 | +cds subscribe t2 --to http://localhost:4005 -u yves: |
| 61 | +``` |
| 62 | + |
| 63 | +- Get data for both users |
| 64 | + |
| 65 | +```shell |
| 66 | +http http://localhost:4004/odata/v4/catalog/Books -a alice: |
| 67 | +http http://localhost:4004/odata/v4/catalog/Books -a erin: |
| 68 | +``` |
| 69 | + |
| 70 | +## Deploy to Kyma |
| 71 | + |
| 72 | +- Update the following in [bookshop-external/chart/values.yaml](bookshop-external/chart/values.yaml) |
| 73 | + |
| 74 | + - `global.domain`: your kyma domain |
| 75 | + - `global.imagePullSecret.name`: your docker pull secret name if images are pulled from private registry |
| 76 | + - `global.image.registry`: your docker registry server |
| 77 | + |
| 78 | +- Update the following in [bookshop-external/containerize.yaml](bookshop-external/containerize.yaml) |
| 79 | + - `repository`: your docker registry server |
| 80 | + |
| 81 | +- Build the docker images and deploy the helm chart to Kyma |
| 82 | + |
| 83 | +```bash |
| 84 | +cds build --production |
| 85 | +cds up -2 k8s |
| 86 | +``` |
| 87 | + |
| 88 | +## Verify |
| 89 | + |
| 90 | +- Simulate the subscribe flow by subscribing from a different subaccount in the same Global account in BTP cockpit. |
| 91 | + |
| 92 | +- Access the subscribed application. |
| 93 | + |
| 94 | +## Cleanup |
| 95 | + |
| 96 | +- Unsubscribe the tenant from the BTP cockpit. |
| 97 | +- Undelloy the helm chart |
| 98 | + |
| 99 | +```bash |
| 100 | +helm del --wait --timeout=10m bookshop-external |
| 101 | +``` |
| 102 | + |
| 103 | +## Troubleshooting |
| 104 | + |
| 105 | +- Helm command to upgrade / install / reinstall the chart |
| 106 | + |
| 107 | +```bash |
| 108 | +helm upgrade --install bookshop-external ./gen/chart --wait --wait-for-jobs --timeout=10m --set-file xsuaa.jsonParameters=xs-security.json |
| 109 | +``` |
0 commit comments