This repository has been archived by the owner on Oct 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update versions and adapt instructions for trial (#11)
Updated CDS Services versions to 1.2.0 and performed necessary code changes. Updated instructions to explain how to use CloudPlatform Trial accounts. Therefore also removed reference to XXX or other instructor provided details.
- Loading branch information
1 parent
8d13eaa
commit 025d5eb
Showing
5 changed files
with
41 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,20 @@ | |
|
||
In the last exercise you have added custom coding to your bookstore application. In this exercises you will make the application ready to be deployed to the cloud. In order to make our application cloud-ready, we'll switch to SAP HANA as our database. | ||
|
||
## Creating a CloudFoundry Trial account | ||
|
||
The following two exercises require access to an SAP Cloud Platform account with a Subaccount for the Cloud Foundry environment. | ||
The subaccount needs to have the following entitlements assigned to it: | ||
|
||
1. Service: 'SAP HANA Schemas & HDI Containers' or Service 'SAP HANA Schemas & HDI Containers (Trial)' | ||
Plan: 'hdi-shared' | ||
Quota: 1 Unit | ||
2. Service: 'Application Runtime' | ||
Plan: 'MEMORY' | ||
Quota: 1 GiB | ||
|
||
You can use a free trial account for this. Please follow [this tutorial](https://developers.sap.com/tutorials/hcp-create-trial-account.html) to create a free trial account. | ||
|
||
## Initializing the SAP HANA database | ||
|
||
First you need to create and initialize a SAP HANA database schema in the cloud. As you will deploy your application to SAP Cloud Platform Cloud Foundry Environment, you will also create the SAP HANA service there. | ||
|
@@ -12,19 +26,17 @@ Login to the Cloud Foundry Environment using the cf CLI: | |
|
||
2. Run `cf api <CF_API>` in the terminal. | ||
|
||
The `<CF_API>` endpoint will be provided to you by your instructor. | ||
The `<CF_API>` endpoint can be obtained from the Overview page of your Subaccount in Cloud Cockpit. | ||
|
||
3. Run `cf login` and authenticate using the login credentials provided to you by your instructor. | ||
3. Run `cf login` and authenticate using your login credentials. | ||
|
||
Initializing the SAP HANA database is now as simple as running these commands in the terminal: | ||
|
||
1. Make sure that you are in the root of the bookstore project: `cd ~/projects/bookstore` | ||
|
||
2. Run `npm install --save-dev --save-exact @sap/[email protected]` | ||
|
||
3. Run `cds deploy --to hana:bookstore-hana-<XXX>` | ||
|
||
Replace `<XXX>` with the number given to you by your instructor | ||
3. Run `cds deploy --to hana:bookstore-hana` | ||
|
||
With this command, you've created an SAP HANA service instance. In addition, the command initialized the database schemas inside the SAP HANA HDI container. | ||
|
||
|
@@ -51,11 +63,11 @@ The described features are available as a plugin in CAP Java. Therefore, we'll a | |
|
||
3. Make sure that you are in the root of the bookstore project: `cd ~/projects/bookstore` | ||
|
||
4. Let's test the SAP HANA connectivity. Start your application by running `mvn spring-boot:run -Dspring.profiles.active=cloud` | ||
4. Let's test the SAP HANA connectivity. Start your application by running `mvn spring-boot:run -Dspring-boot.run.profiles=cloud` | ||
|
||
> Note: The Java system property `-Dspring.profiles.active=cloud` ensures that the default configuration using SQLite as the database, which is still defined in the `application.yaml`, does not get activated. | ||
> Note: The Java system property `-Dspring-boot.run.profiles=cloud` ensures that the default configuration using SQLite as the database, which is still defined in the `application.yaml`, does not get activated. | ||
5. You can observe the log lines `Loaded default-env.json from directory '/home/user/projects/bookstore'` and `Registered 'DataSource' bean definition for connected service 'bookstore-hana-<XXX>'` which indicate that the SAP HANA configuration was picked up. | ||
5. You can observe the log lines `Loaded default-env.json from directory '/home/user/projects/bookstore'` and `Registered primary 'DataSource' bean definition for connected service 'bookstore-hana'` which indicate that the SAP HANA configuration was picked up. | ||
|
||
6. Try the following example request, which creates an order together with it's items through a deep insert: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters