Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
amita_patnaik
Explorer
Hello Viewers,

This blog will be useful for users, who are looking to deploy an Multi Target Application (MTA) on CF account having a dedicated HANA database with multiple tenant databases.

It is in continuation to my first blog Sharing tenant database in sap cloudplatform cloud foundry

Multi Target Application/MTA  is a single application comprising of multiple dependent and interdependent modules , developed using different technologies,programming models and is designed to run on different runtime environment with a single common lifecycle.

With a user account on SAP Cloud-platform Cloud Foundry having a dedicated Hana database system, the user has an option to create multiple Tenant databases.  For each of these tenant DB’s, permissions can be granted for each individual spaces. These permissions allow hosting of MTA applications in the assigned space.

In such a scenario, if one tries to deploy an MTA application via cli cmd tool, the deployment of the MTAR file will fail with 502 Bad Gateway error as in the screenshot below.



The deployment fails while creating the Hana service, as multiple tenant databases are available and so an exact tenant database id needs to be specified to which the service instance should connect.

The issue can be resolved by specifying the database id during the deployment.

The database id is specified in  MTA extension descriptor file , an extension of MTA development descriptor.

 

A brief overview on MTA development descriptor and MTA Extension descriptor file.

 MTA Development descriptor file:



  • It is a yaml file(mta.yaml) which defines the elements and dependencies of a MTA application.

  • Contains a list of all entities, such as modules, resources, and properties that belong to an application or are used by it at runtime, and the dependencies between them.


Example of MTA Descriptor Sample:


 MTA Extension descriptor file:



  • A YAML file that contains data complementary to the deployment descriptor.

  • The data can be without a lifecycle, specially encoded, and security-sensitive like credentials and passwords.

  • The syntax has the same structure as the deployment descriptor.

  • It can add or overwrite existing data if necessary.


The extension descriptor is defined in a separate file with an extension .mtaext

Example of Basic Extension Descriptor file:



The above sample :

  • Validates the extension descriptor against the MTA version and Extends the deployment descriptor by its ID for resource DemoApphdi-container.

  • Provides a new parameter database-id, under resources-> parameters -> config for the specific resource DemoApphdi-container.

  • Overwrite the data for the existing-data property from MTA descriptor to new-value.

  • Adds a new data called non-existing-data to DemoApphdi-container properties.


For syntax check, you can use yaml validator -> http://www.yamllint.com/ , to verify the syntax of the extension descriptor file like indentations.

Note : The descriptor file has to be in the same folder where the MTA file is located.

 

Deployment in SAP CF environment: 


Now let us move to the next steps on how to deploy the MTA file using the extension app descriptor on SAP CF.

Pre-requisites:


- Install cf cli cmd tool for executing the cf commands.

Link to download : https://github.com/cloudfoundry/cli/releases

Unpack the zip file and run the cf executable file. When prompted choose Install.

In order to make sure CLI is installed correctly, open the command prompt.

Type cf help.

The command should list a set of available commands for cf.

 

- Install MTA CF CLI plugin corresponding to your operating system.

Link to download:  tools.hana.ondemand.com

Once download, run the below command on cf cli cmd prompt to install the plugin.

cf install-plugin <path to plugin download folder>/<cf-cli-mta-plugin name.exe|tar.gz>

 

- MTAR file (Multi target application archive)  of the developed application.

 

Navigate to the required space where you want to deploy the application. For the required commands, you can refer to my blog:

Blog1: sharing tenant database in sap cloudplatform cloud foundry

Once you have navigated to the relevant space, navigate to the  MTA deployment folder in your local system, by executing the command cd < MTAR folder path>

To deploy, use the cf command :

cf deploy <Appname>.mtar -e <extension_descriptor>.mtaext

<Appname> -> MTAR application name

<extension_descriptor> -> Name of the extension descriptor file.

 

More info on the CF Deploy syntax :



Looking forward to your comments 🙂

Thank You !!
7 Comments