Skip to content

Commit 6b9b286

Browse files
committed
Automatic commit: Move 'cap-extend-sfsf-deploy-hc' from QA to Production
1 parent ab4a608 commit 6b9b286

9 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: Deploy the SAP SuccessFactors Extension Database to SAP HANA Cloud
3+
description: In this phase of the development you will deploy the extension database to SAP HANA Cloud.
4+
auto_validation: true
5+
time: 7
6+
tags: [ tutorial>beginner, software-product>sap-btp--cloud-foundry-environment]
7+
primary_tag: software-product-function>sap-cloud-application-programming-model
8+
---
9+
10+
## Prerequisites
11+
- Complete the tutorial: [**Prepare to Develop the SAP SuccessFactors Extension**](cap-extend-sfsf-intro)
12+
- Complete the tutorial: [**Jump start the SAP SuccessFactors Extension CAP Project**](cap-extend-sfsf-jumpstart)
13+
- Complete the tutorial: [**Import SAP SuccessFactors OData Services definitions**](cap-extend-sfsf-import-services)
14+
- Complete the tutorial: [**Create the CDS Data Model for the SAP SuccessFactors Extension**](cap-extend-sfsf-data-model)
15+
- Complete the tutorial: [**Create the CAP Service for the SAP SuccessFactors Extension**](cap-extend-sfsf-create-service)
16+
- Complete the tutorial: [**Add Business Logic to the SAP SuccessFactors Extension**](cap-extend-sfsf-add-logic)
17+
- Complete the tutorial: [**Prepare the SAP SuccessFactors Extension UI with CDS Annotations**](cap-extend-sfsf-ui-annotations)
18+
- Complete the tutorial: [**Add Security to the SAP SuccessFactors Extension**](cap-extend-sfsf-add-security)
19+
20+
## Details
21+
### You will learn
22+
- How to **setup your project for SAP HANA**
23+
- How to **deploy the database to SAP HANA Cloud**
24+
- How to work with a "**hybrid approach**" (database in the cloud and application running locally)
25+
26+
---
27+
28+
[ACCORDION-BEGIN [Step 1: ](Setup Project for SAP HANA)]
29+
30+
So far, all data persistence of your application has been utilizing a **default `SQLite` in-memory database**, which means that, each time you restart the application, all data that has been added/updated is completely lost.
31+
32+
It might be OK for local development, but when it goes to a cloud landscape (either development, QA or production) the **data must be persisted** in a **standard relational database** such as **SAP HANA Cloud** (which is going to be the selected database for your application).
33+
34+
Therefore, it's now time to prepare your project to deploy the data model to **SAP HANA Cloud** when it goes to BTP. For that, you must **add the appropriate dependencies** to your project using the `cds add` command.
35+
36+
In the **Terminal** type `cds add hana` and press **Enter**.
37+
38+
![Figure 1 – Add SAP HANA dependencies to project](dependencies.png)
39+
40+
On the **left-hand pane** click on the `package.json` file to open it. Examine the contents and notice the modifications in the `dependencies` and `cds.requires` sections and the new `cds.hana` section. Change the `db.kind` from the `cds.requires` section to `hana`.
41+
42+
![Figure 2 – Changes made to package.json](package-json.png)
43+
44+
In the **Terminal** type `npm install` and press **Enter** to install the newly added dependency locally.
45+
46+
![Figure 3 – Install new dependency](install-dep.png)
47+
48+
[DONE]
49+
[ACCORDION-END]
50+
51+
[ACCORDION-BEGIN [Step 2: ](Deploy the Database to SAP HANA Cloud)]
52+
53+
> **IMPORTANT NOTE**: before executing the next steps first make sure:
54+
>
55+
> 1. You are properly **logged to Cloud Foundry** as instructed in **step 2** of the tutorial: [**Jump start the SAP SuccessFactors Extension CAP Project**](cap-extend-sfsf-jumpstart)
56+
> 2. Your SAP HANA Cloud database instance (created following [**this tutorial**](hana-cloud-deploying)) is up and running – remember: on **trial accounts** everything (including **SAP HANA database**) **shuts down overnight**!
57+
58+
In the **Terminal** type `cds deploy –-to hana` and press **Enter**.
59+
60+
![Figure 4 – Deploying to the HANA Cloud database](deploy.png)
61+
62+
It's going to take a while before the command completes as it's performing these operations:
63+
64+
1. **Build** the database artifacts from the CAP project in the **gen folder** that's created under the **project root folder**, for further deployment to SAP HANA Cloud.
65+
2. Create a **service instance** named `sfsf-projman-db` of type **SAP HANA Schemas & HDI Containers** with the `hdi-shared` plan, that handles the **HDI container**
66+
3. Create the **SAP HANA database artifacts from the application** inside the HDI container
67+
4. **Bind the service instance** to the local project by modifying the `default-env.json` file, adding the **database credentials** (actually the **service key** from the **service binding**).
68+
69+
After the command completes, you will have achieved what is called a "**hybrid approach**" where your project runs locally, but the **database** (and the corresponding persistence) **runs in the cloud**.
70+
71+
Take a quick look at the `default-env.json` to verify what happened after command completion: on the **left-hand pane** click on the `default-env.json` file to open it:
72+
73+
![Figure 5 – Changes in default-env.json](default-env.png)
74+
75+
Notice that a `hana` section has been added to the `VCAP_SERVICES` environment variable, with the **service instance name** of the **HDI container** and the **credentials** (service key) to connect to the SAP HANA Cloud database.
76+
77+
If you click on the **Cloud Foundry icon** (small light bulb) on the left-hand pane and **expand the services node**, you'll also see the newly created service instance:
78+
79+
![Figure 6 – HDI container service instance](hdi-service.png)
80+
81+
[DONE]
82+
[ACCORDION-END]
83+
84+
[ACCORDION-BEGIN [Step 3: ](Run Project locally with the Database in the Cloud)]
85+
86+
Now, checkout what happens when you execute the application.
87+
88+
In the **Terminal** type `cds watch` and press **Enter**.
89+
90+
![Figure 7 – Project connected to SAP HANA Cloud database](connect-to-hc.png)
91+
92+
Notice that, now, CDS is **connecting to SAP HANA Cloud** as the persistence mechanism of the application.
93+
94+
Again, in this scenario the **project** is running **locally**, but the **database** is running in the **cloud** (hybrid approach).
95+
96+
If you want to **switch to the `SQLite` in-memory database** again for development, just go back to `package.json` and change the `db.kind` parameter in the `cds.requires` section back to `sql`, and notice that `cds watch` immediately recognizes the change and **switches the connection** to `sqlite` with the `:memory:` credentials:
97+
98+
![Figure 8 – Switching back to SQLite in-memory](sqlite.png)
99+
100+
[DONE]
101+
[ACCORDION-END]
102+
103+
[ACCORDION-BEGIN [Step 4: ](Check Your Knowledge)]
104+
105+
[VALIDATE_1]
106+
[ACCORDION-END]
25.9 KB
Loading
36 KB
Loading
4.74 KB
Loading
7.51 KB
Loading
35.2 KB
Loading
5.3 KB
Loading
12.3 KB
Loading
50.1 KB
Loading

0 commit comments

Comments
 (0)