Skip to content

Commit fb08735

Browse files
committed
Fix MTA Deploy Tutorial
1 parent c66a360 commit fb08735

2 files changed

Lines changed: 26 additions & 53 deletions

File tree

tutorials/hana-cloud-cap-deploy-mta/hana-cloud-cap-deploy-mta.md

Lines changed: 26 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,119 +6,92 @@ primary_tag: products>sap-hana-cloud
66
---
77

88
# Deploy CAP with SAP HANA Cloud project as MTA
9+
910
<!-- description --> Deploy your SAP HANA Cloud and Cloud Application Programming Model application as a Multi-Target Application (MTA) to SAP BTP, Cloud Foundry runtime
1011

1112
## 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).
1413

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).
1516

1617
## 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
2022

2123
## Intro
24+
2225
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.
2326

2427
---
2528

2629
### Project final adjustments and preparations
2730

28-
2931
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.
3032

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:
34+
35+
<!-- border -->![xs-security.json adjustments](xs_security_adjust3.png)
36+
37+
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.
5940

6041
<!-- border -->![mta.yaml database module build parameters](mta_db_adjustments.png)
6142

62-
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.
6344

6445
<!-- border -->![Remove UI Deployer and HTML5 Repo from mta.yaml services](mta_approuter_adjustments.png)
6546

6647
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.
6748

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.
6950

7051
<!-- border -->![Remove UI Deployer and HTML5 Repo from mta.yaml resources](mta_resources_adjustments.png)
7152

72-
7353
### Use the Cloud MTA Build tool to package your project for deployment
7454

75-
7655
1. Now that all of our project adjustments are complete, we can use the Cloud MTA Build tool to package the project for deployment.
7756

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`
7958

8059
<!-- border -->![mbt build](mbt_build.png)
8160

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`.
8362

8463
<!-- border -->![mtar in project output](mtar_in_project.png)
8564

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.
8766

8867
<!-- border -->![MTAR Inner Content](mtar_inner_content.png)
8968

90-
91-
92-
9369
### Deploy your application to SAP BTP, Cloud Foundry runtime
9470

95-
9671
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**.
9772

9873
<!-- border -->![Deploy MTA Archive](mtar_deploy_from_ui.png)
9974

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.
10176

10277
<!-- border -->![Deploy Error](mtar_deploy_error_login.png)
10378

10479
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.
10580

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.
10782

10883
<!-- border -->![Deploy log](mtar_deploy_log.png)
10984

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.
11186

11287
<!-- border -->![SAP BTP Cockpit Applications after Deploy](cockpit_after_deploy.png)
11388

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.
11590

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.
11792

11893
<!-- border -->![SAP BTP Cockpit application detail](cockpit_app_url.png)
11994

120-
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.
12396

12497
---
46.1 KB
Loading

0 commit comments

Comments
 (0)