From 43934b7ed5147c25072458668fb190f5fb5071fe Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 24 Sep 2025 11:27:59 +0200 Subject: [PATCH 01/37] shared-db w/ java --- guides/deployment/microservices.md | 270 ++++++++++++++++++++++++++++- 1 file changed, 266 insertions(+), 4 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 0f72155024..7560a2456f 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -35,6 +35,8 @@ This guide describes a way to manage development and deployment via *[monorepos] echo "{\"name\":\"@capire/samples\",\"workspaces\":[\"*\"]}" > package.json ``` +
+ 2. Add the previously mentioned projects as `git` submodules: ```sh @@ -48,6 +50,25 @@ This guide describes a way to manage development and deployment via *[monorepos] git submodule update --init ``` +
+ +
+ +2. Add the previously mentioned projects as `git` submodules: + + ```sh + git init + git submodule add https://github.com/capire/bookstore-java + git submodule add https://github.com/capire/reviews-java + git submodule add https://github.com/capire/orders-java + git submodule add https://github.com/capire/common-java + git submodule add https://github.com/capire/bookshop-java + git submodule add https://github.com/capire/data-viewer-java + git submodule update --init + ``` + +
+ Add a _.gitignore_ file with the following content: ```txt node_modules @@ -55,6 +76,9 @@ This guide describes a way to manage development and deployment via *[monorepos] ``` > The outcome of this looks and behaves exactly as the monorepo layout in *[cap/samples](https://github.com/capire/samples)*, so we can exercise the subsequent steps in there... + +
+ 3. Test-drive locally: ```sh npm install @@ -64,13 +88,24 @@ This guide describes a way to manage development and deployment via *[monorepos] cds w bookshop ``` + Each microservice can be started independently. If you start each microservice, one after the other in a different terminal, the connection is already established. + + [Learn more about Automatic Bindings by `cds watch`](../extensibility/composition#bindings-via-cds-watch){.learn-more} + +
+ +
+ +3. Test-drive locally: ```sh - cds w bookstore + npm install ``` - Each microservice can be started independently. If you start each microservice, one after the other in a different terminal, the connection is already established. + ```sh + cd bookstore && npm start + ``` - [Learn more about Automatic Bindings by `cds watch`](../extensibility/composition#bindings-via-cds-watch){.learn-more} +
::: details The project structure @@ -208,8 +243,18 @@ This section is about how to deploy all 3+1 projects at once with a common _mta. ![component diagram with synchronous and event communication for orders](./assets/microservices/bookstore.excalidraw.svg) +
+ [@capire/samples](https://github.com/capire/samples#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. +
+ +
+ +TODO [@capire/samples-java](https://github.com/capire/samples-java#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. + +
+ ### Deployment Descriptor Add initial multitarget application configuration for deployment to Cloud Foundry: @@ -258,6 +303,7 @@ build-parameters: ``` ::: +
::: info `cds build --ws` If the CDS models of every NPM workspace contained in the monorepo should be considered, then instead of creating this `shared-db` folder, you can also use: @@ -269,8 +315,12 @@ The `--ws` aggregates all models in the NPM workspaces. In this walkthrough, we only include a subset of the CDS models in the deployment. ::: +
+ +
::: details Configure each app for cloud readiness + The preceding steps only added configuration to the workspace root. Additionally add database configuration to each module that we want to deploy - bookstore, orders, and reviews: @@ -280,11 +330,25 @@ npm i @cap-js/hana --workspace bookstore npm i @cap-js/hana --workspace orders npm i @cap-js/hana --workspace reviews ``` + +::: + +
+ +
+ +::: details Configure each app for cloud readiness + +For each project add the **cds-starter-cloudfoundry** [starter bundle](https://cap.cloud.sap/docs/java/developing-applications/building#starter-bundles). + ::: +
### Applications +
+ Replace the MTA module for `samples-srv` with versions for each CAP service and adjust `name`, `path`, and `provides[0].name` to match the module name. Also change the `npm-ci` builder to the `npm` builder. ::: code-group @@ -347,7 +411,90 @@ modules: ``` ::: -Add build commands for each module to be deployed: +
+ +
+ +Replace the MTA module for `samples-srv` with versions for each CAP service and adjust `name`, `path`, and `provides[0].name` to match the module name. Also change the `npm-ci` builder to the `npm` builder. + +::: code-group +```yaml [mta.yaml] +modules: + + - name: bookstore-srv # [!code focus] + type: java + path: bookstore/srv # [!code focus] + parameters: + instances: 1 + buildpack: sap_java_buildpack_jakarta + properties: + SPRING_PROFILES_ACTIVE: cloud,sandbox + JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jre.SAPMachineJRE']" + JBP_CONFIG_SAP_MACHINE_JRE: '{ version: 21.+ }' + build-parameters: + builder: custom + commands: + - mvn clean package -DskipTests=true --batch-mode + provides: # [!code focus] + - name: bookstore-api # [!code focus] + properties: + srv-url: ${default-url} + requires: + - name: samples-db + - name: samples-auth + - name: samples-messaging + - name: samples-destination + + - name: orders-srv # [!code focus] + type: java + path: orders/srv # [!code focus] + parameters: + instances: 1 + buildpack: sap_java_buildpack_jakarta + build-parameters: + builder: custom + commands: + - mvn clean package -DskipTests=true --batch-mode + build-result: target/*-exec.jar + provides: # [!code focus] + - name: orders-api # [!code focus] + properties: + srv-url: ${default-url} + requires: + - name: samples-db + - name: samples-auth + - name: samples-messaging + - name: samples-destination + + - name: reviews-srv # [!code focus] + type: java + path: reviews/srv # [!code focus] + parameters: + instances: 1 + buildpack: sap_java_buildpack_jakarta + build-parameters: + builder: custom + commands: + - mvn clean package -DskipTests=true --batch-mode + build-result: target/*-exec.jar + provides: # [!code focus] + - name: reviews-api # [!code focus] + properties: + srv-url: ${default-url} + requires: + - name: samples-db + - name: samples-auth + - name: samples-messaging + - name: samples-destination +... +``` +::: + +
+ +
+ +Add build commands for each module to be prepared for deployment: ::: code-group ```yaml [mta.yaml] @@ -367,6 +514,8 @@ build-parameters: Note that we use the *--ws-pack* option for some modules. It's important for node modules referencing other repository-local node modules. ::: +
+ ### Authentication @@ -400,6 +549,8 @@ Add the admin role ``` ::: +
+ ::: details Configure each app for cloud readiness Add NPM dependency `@sap/xssec`: @@ -410,10 +561,14 @@ npm i @sap/xssec --workspace reviews ``` ::: +
+ ### Messaging The messaging service is used to organize asynchronous communication between the CAP services. +
+ ```shell cds add enterprise-messaging ``` @@ -499,6 +654,69 @@ Enable messaging for the modules that use it: ::: +
+ +
+ +Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the *emname* and *namespace* properties, as these will be parameterized dynamically in the mta.yaml file: + +::: code-group +```json [event-mesh.json] +{ + "version": "1.1.0", + "emname": "samples-emname", // [!code --] + "version": "1.1.0", + "namespace": "default/samples/1", // [!code --] + "options": { + "management": true, + "messagingrest": true, + "messaging": true + }, + "rules": { + "topicRules": { + "publishFilter": [ + "*" + ], + "subscribeFilter": [ + "*" + ] + }, + "queueRules": { + "publishFilter": [ + "*" + ], + "subscribeFilter": [ + "*" + ] + } + }, + "authorities": [ + "$ACCEPT_GRANTED_AUTHORITIES" + ] +} +``` +::: + +Add messaging resource in mta.yaml with parametrized *emname* and *namespace* properties: + +::: code-group +```yaml [mta.yaml] +resources: + - name: samples-messaging + type: org.cloudfoundry.managed-service + parameters: + service: enterprise-messaging + service-plan: default + path: ./event-mesh.json + config: # [!code ++] + emname: bookstore-${org}-${space} # [!code ++] + namespace: cap/samples/${space} # [!code ++] +``` +::: + + +
+ ### Destinations @@ -550,6 +768,8 @@ modules: Use the destinations in the bookstore application: +
+ ::: code-group ```yaml [mta.yaml] modules: @@ -561,6 +781,35 @@ modules: ``` ::: +
+ +
+ +::: code-group +```yaml [bookstore/srv/src/main/resources/application.yaml] +cds: + odataV4.endpoint.path: / + messaging.services: + samples-messaging: + kind: enterprise-messaging + remote.services: # [!code ++] + OrdersService: # [!code ++] + type: "odata-v4" # [!code ++] + http: # [!code ++] + suffix: "/odata/v4" # [!code ++] + destination: # [!code ++] + name: "orders-dest" # [!code ++] + ReviewsService: # [!code ++] + type: "odata-v4" # [!code ++] + destination: # [!code ++] + name: "reviews-dest" # [!code ++] +``` +::: + +
+ +
+ ::: details Configure each app for cloud readiness Add `@sap-cloud-sdk/http-client` and `@sap-cloud-sdk/resilience` for each module utilizing the destinations: @@ -571,6 +820,19 @@ npm i @sap-cloud-sdk/resilience --workspace bookstore ``` ::: +
+ + +
+ +::: details Configure each app for cloud readiness + +Add dependency to the **cds-feature-remote-odata** [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) + +::: + +
+ ### Approuter Add [approuter configuration](../deployment/to-cf#add-app-router) using the command: From c448fdac5822444e20c2c74b4f5df98188d86d0c Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 8 Oct 2025 15:49:03 +0200 Subject: [PATCH 02/37] update --- guides/deployment/microservices.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 7560a2456f..4707e6a969 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -658,7 +658,7 @@ Enable messaging for the modules that use it:
-Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the *emname* and *namespace* properties, as these will be parameterized dynamically in the mta.yaml file: +Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the `emname` and `namespace` properties, as these will be parameterized dynamically in the mta.yaml file: ::: code-group ```json [event-mesh.json] @@ -697,7 +697,7 @@ Create a new file named event-mesh.json to store the configuration for enterpris ``` ::: -Add messaging resource in mta.yaml with parametrized *emname* and *namespace* properties: +Add messaging resource in mta.yaml with parametrized `emname` and `namespace` properties: ::: code-group ```yaml [mta.yaml] From 13f868e96818970a94631c4155627f6b54e0808c Mon Sep 17 00:00:00 2001 From: Rene Jeglinsky Date: Fri, 10 Oct 2025 12:43:54 +0200 Subject: [PATCH 03/37] remove toggles, initial version --- guides/deployment/microservices.md | 155 +++++++---------------------- 1 file changed, 37 insertions(+), 118 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 4707e6a969..aee6f1b679 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -35,11 +35,10 @@ This guide describes a way to manage development and deployment via *[monorepos] echo "{\"name\":\"@capire/samples\",\"workspaces\":[\"*\"]}" > package.json ``` -
- 2. Add the previously mentioned projects as `git` submodules: - ```sh + ::: code-group + ```sh [Node.js] git init git submodule add https://github.com/capire/bookstore git submodule add https://github.com/capire/reviews @@ -49,14 +48,7 @@ This guide describes a way to manage development and deployment via *[monorepos] git submodule add https://github.com/capire/data-viewer git submodule update --init ``` - -
- -
- -2. Add the previously mentioned projects as `git` submodules: - - ```sh + ```sh [Java] git init git submodule add https://github.com/capire/bookstore-java git submodule add https://github.com/capire/reviews-java @@ -66,8 +58,7 @@ This guide describes a way to manage development and deployment via *[monorepos] git submodule add https://github.com/capire/data-viewer-java git submodule update --init ``` - -
+ ::: Add a _.gitignore_ file with the following content: ```txt @@ -77,42 +68,30 @@ This guide describes a way to manage development and deployment via *[monorepos] > The outcome of this looks and behaves exactly as the monorepo layout in *[cap/samples](https://github.com/capire/samples)*, so we can exercise the subsequent steps in there... -
- 3. Test-drive locally: - ```sh + + ::: code-group + ```sh [Node.js] npm install - ``` - - ```sh cds w bookshop ``` - - Each microservice can be started independently. If you start each microservice, one after the other in a different terminal, the connection is already established. - - [Learn more about Automatic Bindings by `cds watch`](../extensibility/composition#bindings-via-cds-watch){.learn-more} - -
- -
- -3. Test-drive locally: - ```sh + ```sh [Java] npm install - ``` - - ```sh cd bookstore && npm start ``` + ::: -
+ In Node.js, each microservice can be started independently. If you start each microservice, one after the other in a different terminal, the connection is already established. + + [Learn more about Automatic Bindings by `cds watch`](../extensibility/composition#bindings-via-cds-watch){.learn-more} ::: details The project structure The project structure used here is as follows: -```txt +::: code-group +```txt [Node.js] / ├─ bookstore/ ├─ orders/ @@ -120,6 +99,14 @@ The project structure used here is as follows: ├─ ... └─ package.json ``` +```txt [Java] +/ +├─ bookstore-java/ +├─ orders-java/ +├─ reviews-java/ +├─ ... +└─ package.json +``` The individual services (`bookstore`, `reviews`, `orders`) can be one of the following: * folders, committed directly to the root project @@ -243,17 +230,9 @@ This section is about how to deploy all 3+1 projects at once with a common _mta. ![component diagram with synchronous and event communication for orders](./assets/microservices/bookstore.excalidraw.svg) -
- -[@capire/samples](https://github.com/capire/samples#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. - -
+For Node.js, [@capire/samples](https://github.com/capire/samples#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. -
- -TODO [@capire/samples-java](https://github.com/capire/samples-java#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. - -
+TODO For CAP Java, [@capire/samples-java](https://github.com/capire/samples-java#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. ### Deployment Descriptor @@ -303,9 +282,7 @@ build-parameters: ``` ::: -
- -::: info `cds build --ws` +::: info `cds build --ws` with Node.js If the CDS models of every NPM workspace contained in the monorepo should be considered, then instead of creating this `shared-db` folder, you can also use: ```shell cds build --for hana --production --ws @@ -315,11 +292,7 @@ The `--ws` aggregates all models in the NPM workspaces. In this walkthrough, we only include a subset of the CDS models in the deployment. ::: -
- -
- -::: details Configure each app for cloud readiness +::: details Node.js: Configure each app for cloud readiness The preceding steps only added configuration to the workspace root. @@ -333,26 +306,18 @@ npm i @cap-js/hana --workspace reviews ::: -
- -
- -::: details Configure each app for cloud readiness +::: details CAP Java: Configure each app for cloud readiness For each project add the **cds-starter-cloudfoundry** [starter bundle](https://cap.cloud.sap/docs/java/developing-applications/building#starter-bundles). ::: -
- ### Applications -
- Replace the MTA module for `samples-srv` with versions for each CAP service and adjust `name`, `path`, and `provides[0].name` to match the module name. Also change the `npm-ci` builder to the `npm` builder. ::: code-group -```yaml [mta.yaml] +```yaml [Node.js (mta.yaml)] modules: - name: bookstore-srv # [!code focus] type: nodejs @@ -409,16 +374,7 @@ modules: - name: samples-destination ... ``` -::: - -
- -
- -Replace the MTA module for `samples-srv` with versions for each CAP service and adjust `name`, `path`, and `provides[0].name` to match the module name. Also change the `npm-ci` builder to the `npm` builder. - -::: code-group -```yaml [mta.yaml] +```yaml [Java (mta.yaml)] modules: - name: bookstore-srv # [!code focus] @@ -490,11 +446,7 @@ modules: ``` ::: -
- -
- -Add build commands for each module to be prepared for deployment: +In Node.js, add build commands for each module to be prepared for deployment: ::: code-group ```yaml [mta.yaml] @@ -514,9 +466,6 @@ build-parameters: Note that we use the *--ws-pack* option for some modules. It's important for node modules referencing other repository-local node modules. ::: -
- - ### Authentication Add [security configuration](../security/authorization#xsuaa-configuration) using the command: @@ -549,9 +498,7 @@ Add the admin role ``` ::: -
- -::: details Configure each app for cloud readiness +::: details Node.js: Configure each app for cloud readiness Add NPM dependency `@sap/xssec`: ```shell @@ -561,13 +508,11 @@ npm i @sap/xssec --workspace reviews ``` ::: -
- ### Messaging The messaging service is used to organize asynchronous communication between the CAP services. -
+#### In Node.js ```shell cds add enterprise-messaging @@ -654,9 +599,7 @@ Enable messaging for the modules that use it: ::: -
- -
+#### In CAP Java Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the `emname` and `namespace` properties, as these will be parameterized dynamically in the mta.yaml file: @@ -714,10 +657,6 @@ resources: ``` ::: - -
- - ### Destinations Add [destination configuration](https://cap.cloud.sap/docs/guides/using-services#using-destinations) for connectivity between the apps: @@ -768,10 +707,8 @@ modules: Use the destinations in the bookstore application: -
- ::: code-group -```yaml [mta.yaml] +```yaml [Node.js (mta.yaml)] modules: - name: bookstore-srv ... @@ -779,14 +716,7 @@ modules: cds_requires_ReviewsService_credentials: {"destination": "reviews-dest","path": "/reviews"} # [!code ++] cds_requires_OrdersService_credentials: {"destination": "orders-dest","path": "/odata/v4/orders"} # [!code ++] ``` -::: - -
- -
- -::: code-group -```yaml [bookstore/srv/src/main/resources/application.yaml] +```yaml [Java (bookstore/srv/src/main/resources/application.yaml)] cds: odataV4.endpoint.path: / messaging.services: @@ -806,11 +736,7 @@ cds: ``` ::: -
- -
- -::: details Configure each app for cloud readiness +::: details Node.js: Configure each app for cloud readiness Add `@sap-cloud-sdk/http-client` and `@sap-cloud-sdk/resilience` for each module utilizing the destinations: @@ -820,19 +746,12 @@ npm i @sap-cloud-sdk/resilience --workspace bookstore ``` ::: -
- - -
- -::: details Configure each app for cloud readiness +::: details CAP Java: Configure each app for cloud readiness Add dependency to the **cds-feature-remote-odata** [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) ::: -
- ### Approuter Add [approuter configuration](../deployment/to-cf#add-app-router) using the command: From 6f7637eb2d89511b61c304d18b9b21f5764db891 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 13 Oct 2025 11:20:35 +0200 Subject: [PATCH 04/37] improve remote odata with destinations --- guides/deployment/microservices.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index aee6f1b679..31dfd7d9ce 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -748,8 +748,26 @@ npm i @sap-cloud-sdk/resilience --workspace bookstore ::: details CAP Java: Configure each app for cloud readiness -Add dependency to the **cds-feature-remote-odata** [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) +To access remote OData services, you need to add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, you must include a *com.sap.cloud.sdk.cloudplatform* dependency with artifact ID *scp-cf*, as described in the following steps: [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). +::: code-group +```xml [bookstore/srv/pom.xml] +... + +... + + com.sap.cds + cds-feature-remote-odata + runtime + 4.0.2 + + + + com.sap.cloud.sdk.cloudplatform + scp-cf + +... +``` ::: ### Approuter From a5a9f8843f3b4f801d1df9f9b7a45146bf115779 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 19 Dec 2025 14:45:16 +0100 Subject: [PATCH 05/37] reuse common, data-viewer --- guides/deployment/microservices.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 5c5d8a0d2a..11fce61b81 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -53,9 +53,9 @@ This guide describes a way to manage development and deployment via *[monorepos] git submodule add https://github.com/capire/bookstore-java git submodule add https://github.com/capire/reviews-java git submodule add https://github.com/capire/orders-java - git submodule add https://github.com/capire/common-java + git submodule add https://github.com/capire/common git submodule add https://github.com/capire/bookshop-java - git submodule add https://github.com/capire/data-viewer-java + git submodule add https://github.com/capire/data-viewer git submodule update --init ``` ::: @@ -67,7 +67,6 @@ This guide describes a way to manage development and deployment via *[monorepos] ``` > The outcome of this looks and behaves exactly as the monorepo layout in *[cap/samples](https://github.com/capire/samples)*, so we can exercise the subsequent steps in there... - 3. Test-drive locally: ::: code-group @@ -232,7 +231,7 @@ This section is about how to deploy all 3+1 projects at once with a common _mta. For Node.js, [@capire/samples](https://github.com/capire/samples#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. -TODO For CAP Java, [@capire/samples-java](https://github.com/capire/samples-java#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. +For CAP Java, [@capire/samples-java](https://github.com/capire/samples-java#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. ### Deployment Descriptor @@ -640,7 +639,7 @@ Create a new file named event-mesh.json to store the configuration for enterpris ``` ::: -Add messaging resource in mta.yaml with parametrized `emname` and `namespace` properties: +Add a messaging resource in mta.yaml with parameterized `emname` and `namespace` properties: ::: code-group ```yaml [mta.yaml] From 50b1880738dc435005d15a57f2fefe4243b222ae Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 19 Dec 2025 14:53:16 +0100 Subject: [PATCH 06/37] small improvements --- guides/deployment/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 11fce61b81..0670e74b47 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -607,7 +607,6 @@ Create a new file named event-mesh.json to store the configuration for enterpris { "version": "1.1.0", "emname": "samples-emname", // [!code --] - "version": "1.1.0", "namespace": "default/samples/1", // [!code --] "options": { "management": true, @@ -767,6 +766,7 @@ To access remote OData services, you need to add a dependency to the *cds-featur ... ``` + ::: ### App Router From 8df033ab62a5ccd46bda6f47cc217bfc59bf021e Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 19 Dec 2025 14:56:30 +0100 Subject: [PATCH 07/37] improve --- guides/deployment/microservices.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 0670e74b47..14727128d3 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -66,7 +66,6 @@ This guide describes a way to manage development and deployment via *[monorepos] gen ``` > The outcome of this looks and behaves exactly as the monorepo layout in *[cap/samples](https://github.com/capire/samples)*, so we can exercise the subsequent steps in there... - 3. Test-drive locally: ::: code-group @@ -746,7 +745,7 @@ npm i @sap-cloud-sdk/resilience --workspace bookstore ::: details CAP Java: Configure each app for cloud readiness -To access remote OData services, you need to add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, you must include a *com.sap.cloud.sdk.cloudplatform* dependency with artifact ID *scp-cf*, as described in the following steps: [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). +To access remote OData services, add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, include a *com.sap.cloud.sdk.cloudplatform* dependency with artifact ID *scp-cf*, as described in the following steps: [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). ::: code-group ```xml [bookstore/srv/pom.xml] From a1efe3b62ff1002324dab56207ed0b3545807303 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 19 Dec 2025 14:59:44 +0100 Subject: [PATCH 08/37] improve --- guides/deployment/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 14727128d3..40bf88a46a 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -745,7 +745,7 @@ npm i @sap-cloud-sdk/resilience --workspace bookstore ::: details CAP Java: Configure each app for cloud readiness -To access remote OData services, add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, include a *com.sap.cloud.sdk.cloudplatform* dependency with artifact ID *scp-cf*, as described in the following steps: [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). +To access remote OData services, add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, include a *com.sap.cloud.sdk.cloudplatform* dependency with artifact ID *scp-cf*, as described in [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). ::: code-group ```xml [bookstore/srv/pom.xml] From 65023b188fbf28276e429fe792ae06e239eca7b2 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 19 Dec 2025 15:01:30 +0100 Subject: [PATCH 09/37] improve --- guides/deployment/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 40bf88a46a..019fc8cbc9 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -599,7 +599,7 @@ Enable messaging for the modules that use it: #### In CAP Java -Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the `emname` and `namespace` properties, as these will be parameterized dynamically in the mta.yaml file: +Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the `emname` and `namespace` properties, as the mta.yaml file parameterizes these dynamically: ::: code-group ```json [event-mesh.json] From 0b46dc2146fdd0e849f97f05ccebe74f31273246 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 19 Dec 2025 15:03:51 +0100 Subject: [PATCH 10/37] improve --- guides/deployment/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 019fc8cbc9..5525d13048 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -745,7 +745,7 @@ npm i @sap-cloud-sdk/resilience --workspace bookstore ::: details CAP Java: Configure each app for cloud readiness -To access remote OData services, add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, include a *com.sap.cloud.sdk.cloudplatform* dependency with artifact ID *scp-cf*, as described in [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). +To access remote OData services, add a dependency to the *cds-feature-remote-odata* [application plugin](https://cap.cloud.sap/docs/java/developing-applications/building#standard-modules) and provide the latest available version. Additionally, to retrieve destination configurations using the destination service, include a *com.sap.cloud.sdk.cloudplatform* dependency with the *scp-cf* artifact ID, as described in [Cloud SDK Integration](https://cap.cloud.sap/docs/java/cqn-services/remote-services#cloud-sdk-dependencies). ::: code-group ```xml [bookstore/srv/pom.xml] From 7fed5b4c9f5d3d2e6ca4cd2a76dbf75c890d678d Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 22 Dec 2025 11:25:45 +0100 Subject: [PATCH 11/37] change folder names --- guides/deployment/microservices.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 5525d13048..85b45dc95c 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -50,11 +50,11 @@ This guide describes a way to manage development and deployment via *[monorepos] ``` ```sh [Java] git init - git submodule add https://github.com/capire/bookstore-java - git submodule add https://github.com/capire/reviews-java - git submodule add https://github.com/capire/orders-java + git submodule add https://github.com/capire/bookstore-java bookstore + git submodule add https://github.com/capire/reviews-java reviews + git submodule add https://github.com/capire/orders-java orders git submodule add https://github.com/capire/common - git submodule add https://github.com/capire/bookshop-java + git submodule add https://github.com/capire/bookshop-java bookshop git submodule add https://github.com/capire/data-viewer git submodule update --init ``` @@ -67,7 +67,7 @@ This guide describes a way to manage development and deployment via *[monorepos] ``` > The outcome of this looks and behaves exactly as the monorepo layout in *[cap/samples](https://github.com/capire/samples)*, so we can exercise the subsequent steps in there... 3. Test-drive locally: - + ::: code-group ```sh [Node.js] npm install From de4a3a5831cc45d8fc145af7e050d11201a2c3c1 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 22 Dec 2025 11:51:19 +0100 Subject: [PATCH 12/37] improve --- guides/deployment/microservices.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 85b45dc95c..721f458691 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -150,22 +150,34 @@ These are the (not so beneficial) side effects you when using a shared persisten cds init shared-db --add hana ``` - ```sh + ::: code-group + ```sh [Node.js] npm add --workspace shared-db @capire/bookstore npm add --workspace shared-db @capire/reviews npm add --workspace shared-db @capire/orders ``` + ```sh [Java] + npm add --workspace shared-db @capire/bookstore-java + npm add --workspace shared-db @capire/reviews-java + npm add --workspace shared-db @capire/orders-java + ``` + ::: > Note how *NPM workspaces* allows us to use the package names of the projects, and nicely creates symlinks in *node_modules* accordingly. 2. Add a `shared-db/db/schema.cds` file as a mashup to actually collect the models: ::: code-group - ```cds [shared-db/db/schema.cds] + ```cds [Node-js] using from '@capire/bookstore'; using from '@capire/reviews'; using from '@capire/orders'; ``` + ```cds [Java] + using from '@capire/bookstore-java'; + using from '@capire/reviews-java'; + using from '@capire/orders-java'; + ``` ::: > Note: the `using` directives refer to `index.cds` files existing in the target packages. Your projects may have different entry points. From d6ac2414e7c3f50038e1c868ab6264e48b265b7d Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 22 Dec 2025 11:55:08 +0100 Subject: [PATCH 13/37] typo --- guides/deployment/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 721f458691..547f7dfa6a 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -168,7 +168,7 @@ These are the (not so beneficial) side effects you when using a shared persisten 2. Add a `shared-db/db/schema.cds` file as a mashup to actually collect the models: ::: code-group - ```cds [Node-js] + ```cds [Node.js] using from '@capire/bookstore'; using from '@capire/reviews'; using from '@capire/orders'; From 6d12d8af27169eecfe738287071805b2b67b884c Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 22 Dec 2025 12:19:20 +0100 Subject: [PATCH 14/37] improve --- guides/deployment/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deployment/microservices.md b/guides/deployment/microservices.md index 547f7dfa6a..12ba5e1d74 100644 --- a/guides/deployment/microservices.md +++ b/guides/deployment/microservices.md @@ -611,7 +611,7 @@ Enable messaging for the modules that use it: #### In CAP Java -Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the `emname` and `namespace` properties, as the mta.yaml file parameterizes these dynamically: +Create a new file named event-mesh.json to store the configuration for enterprise messaging. Skip the `emname` and `namespace` properties because the mta.yaml file parameterizes these dynamically: ::: code-group ```json [event-mesh.json] From b4106ae543047a51ab455b24c130c2b7c8da6dc6 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 22 Dec 2025 17:20:27 +0100 Subject: [PATCH 15/37] add service name --- guides/deploy/microservices.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index edf4529ec5..3cc893ce0c 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -733,12 +733,14 @@ cds: kind: enterprise-messaging remote.services: # [!code ++] OrdersService: # [!code ++] + name: sap.capire.orders.api.OrdersService # [!code ++] type: "odata-v4" # [!code ++] http: # [!code ++] suffix: "/odata/v4" # [!code ++] destination: # [!code ++] name: "orders-dest" # [!code ++] ReviewsService: # [!code ++] + name: sap.capire.reviews.api.ReviewsService # [!code ++] type: "odata-v4" # [!code ++] destination: # [!code ++] name: "reviews-dest" # [!code ++] From b30508501166d1da2194423091238f2c89e8d8ee Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 29 Dec 2025 12:24:03 +0100 Subject: [PATCH 16/37] add missing line --- guides/deploy/microservices.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 3cc893ce0c..a828c3c14b 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -401,6 +401,7 @@ modules: builder: custom commands: - mvn clean package -DskipTests=true --batch-mode + build-result: target/*-exec.jar provides: # [!code focus] - name: bookstore-api # [!code focus] properties: From 5a2fa19eabe42e60c95203de8a267d6febf7ef75 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 29 Dec 2025 18:09:17 +0100 Subject: [PATCH 17/37] approuter config --- guides/deploy/microservices.md | 61 +++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index a828c3c14b..6c1f2db1b7 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -869,10 +869,47 @@ modules: ``` ::: -The _xs-app.json_ file describes how to forward incoming request to the API endpoint / OData services and is located in the _.deploy/app-router_ folder. Each exposed CAP Service endpoint needs to be directed to the corresponding application which is providing this CAP service. +The _xs-app.json_ file describes how to forward incoming request to the API endpoint / OData services and is located in the _.deploy/app-router_ folder. Each exposed CAP Service endpoint needs to be directed to the corresponding application which is providing this CAP service. Modify the file _.deploy/app-router/xs-app.json_ as follows: ::: code-group -```json [.deploy/app-router/xs-app.json] +```json [Node.js] +{ + "routes": [ + { // [!code --] + "source": "^/(.*)$", // [!code --] + "target": "$1", // [!code --] + "destination": "srv-api", // [!code --] + "csrfProtection": true // [!code --] + } // [!code --] + { // [!code ++] + "source": "^/admin/", // [!code ++] + "destination": "bookstore-api", // [!code ++] + "csrfProtection": true // [!code ++] + }, // [!code ++] + { // [!code ++] + "source": "^/browse/", // [!code ++] + "destination": "bookstore-api", // [!code ++] + "csrfProtection": true // [!code ++] + }, // [!code ++] + { // [!code ++] + "source": "^/user/", // [!code ++] + "destination": "bookstore-api", // [!code ++] + "csrfProtection": true // [!code ++] + }, // [!code ++] + { // [!code ++] + "source": "^/odata/v4/orders/", // [!code ++] + "destination": "orders-api", // [!code ++] + "csrfProtection": true // [!code ++] + }, // [!code ++] + { // [!code ++] + "source": "^/reviews/", // [!code ++] + "destination": "reviews-api", // [!code ++] + "csrfProtection": true // [!code ++] + } // [!code ++] + ] +} +``` +```json [Java] { "routes": [ { // [!code --] @@ -882,32 +919,32 @@ The _xs-app.json_ file describes how to forward incoming request to the API endp "csrfProtection": true // [!code --] } // [!code --] { // [!code ++] - "source": "^/admin/(.*)$", // [!code ++] - "target": "/admin/$1", // [!code ++] + "source": "^/admin/", // [!code ++] "destination": "bookstore-api", // [!code ++] "csrfProtection": true // [!code ++] }, // [!code ++] { // [!code ++] - "source": "^/browse/(.*)$", // [!code ++] - "target": "/browse/$1", // [!code ++] + "source": "^/browse/", // [!code ++] "destination": "bookstore-api", // [!code ++] "csrfProtection": true // [!code ++] }, // [!code ++] { // [!code ++] - "source": "^/user/(.*)$", // [!code ++] - "target": "/user/$1", // [!code ++] + "source": "^/user/", // [!code ++] "destination": "bookstore-api", // [!code ++] "csrfProtection": true // [!code ++] }, // [!code ++] { // [!code ++] - "source": "^/odata/v4/orders/(.*)$", // [!code ++] - "target": "/odata/v4/orders/$1", // [!code ++] + "source": "^/odata/v4/sap.capire.orders.api.OrdersService/", // [!code ++] "destination": "orders-api", // [!code ++] "csrfProtection": true // [!code ++] }, // [!code ++] { // [!code ++] - "source": "^/reviews/(.*)$", // [!code ++] - "target": "/reviews/$1", // [!code ++] + "source": "^/odata/v4/sap.capire.reviews.app.ReviewsService/", // [!code ++] + "destination": "reviews-api", // [!code ++] + "csrfProtection": true // [!code ++] + }, // [!code ++] + { // [!code ++] + "source": "^/odata/v4/sap.capire.reviews.api.ReviewsService/", // [!code ++] "destination": "reviews-api", // [!code ++] "csrfProtection": true // [!code ++] } // [!code ++] From 89d9cee4519914d1543ada7218e4fda35329a681 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 29 Dec 2025 18:17:15 +0100 Subject: [PATCH 18/37] improve --- guides/deploy/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 6c1f2db1b7..8dc674e7fa 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -869,7 +869,7 @@ modules: ``` ::: -The _xs-app.json_ file describes how to forward incoming request to the API endpoint / OData services and is located in the _.deploy/app-router_ folder. Each exposed CAP Service endpoint needs to be directed to the corresponding application which is providing this CAP service. Modify the file _.deploy/app-router/xs-app.json_ as follows: +The _xs-app.json_ file describes how to forward incoming request to the API endpoint / OData services and is located in the _.deploy/app-router_ folder. Each exposed CAP Service endpoint needs to be directed to the corresponding application that provides this CAP service. Modify the _.deploy/app-router/xs-app.json_ file as follows: ::: code-group ```json [Node.js] From 19944c0bd36f795112fd5e26125babce9ad87b3d Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 20 Feb 2026 15:57:23 +0100 Subject: [PATCH 19/37] update to latest changes --- guides/deploy/microservices.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index c970822178..97f4dbc953 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -734,14 +734,14 @@ cds: kind: enterprise-messaging remote.services: # [!code ++] OrdersService: # [!code ++] - name: sap.capire.orders.api.OrdersService # [!code ++] + name: OrdersService # [!code ++] type: "odata-v4" # [!code ++] http: # [!code ++] suffix: "/odata/v4" # [!code ++] destination: # [!code ++] name: "orders-dest" # [!code ++] ReviewsService: # [!code ++] - name: sap.capire.reviews.api.ReviewsService # [!code ++] + name: ReviewsService # [!code ++] type: "odata-v4" # [!code ++] destination: # [!code ++] name: "reviews-dest" # [!code ++] @@ -934,17 +934,12 @@ The _xs-app.json_ file describes how to forward incoming request to the API endp "csrfProtection": true // [!code ++] }, // [!code ++] { // [!code ++] - "source": "^/odata/v4/sap.capire.orders.api.OrdersService/", // [!code ++] + "source": "^/odata/v4/OrdersService/", // [!code ++] "destination": "orders-api", // [!code ++] "csrfProtection": true // [!code ++] }, // [!code ++] { // [!code ++] - "source": "^/odata/v4/sap.capire.reviews.app.ReviewsService/", // [!code ++] - "destination": "reviews-api", // [!code ++] - "csrfProtection": true // [!code ++] - }, // [!code ++] - { // [!code ++] - "source": "^/odata/v4/sap.capire.reviews.api.ReviewsService/", // [!code ++] + "source": "^/odata/v4/ReviewsService/", // [!code ++] "destination": "reviews-api", // [!code ++] "csrfProtection": true // [!code ++] } // [!code ++] From 76f9b8eb6ac7d02d3be5a845212bb28422816ee3 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 20 Feb 2026 16:08:16 +0100 Subject: [PATCH 20/37] same project structure for both node and java as the java repositories are renamed when adding as submodules --- guides/deploy/microservices.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 97f4dbc953..14f61327c9 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -88,8 +88,7 @@ This guide describes a way to manage development and deployment via *[monorepos] The project structure used here is as follows: -::: code-group -```txt [Node.js] +``` / ├─ bookstore/ ├─ orders/ @@ -97,14 +96,6 @@ The project structure used here is as follows: ├─ ... └─ package.json ``` -```txt [Java] -/ -├─ bookstore-java/ -├─ orders-java/ -├─ reviews-java/ -├─ ... -└─ package.json -``` The individual services (`bookstore`, `reviews`, `orders`) can be one of the following: * folders, committed directly to the root project @@ -114,8 +105,6 @@ Links between the projects are established using NPM dependencies. Since the root project defines workspaces, these dependencies are also found locally without the need for publishing or linking. When one of the projects is cloned in isolation, it's still possible to fetch dependencies to other modules via the NPM registry. -::: - ## Using a Shared Database You can deploy your model to a single database and then share it across applications, if you have one of the following scenarios: From 88e054fe04310dfd191d93fdb60ae263e3fa0841 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 26 Feb 2026 14:44:12 +0100 Subject: [PATCH 21/37] close details --- guides/deploy/microservices.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 14f61327c9..42d5d018be 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -105,6 +105,8 @@ Links between the projects are established using NPM dependencies. Since the root project defines workspaces, these dependencies are also found locally without the need for publishing or linking. When one of the projects is cloned in isolation, it's still possible to fetch dependencies to other modules via the NPM registry. +::: + ## Using a Shared Database You can deploy your model to a single database and then share it across applications, if you have one of the following scenarios: From b2552f12ceebe8f46fd70d7f7da03bacedc2fbb3 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 26 Feb 2026 17:13:36 +0100 Subject: [PATCH 22/37] remove "info `cds build --ws` with Node.js" --- guides/deploy/microservices.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 42d5d018be..28c09f7c90 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -283,16 +283,6 @@ build-parameters: ``` ::: -::: info `cds build --ws` with Node.js -If the CDS models of every NPM workspace contained in the monorepo should be considered, then instead of creating this `shared-db` folder, you can also use: -```shell -cds build --for hana --production --ws -``` -The `--ws` aggregates all models in the NPM workspaces. - -In this walkthrough, we only include a subset of the CDS models in the deployment. -::: - ::: details Node.js: Configure each app for cloud readiness The preceding steps only added configuration to the workspace root. From 3ac92ffd6486d3f6b3a63fa755805987ab271822 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Fri, 27 Feb 2026 15:26:24 +0100 Subject: [PATCH 23/37] unify package names --- guides/deploy/microservices.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 28c09f7c90..72405ebbdd 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -141,35 +141,21 @@ These are the (not so beneficial) side effects you when using a shared persisten cds init shared-db --nodejs --add hana ``` - ::: code-group - ```sh [Node.js] + ```sh npm add --workspace shared-db @capire/bookstore npm add --workspace shared-db @capire/reviews npm add --workspace shared-db @capire/orders ``` - ```sh [Java] - npm add --workspace shared-db @capire/bookstore-java - npm add --workspace shared-db @capire/reviews-java - npm add --workspace shared-db @capire/orders-java - ``` - ::: > Note how *NPM workspaces* allows us to use the package names of the projects, and nicely creates symlinks in *node_modules* accordingly. 2. Add a `shared-db/db/schema.cds` file as a mashup to actually collect the models: - ::: code-group - ```cds [Node.js] + ```cds using from '@capire/bookstore'; using from '@capire/reviews'; using from '@capire/orders'; ``` - ```cds [Java] - using from '@capire/bookstore-java'; - using from '@capire/reviews-java'; - using from '@capire/orders-java'; - ``` - ::: > Note: the `using` directives refer to `index.cds` files existing in the target packages. Your projects may have different entry points. @@ -221,8 +207,6 @@ The project structure used here is as follows: The `shared-db` module is simply another CAP project, with only database content. The dependencies are installed via NPM, so it's still possible to install via an NPM registry if used outside of the monorepo setup. -The database model could also be collected on root level instead of creating a separate `shared-db` module. When collecting on root level, the `cds build --ws` option can be used to collect the models of all NPM workspaces. - ::: ## All-in-one Deployment @@ -441,7 +425,7 @@ modules: In Node.js, add build commands for each module to be prepared for deployment: ::: code-group -```yaml [mta.yaml] +```yaml [Node.js (mta.yaml)] build-parameters: before-all: - builder: custom From 46ae49afd967a60c4499666dcd29257ccf1a157c Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 2 Mar 2026 13:53:12 +0100 Subject: [PATCH 24/37] unify EM queue rules filter --- guides/deploy/microservices.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 72405ebbdd..88de09fb82 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -601,10 +601,10 @@ Create a new file named event-mesh.json to store the configuration for enterpris }, "queueRules": { "publishFilter": [ - "*" + "${namespace}/*" ], "subscribeFilter": [ - "*" + "${namespace}/*" ] } }, From e0e71e853614fb570ad35012fdeea6b0ee27f07e Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 4 Mar 2026 10:33:23 +0100 Subject: [PATCH 25/37] improve Test-drive locally --- guides/deploy/microservices.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 88de09fb82..4ff561309e 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -75,14 +75,11 @@ This guide describes a way to manage development and deployment via *[monorepos] ``` ```sh [Java] npm install - cd bookstore && npm start + cd bookshop + mvn cds:watch ``` ::: - In Node.js, each microservice can be started independently. If you start each microservice, one after the other in a different terminal, the connection is already established. - - [Learn more about Automatic Bindings by `cds watch`](../integration/reuse-and-compose#bindings-via-cds-watch){.learn-more} - ::: details The project structure From 6be11c47db94bd9cf81537cc455cdc1e666aa67f Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Mon, 4 May 2026 16:44:49 +0200 Subject: [PATCH 26/37] review updates --- guides/deploy/microservices.md | 68 ++++++++++++++-------------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 4ff561309e..4fda90ca56 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -156,38 +156,7 @@ These are the (not so beneficial) side effects you when using a shared persisten > Note: the `using` directives refer to `index.cds` files existing in the target packages. Your projects may have different entry points. -::: details Try it out - -With that we're basically done with the setup of the collector project. In sum, it's just another CAP project with some cds models in it, which we can handle as usual. We can test whether it all works as expected, for example, we can test-compile and test-deploy it to sqlite and hana, build it, and deploy it to the cloud as usual: - -```sh -cd shared-db -``` - -```sh -cds compile db -2 sql -``` -```sh -cds compile db -2 hana -``` - -```sh -cds deploy -2 sqlite -``` -```sh -cds build --for hana -``` - -```sh -cd .. -``` - -> Note: As we can see in the output for `cds deploy` and `cds build`, it also correctly collects and adds all initial data from enclosed `.csv` files. -::: - -::: details Other project structures - -The project structure used here is as follows: +:::tip Project Structure ```txt / @@ -206,15 +175,27 @@ The `shared-db` module is simply another CAP project, with only database content ::: +::: details Try it out + +Run a build like in any other CAP project: + +```sh +cd shared-db +cds build --for hana +cd .. +``` + +> Note: As we can see in the output for `cds build`, it also correctly collects and adds all initial data from enclosed `.csv` files. +::: + + ## All-in-one Deployment This section is about how to deploy all 3+1 projects at once with a common _mta.yaml_. ![component diagram with synchronous and event communication for orders](./assets/microservices/bookstore.excalidraw.svg) -For Node.js, [@capire/samples](https://github.com/capire/samples#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. - -For CAP Java, [@capire/samples-java](https://github.com/capire/samples-java#readme) already has an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. +The repositories [@capire/samples](https://github.com/capire/samples#readme) for CAP Node.js and [@capire/samples-java](https://github.com/capire/samples-java#readme) for CAP Java already have an all-in-one deployment implemented. Similar steps are necessary to convert projects with multiple CAP applications into a shared database deployment. ### Deployment Descriptor @@ -268,7 +249,7 @@ build-parameters: The preceding steps only added configuration to the workspace root. -Additionally add database configuration to each module that we want to deploy - bookstore, orders, and reviews: +Additionally [add database configuration](../databases/hana#setup-configuration) to each module that we want to deploy - bookstore, orders, and reviews: ```shell npm i @cap-js/hana --workspace bookstore @@ -278,9 +259,9 @@ npm i @cap-js/hana --workspace reviews ::: -::: details CAP Java: Configure each app for cloud readiness +::: details Java: Configure each app for cloud readiness -For each project add the **cds-starter-cloudfoundry** [starter bundle](https://cap.cloud.sap/docs/java/developing-applications/building#starter-bundles). +For each project [add the cds-feature-hana dependency](../databases/hana#setup-configuration) or the [cds-starter-cloudfoundry starter bundle](../../java/developing-applications/building#starter-bundles). ::: @@ -481,6 +462,11 @@ npm i @sap/xssec --workspace reviews ``` ::: +::: details Java: Configure each app for cloud readiness + +For each project, add the [cds-starter-cloudfoundry starter bundle](../../java/developing-applications/building#starter-bundles). +::: + ### Messaging The messaging service is used to organize asynchronous communication between the CAP services. @@ -689,6 +675,8 @@ modules: cds_requires_OrdersService_credentials: {"destination": "orders-dest","path": "/odata/v4/orders"} # [!code ++] ``` ```yaml [Java (bookstore/srv/src/main/resources/application.yaml)] +spring: + config.activate.on-profile: cloud cds: odataV4.endpoint.path: / messaging.services: @@ -804,10 +792,10 @@ modules: type: approuter.nodejs .... requires: - - name: service-api # [!code --] + - name: srv-api # [!code --] group: destinations # [!code --] properties: # [!code --] - name: service-api # [!code --] + name: srv-api # [!code --] url: ~{srv-url} # [!code --] forwardAuthToken: true # [!code --] - name: orders-api # [!code ++] From f13265992dfe624be4df48e13b37e0966773fb8c Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 9 Sep 2026 11:21:23 +0200 Subject: [PATCH 27/37] run npm install after npm add --- guides/deploy/microservices.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index b1adf810ee..f0c77b4b57 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -141,6 +141,7 @@ These are the (not so beneficial) side effects you when using a shared persisten npm add --workspace shared-db @capire/bookstore npm add --workspace shared-db @capire/reviews npm add --workspace shared-db @capire/orders + npm install ``` > Note how *NPM workspaces* allows us to use the package names of the projects, and nicely creates symlinks in *node_modules* accordingly. From 7e1b4b6c033a683a12d606259124869105893dba Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 9 Sep 2026 11:25:55 +0200 Subject: [PATCH 28/37] cds add hana does not add db folder in root anymore --- guides/deploy/microservices.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index f0c77b4b57..23af42a137 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -215,12 +215,6 @@ Add initial database configuration using the command: cds add hana ``` -Delete the generated _db_ folder as we don't need it on the root level: - -```shell -rm -r db -``` - Update the `db-deployer` path to use our `shared-db` project [created previously](#using-a-shared-database): ::: code-group From 472b3baca4f0c61f8af487f9078eb159bdea2c00 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 9 Sep 2026 11:46:59 +0200 Subject: [PATCH 29/37] update reviews EP --- guides/deploy/microservices.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 23af42a137..6eee8e55f2 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -684,6 +684,8 @@ cds: ReviewsService: # [!code ++] name: ReviewsService # [!code ++] type: "odata-v4" # [!code ++] + http: # [!code ++] + suffix: "/odata/v4" # [!code ++] destination: # [!code ++] name: "reviews-dest" # [!code ++] ``` From bef5ac053806edf427a9fd030e254f903c1b1813 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 9 Sep 2026 11:52:20 +0200 Subject: [PATCH 30/37] cds add approuter directory is already .deploy/app-router --- guides/deploy/microservices.md | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 6eee8e55f2..3388118257 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -736,25 +736,6 @@ cds add approuter The App Router serves the UIs and acts as a proxy for requests toward the different apps. -Since the App Router folder is only necessary for deployment, we move it into a `.deploy` folder. - -```shell -mkdir .deploy -mv app/router .deploy/app-router -``` - -::: code-group -```yaml [mta.yaml] -modules: - ... - - name: samples - type: approuter.nodejs - path: app/router # [!code --] - path: .deploy/app-router # [!code ++] - ... -``` -::: - #### Static Content The App Router can serve static content. Since our UIs are located in different NPM workspaces, we create symbolic links to them as an easy way to deploy them as part of the App Router. From c08c2bdb4996536a0b73401a9bd78e1747bac681 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Wed, 9 Sep 2026 18:19:27 +0200 Subject: [PATCH 31/37] update cds-feature-remote-odata version --- guides/deploy/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 3388118257..b4ddc29b5f 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -714,7 +714,7 @@ To access remote OData services, add a dependency to the *cds-feature-remote-oda com.sap.cds cds-feature-remote-odata runtime - 4.0.2 + 5.1.1 From 303f43fae8717b0bd07ec14f68769e6435b25193 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 10 Sep 2026 03:28:02 +0200 Subject: [PATCH 32/37] enable npm-ci builder --- guides/deploy/microservices.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index b4ddc29b5f..bc0a5da211 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -273,7 +273,7 @@ modules: instances: 1 buildpack: nodejs_buildpack build-parameters: - builder: npm # [!code focus] + builder: npm-ci # [!code focus] provides: # [!code focus] - name: bookstore-api # [!code focus] properties: @@ -291,7 +291,7 @@ modules: instances: 1 buildpack: nodejs_buildpack build-parameters: - builder: npm # [!code focus] + builder: npm-ci # [!code focus] provides: # [!code focus] - name: orders-api # [!code focus] properties: @@ -309,7 +309,7 @@ modules: instances: 1 buildpack: nodejs_buildpack build-parameters: - builder: npm # [!code focus] + builder: npm-ci # [!code focus] provides: # [!code focus] - name: reviews-api # [!code focus] properties: From e70ed807da12a74cab14162cea2f1b94a7cfd5cb Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 10 Sep 2026 03:42:03 +0200 Subject: [PATCH 33/37] remove --production bei cds add xsuaa --- guides/deploy/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index bc0a5da211..fc1413dc80 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -416,7 +416,7 @@ build-parameters: Add [security configuration](../security/authentication) using the command: ```shell -cds add xsuaa --for production +cds add xsuaa ``` Add the admin role From 665034470a157e90d0bf361e80f20ff67e99ebc3 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 10 Sep 2026 04:36:53 +0200 Subject: [PATCH 34/37] Revert "remove --production bei cds add xsuaa" This reverts commit e70ed807da12a74cab14162cea2f1b94a7cfd5cb. --- guides/deploy/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index fc1413dc80..bc0a5da211 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -416,7 +416,7 @@ build-parameters: Add [security configuration](../security/authentication) using the command: ```shell -cds add xsuaa +cds add xsuaa --for production ``` Add the admin role From 085febf071b3b274b4a01e579a936ce8ad9aafd0 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 10 Sep 2026 04:53:29 +0200 Subject: [PATCH 35/37] project structure as details --- guides/deploy/microservices.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index fc1413dc80..531e5cc65c 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -156,7 +156,7 @@ These are the (not so beneficial) side effects you when using a shared persisten > Note: the `using` directives refer to `index.cds` files existing in the target packages. Your projects may have different entry points. -:::tip Project Structure +::: details The project Structure ```txt / @@ -174,7 +174,6 @@ These are the (not so beneficial) side effects you when using a shared persisten The `shared-db` module is simply another CAP project, with only database content. The dependencies are installed via NPM, so it's still possible to install via an NPM registry if used outside of the monorepo setup. ::: - ::: details Try it out Run a build like in any other CAP project: From 52aba785c160fb9e2326f9d89953c2a9539ffcac Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 10 Sep 2026 05:02:05 +0200 Subject: [PATCH 36/37] fix link --- guides/deploy/microservices.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 531e5cc65c..461f87bf7f 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -156,7 +156,7 @@ These are the (not so beneficial) side effects you when using a shared persisten > Note: the `using` directives refer to `index.cds` files existing in the target packages. Your projects may have different entry points. -::: details The project Structure +::: details The project structure ```txt / @@ -242,7 +242,7 @@ build-parameters: The preceding steps only added configuration to the workspace root. -Additionally [add database configuration](../databases/hana#setup-configuration) to each module that we want to deploy - bookstore, orders, and reviews: +Additionally [add database configuration](../databases/hana#setup--configuration) to each module that we want to deploy - bookstore, orders, and reviews: ```shell npm i @cap-js/hana --workspace bookstore From 841810196447e21007de44f719257a50cd0bc442 Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Thu, 10 Sep 2026 05:15:40 +0200 Subject: [PATCH 37/37] fix link --- guides/deploy/microservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/deploy/microservices.md b/guides/deploy/microservices.md index 461f87bf7f..8b77103799 100644 --- a/guides/deploy/microservices.md +++ b/guides/deploy/microservices.md @@ -254,7 +254,7 @@ npm i @cap-js/hana --workspace reviews ::: details Java: Configure each app for cloud readiness -For each project [add the cds-feature-hana dependency](../databases/hana#setup-configuration) or the [cds-starter-cloudfoundry starter bundle](../../java/developing-applications/building#starter-bundles). +For each project [add the cds-feature-hana dependency](../databases/hana#setup--configuration) or the [cds-starter-cloudfoundry starter bundle](../../java/developing-applications/building#starter-bundles). :::