You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- description --> Deploy your SAP HANA Cloud and Cloud Application Programming Model application as a Multi-Target Application (MTA) to SAP BTP, Cloud Foundry runtime
10
11
11
12
## Prerequisites
12
-
- This tutorial is designed for SAP HANA Cloud. It is not designed for SAP HANA on premise or SAP HANA, express edition.
13
-
- You have completed all previous tutorials in this Mission or have at least developed up to the point of [adding User Authentication to your application](hana-cloud-cap-add-authentication).
14
13
14
+
- This tutorial is designed for SAP HANA Cloud. It is not designed for SAP HANA on premise or SAP HANA, express edition.
15
+
- You have completed all previous tutorials in this Mission or have at least developed up to the point of [adding User Authentication to your application](hana-cloud-cap-add-authentication).
15
16
16
17
## You will learn
17
-
- You will prepare our project for deployment via Multi Target Application to SAP BTP, Cloud Foundry runtime
18
-
- You will use the Cloud MTA Build tool to package your project for deployment
19
-
- You will deploy your application to SAP BTP, Cloud Foundry runtime
18
+
19
+
- You will prepare our project for deployment via Multi Target Application to SAP BTP, Cloud Foundry runtime
20
+
- You will use the Cloud MTA Build tool to package your project for deployment
21
+
- You will deploy your application to SAP BTP, Cloud Foundry runtime
20
22
21
23
## Intro
24
+
22
25
Note: This is an optional tutorial as part of this mission on SAP HANA Cloud plus Cloud Application Programming Model for those that want to fully deploy like a production application. There are limited resources allocated in an SAP BTP trial or free tier account and you should consider deleting this content after deploying to avoid using up all of these resources.
23
26
24
27
---
25
28
26
29
### Project final adjustments and preparations
27
30
28
-
29
31
1. In this tutorial mission we've combined several different development types (HANA, CAP, Fiori) and wizards into a single project. This has required several workarounds to the project structure to make it all work together. Furthermore we will need a few more adjustments before we can deploy the complete application.
30
32
31
-
2. We will begin with the `xs-security.json` file. We need to make one adjustments to this file. Remember that we added the `oauth2-configuration` section to allow authentication redirection from the SAP Business Application Studio testing. We want to remove this configuration so that we will instead get the standard UAA `oAuth` configuration. The `xs-security.json` file should now look like this:
32
-
33
-
```JSON
34
-
{
35
-
"xsappname": "myhanaapp",
36
-
"tenant-mode": "dedicated",
37
-
"description": "Security profile of called application",
38
-
"scopes": [
39
-
{
40
-
"name": "uaa.user",
41
-
"description": "UAA"
42
-
}
43
-
],
44
-
"role-templates": [
45
-
{
46
-
"name": "Token_Exchange",
47
-
"description": "UAA",
48
-
"scope-references": [
49
-
"uaa.user"
50
-
]
51
-
}
52
-
]
53
-
}
54
-
```
55
-
56
-
6. The rest of the adjustments we need to make are all in the `mta.yaml` file in the root of the project. This is the file that will control the build and deployment of the application.
57
-
58
-
7. The first adjustment we want to make is to the database module section. We added `default-env.json` and `.env` files to the project so that we could deploy and test from the SAP Business Application Studio. However we don't want these files to be present in a "real" deployment, instead getting configuration from the bound service instances. Therefore we can tell the builder to exclude these files from this module. That way we can keep these files in our project for future testing and development but ensure that they don't accidentally make it into a production deployment.
33
+
1. We will begin with the `xs-security.json` file. We need to make one adjustments to this file. Remember that we added the `oauth2-configuration` section to allow authentication redirection from the SAP Business Application Studio testing. We want add a similar redirection allowance for when our application will be running from SAP BTP Cloud Foundry, environment. Add a line for `https://*.hana.ondemand.com/**`. Your `xs-security.json` should now look like this:
1. The rest of the adjustments we need to make are all in the `mta.yaml` file in the root of the project. This is the file that will control the build and deployment of the application.
38
+
39
+
1. The first adjustment we want to make is to the database module section. We added `default-env.json` and `.env` files to the project so that we could deploy and test from the SAP Business Application Studio. However we don't want these files to be present in a "real" deployment, instead getting configuration from the bound service instances. Therefore we can tell the builder to exclude these files from this module. That way we can keep these files in our project for future testing and development but ensure that they don't accidentally make it into a production deployment.
8. The next adjustment to `mta.yaml` is rather substantial. There are different ways to deploy the UI content of our project. We could use standalone application router, managed application router, Fiori launchpad, and/or the HTML5 repository. The wizard that we've used previously setup our project to use a standalone application router but also the HTML5 repository. For your project needs you might decide on different combination of these options and you should explore the impact that each choice has on your deployment approach. However for this tutorial, we've chosen to stay with the standalone application router, but not to use the HTML5 repository. This is a choice that simplifies the setup and is good for small scale applications where you don't mind keeping the UI5 content local within the application router service itself. Therefore we can simply remove all the references and dependencies to the HTML5 Repository and UI Deployer in your `mta.yaml` file.
43
+
1. The next adjustment to `mta.yaml` is rather substantial, **but please note**: you might not need to make these changes. Depending upon which tutorial you are following up to this point, these sections might not exist in your `mta.yaml`. That's fine. If the section that we ask you to remove are already missing, then simply move onto the next steps. There are different ways to deploy the UI content of our project. We could use standalone application router, managed application router, Fiori launchpad, and/or the HTML5 repository. The wizard that we've used previously setup our project to use a standalone application router but also the HTML5 repository. For your project needs you might decide on different combination of these options and you should explore the impact that each choice has on your deployment approach. However for this tutorial, we've chosen to stay with the standalone application router, but not to use the HTML5 repository. This is a choice that simplifies the setup and is good for small scale applications where you don't mind keeping the UI5 content local within the application router service itself. Therefore we can simply remove all the references and dependencies to the HTML5 Repository and UI Deployer in your `mta.yaml` file.
63
44
64
45
<!-- border -->
65
46
66
47
Note: If you wanted to keep the HTML5 repository, then some additional changes to the build parameters of the UI Deployer and to the xs-app.json of the application router would be necessary.
67
48
68
-
9. The last adjustment is a continuation of the previous step. We need to also remove all references to the HTML Repo and UI Deployer from the resources section of the `mta.yaml` file as well.
49
+
1. The last adjustment is a continuation of the previous step. We need to also remove all references to the HTML Repo and UI Deployer from the resources section of the `mta.yaml` file as well.
69
50
70
51
<!-- border -->
71
52
72
-
73
53
### Use the Cloud MTA Build tool to package your project for deployment
74
54
75
-
76
55
1. Now that all of our project adjustments are complete, we can use the Cloud MTA Build tool to package the project for deployment.
77
56
78
-
2. Open a terminal window in SAP Business Application Studio and from the root folder of your project issue the command `mbt build`
57
+
1. Open a terminal window in SAP Business Application Studio and from the root folder of your project issue the command `mbt build`
79
58
80
59
<!-- border -->
81
60
82
-
3. This will take several minutes as various build steps are performed (such as running npm install on each module) to prepare the project for deployment. The output of this command will be a zip archive with the extension `MTAR` in a new folder of your project named `mta_archives`.
61
+
1. This will take several minutes as various build steps are performed (such as running npm install on each module) to prepare the project for deployment. The output of this command will be a zip archive with the extension `MTAR` in a new folder of your project named `mta_archives`.
83
62
84
63
<!-- border -->
85
64
86
-
4. Not required as part of the deploy process, but it might be interesting to see what is inside this `MTAR` file. You can download the file to your desktop and then open with an zip archive tool. In the root of the zip you will find folders (with zip files inside them) for the three modules we described in your mta.yaml file. Looking at the MTAR file in a zip utility is a good way to double check and make sure that your content is structured the way you wanted (and that your build-parameters exclusions worked) before attempting to deploy to Cloud Foundry.
65
+
1. Not required as part of the deploy process, but it might be interesting to see what is inside this `MTAR` file. You can download the file to your desktop and then open with an zip archive tool. In the root of the zip you will find folders (with zip files inside them) for the three modules we described in your mta.yaml file. Looking at the MTAR file in a zip utility is a good way to double check and make sure that your content is structured the way you wanted (and that your build-parameters exclusions worked) before attempting to deploy to Cloud Foundry.
### Deploy your application to SAP BTP, Cloud Foundry runtime
94
70
95
-
96
71
1. Now we are ready to deploy our entire project to SAP BTP, Cloud Foundry runtime. Although you can perform the deployment from the command line using the `cf deploy` command, you can also trigger it from the SAP Business Application Studio just by right mouse click on the MTAR file and choosing **Deploy MTA Archive**.
97
72
98
73
<!-- border -->
99
74
100
-
2. If you start the deploy and immediately receive this error don't be alarmed.
75
+
1. If you start the deploy and immediately receive this error don't be alarmed.
This just means that your login to Cloud Foundry has expired (which it does daily). From the Business Application Studio you can click on the **Targeting CF** section in the bottom bar or from any terminal window use the `cf login` command to renew your login credentials. Then you can repeat the deployment.
105
80
106
-
3. Otherwise your deploy should continue as normal. It will take several minutes to complete. You should see services being created from the resources section of the mta.yaml first then applications from the modules section of the mta.yaml.
81
+
1. Otherwise your deploy should continue as normal. It will take several minutes to complete. You should see services being created from the resources section of the mta.yaml first then applications from the modules section of the mta.yaml.
107
82
108
83
<!-- border -->
109
84
110
-
4. Upon successful completion of the MTAR deployment, you should be able to navigate to your space and applications in the SAP BTP Cockpit and see the three deployed applications. It is normal that the database deployer would be in a state of stopped. A deployer is an application that only needs to run upon deployment to send it's content somewhere (SAP HANA in this case). The application then shutdown and no longer consume resources.
85
+
1. Upon successful completion of the MTAR deployment, you should be able to navigate to your space and applications in the SAP BTP Cockpit and see the three deployed applications. It is normal that the database deployer would be in a state of stopped. A deployer is an application that only needs to run upon deployment to send it's content somewhere (SAP HANA in this case). The application then shutdown and no longer consume resources.
111
86
112
87
<!-- border -->
113
88
114
-
5. If either of other two application have bad requested state or their instances are not 1/1 then there may have been an error during deployment. If so continue to the next step where we will see how to view the Logs.
89
+
1. If either of other two application have bad requested state or their instances are not 1/1 then there may have been an error during deployment. If so continue to the next step where we will see how to view the Logs.
115
90
116
-
6. If you click on the name of the app, you will navigate to a detail screen for each application. From here you can access the URL for your application or view the Logs if there was some startup error.
91
+
1. If you click on the name of the app, you will navigate to a detail screen for each application. From here you can access the URL for your application or view the Logs if there was some startup error.
7. Remember to test via the Application Router as only that application will have the redirect to the Login Screen to generate the security token. But other than the different URLs everything should work the same as when we tested with authorization from the SAP Business Application Studio. Also because the database container was deployed to a new HDI container instance; you will need to return to the Database Explorer, connect to this new instance and load the data from CSV files.
121
-
122
-
95
+
1. Remember to test via the Application Router as only that application will have the redirect to the Login Screen to generate the security token. But other than the different URLs everything should work the same as when we tested with authorization from the SAP Business Application Studio. Also because the database container was deployed to a new HDI container instance; you will need to return to the Database Explorer, connect to this new instance and load the data from CSV files.
0 commit comments