From b1c6ac64ea5b8c0eaf2ddba5e03eeee6e1973fcd Mon Sep 17 00:00:00 2001 From: Vladimir Mikhaylenko Date: Thu, 6 Jul 2023 13:45:49 +0200 Subject: [PATCH 1/7] Update tutorial to CAP Java 2.0 --- .../cp-cap-java-deploy-cf.md | 24 +++++++++------ .../cp-cap-java-security-cf.md | 29 +++++++++++++------ .../cp-cap-java-service-reuse.md | 2 +- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md index b9eef06e68..15caec1e2a 100644 --- a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md +++ b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md @@ -30,22 +30,28 @@ When deploying an application to Cloud Foundry, you can use a manifest to descri 2. Add the following code to the newly created file and make sure you **Save** the file. ```YAML - --- - applications: - - name: bookstore - path: srv/target/bookstore-exec.jar - random-route: true - services: - - bookstore-hana + --- + applications: + - name: bookstore + path: srv/target/bookstore-exec.jar + random-route: true + buildpacks: + - java_buildpack + env: + JBP_CONFIG_OPEN_JDK_JRE: '{ jre: { version: 17.+ }}' + JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}' + SPRING_PROFILES_ACTIVE: cloud + services: + - bookstore-hana ``` -The manifest describes the name of the application and the path where the application archive can be found. Spring Boot applications can be deployed from a single JAR archive, which is what you are making use of here. +The manifest describes the name of the application, the path where the application archive can be found and runtime type. In this tutorial Java Buildpack is used to deploy Spring Boot application from a single JAR archive using Java 17 JRE, which is what you are making use of here. The route of the application, meaning the HTTP endpoint where it will be available, will be randomized to prevent clashes with other application routes. The name of SAP HANA service instance you created in the previous tutorial is used here under the services section (`bookstore-hana`). -When your application will be deployed to SAP BTP, it will use this database to store data instead of the in-memory database. In the previous tutorial you added the additional Java system property `-Dspring-boot.run.profiles=cloud` to your application to ensure that. When deploying the application to Cloud Foundry this is done automatically for you by the Cloud Foundry Java Buildpack. +When your application will be deployed to SAP BTP, it will use this database to store data instead of the in-memory database. In the previous tutorial you added the additional Java system property `-Dspring-boot.run.profiles=cloud` to your application to ensure that. When deploying the application to Cloud Foundry this is via environment variable `SPRING_PROFILES_ACTIVE`. ### Enable application for Cloud Foundry diff --git a/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md b/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md index 39eb64842c..440c06014b 100644 --- a/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md +++ b/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md @@ -61,23 +61,34 @@ The XSUAA security descriptor that describes the roles for your application can "description": "BookStore Administrators", "role-template-references": ["$XSAPPNAME.Administrators"] } - ] + ], + "oauth2-configuration": { + "redirect-uris": ["https://*.cfapps.us10-001.hana.ondemand.com/**"] + } } ``` > You added the name of your application in the attribute `xsappname` and declared a role collection to which you can assign users later. + > The value of the last attribute "oauth2-configuration" depends on the data center where your account is deployed. Check the API URL returned by the command `cf target` and change data center ID in the value `https://*.cfapps.**us10-001**.hana.ondemand.com/**` accordingly. + 4. Open the `manifest.yml` file and add the line `bookstore-xsuaa` under the `services` so that the result looks like this: ```YAML - --- - applications: - - name: bookstore - path: srv/target/bookstore-exec.jar - random-route: true - services: - - bookstore-hana - - bookstore-xsuaa + --- + applications: + - name: bookstore + path: srv/target/bookstore-exec.jar + random-route: true + buildpacks: + - java_buildpack + env: + JBP_CONFIG_OPEN_JDK_JRE: '{ jre: { version: 17.+ }}' + JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}' + SPRING_PROFILES_ACTIVE: cloud + services: + - bookstore-hana + - bookstore-xsuaa ``` With this, your application uses this instance of Authorization and Trust Management Service (XSUAA) to manage authentication of users for your application. You will create the instance with that name in the next step. diff --git a/tutorials/cp-cap-java-service-reuse/cp-cap-java-service-reuse.md b/tutorials/cp-cap-java-service-reuse/cp-cap-java-service-reuse.md index df54ebd461..97e3ba63ea 100644 --- a/tutorials/cp-cap-java-service-reuse/cp-cap-java-service-reuse.md +++ b/tutorials/cp-cap-java-service-reuse/cp-cap-java-service-reuse.md @@ -41,7 +41,7 @@ From the products service that you created in the previous tutorial, we just wan ```Shell/Bash mvn -B archetype:generate -DarchetypeArtifactId=cds-services-archetype -DarchetypeGroupId=com.sap.cds \ - -DarchetypeVersion=RELEASE -DjdkVersion=11 \ + -DarchetypeVersion=RELEASE -DjdkVersion=17 \ -DgroupId=com.sap.cap -DartifactId=bookstore ``` From d37ff72f40bbfd33cb005075ef8e8b3af0db9271 Mon Sep 17 00:00:00 2001 From: Vladimir Mikhaylenko Date: Thu, 6 Jul 2023 13:49:25 +0200 Subject: [PATCH 2/7] Fixed typo --- tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md b/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md index 440c06014b..53f19a1144 100644 --- a/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md +++ b/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md @@ -126,7 +126,7 @@ Open your application in the browser. Using the links on the welcome page you ca To test the secure endpoints of your application, you need a REST client like [Postman](https://www.postman.com/downloads) that supports OAuth 2.0 authentication with type **Authorization Code**. -> Postman may behave differently, when you use SSO to log in to SAP BTP or to a custom identity provider. The following steps assume that you use a Trial account without SSO with the default SAP identity provider. +> Postman may behave differently, when you use SSO to log in to SAP BTP or a custom identity provider. The following steps assume that you use a Trial account without SSO with the default SAP identity provider. 1. To use the `AdminService`, you need to assign yourself to the role collection `BookStore_Administrators` that was defined in the `xs-security.json` file. To assign this role collection to your user you need to navigate to the **Security** **→** **Role Collections** section of your SAP BTP subaccount. Select the `BookStore_Administrators` role collection and choose **Edit**. Enter your email address in the **ID** and **E-Mail** field and choose **Save**. From 1af1b7023b78afd0f22cc21e04739a8e0d0da3c2 Mon Sep 17 00:00:00 2001 From: Vladimir Mikhaylenko Date: Thu, 6 Jul 2023 13:55:56 +0200 Subject: [PATCH 3/7] Rephrased the manifest explanation --- tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md index 15caec1e2a..f3048897a1 100644 --- a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md +++ b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md @@ -45,7 +45,7 @@ When deploying an application to Cloud Foundry, you can use a manifest to descri - bookstore-hana ``` -The manifest describes the name of the application, the path where the application archive can be found and runtime type. In this tutorial Java Buildpack is used to deploy Spring Boot application from a single JAR archive using Java 17 JRE, which is what you are making use of here. +The manifest describes the name of the application, the path where the application archive can be found and runtime type. In this tutorial Java Buildpack is used to deploy Spring Boot application from a single JAR archive using Java 17 JRE. The route of the application, meaning the HTTP endpoint where it will be available, will be randomized to prevent clashes with other application routes. From 7a830c9e97902fb99f14c69d8105f715c9ef0c23 Mon Sep 17 00:00:00 2001 From: Vladimir Mikhaylenko Date: Thu, 6 Jul 2023 16:37:35 +0200 Subject: [PATCH 4/7] Short explanation how to set up HANA cloud --- tutorials/cp-cap-java-hana-db/cp-cap-java-hana-db.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/cp-cap-java-hana-db/cp-cap-java-hana-db.md b/tutorials/cp-cap-java-hana-db/cp-cap-java-hana-db.md index e99cbb357a..4a2188690c 100644 --- a/tutorials/cp-cap-java-hana-db/cp-cap-java-hana-db.md +++ b/tutorials/cp-cap-java-hana-db/cp-cap-java-hana-db.md @@ -65,7 +65,7 @@ First you need to create and initialize an SAP HANA database schema in SAP BTP. You first need to provision your SAP HANA Cloud instance, which is a prerequisite to later on create a SAP HANA HDI Container to deploy your database artifacts to. -1. Follow the tutorial [Provision an Instance of SAP HANA Cloud](hana-cloud-mission-trial-2). Use `bookstore-db` as the name of your database and make sure to allow access to your SAP HANA Cloud from all IPs. +1. Follow the tutorial [Provision an Instance of SAP HANA Cloud](hana-cloud-mission-trial-2). Use `bookstore-db` as the name of your database. Make sure to allow access to your SAP HANA Cloud from all IPs and that instance of the SAP HANA you have created is mapped to your subaccount and space where you working with this tutorial. From f6ed4f42a612e577f4935e0a6eb05f8e2e451bc1 Mon Sep 17 00:00:00 2001 From: Vladimir Mikhaylenko Date: Thu, 6 Jul 2023 16:49:01 +0200 Subject: [PATCH 5/7] Cosmetics --- tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md index f3048897a1..d472bcb3cc 100644 --- a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md +++ b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md @@ -45,7 +45,7 @@ When deploying an application to Cloud Foundry, you can use a manifest to descri - bookstore-hana ``` -The manifest describes the name of the application, the path where the application archive can be found and runtime type. In this tutorial Java Buildpack is used to deploy Spring Boot application from a single JAR archive using Java 17 JRE. +The manifest describes the name of the application, the path where the application archive can be found and runtime type. In this tutorial Java Buildpack is used to deploy Spring Boot application from a single JAR archive using Java 17. The route of the application, meaning the HTTP endpoint where it will be available, will be randomized to prevent clashes with other application routes. From 00da44f68db04f6974468e2d93fc1199f737e4ad Mon Sep 17 00:00:00 2001 From: Vladimir Mikhaylenko Date: Thu, 6 Jul 2023 16:49:41 +0200 Subject: [PATCH 6/7] Typo fixed --- tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md index d472bcb3cc..89838974b0 100644 --- a/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md +++ b/tutorials/cp-cap-java-deploy-cf/cp-cap-java-deploy-cf.md @@ -51,7 +51,7 @@ The route of the application, meaning the HTTP endpoint where it will be availab The name of SAP HANA service instance you created in the previous tutorial is used here under the services section (`bookstore-hana`). -When your application will be deployed to SAP BTP, it will use this database to store data instead of the in-memory database. In the previous tutorial you added the additional Java system property `-Dspring-boot.run.profiles=cloud` to your application to ensure that. When deploying the application to Cloud Foundry this is via environment variable `SPRING_PROFILES_ACTIVE`. +When your application will be deployed to SAP BTP, it will use this database to store data instead of the in-memory database. In the previous tutorial you added the additional Java system property `-Dspring-boot.run.profiles=cloud` to your application to ensure that. When deploying the application to Cloud Foundry this is set with environment variable `SPRING_PROFILES_ACTIVE`. ### Enable application for Cloud Foundry From 4ab43b0b109cd57c7a05cb40adca51283a3f2e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Wed, 12 Jul 2023 12:46:13 +0200 Subject: [PATCH 7/7] Update tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md --- tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md b/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md index 53f19a1144..2a6208ae4b 100644 --- a/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md +++ b/tutorials/cp-cap-java-security-cf/cp-cap-java-security-cf.md @@ -70,7 +70,7 @@ The XSUAA security descriptor that describes the roles for your application can > You added the name of your application in the attribute `xsappname` and declared a role collection to which you can assign users later. - > The value of the last attribute "oauth2-configuration" depends on the data center where your account is deployed. Check the API URL returned by the command `cf target` and change data center ID in the value `https://*.cfapps.**us10-001**.hana.ondemand.com/**` accordingly. + > The value of the last attribute "oauth2-configuration" depends on the landscape where your account is deployed. Check the API URL returned by the command `cf target` and change data center ID in the value `https://*.cfapps.**us10-001**.hana.ondemand.com/**` accordingly. 4. Open the `manifest.yml` file and add the line `bookstore-xsuaa` under the `services` so that the result looks like this: