Skip to Content
Author's profile photo Amita Patnaik

Deploying a MTAR application on SAP Cloud platform Cloud Foundry account with a dedicated HANA database and multiple tenant databases

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 !!

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo SUMAIYA P K
      SUMAIYA P K

      Hi Amita

       

      Thank you for such a detailed explanation.

      It was very helpful. 🙂

      Author's profile photo Sindy Zhan
      Sindy Zhan

      Hi Amita,

      Thank you for your blog!

      Do you know what might go wrong if I got the error "FAILED
      Could not get access token: not a compact JWS"?

      Author's profile photo Petros Yannoutsos
      Petros Yannoutsos

      HI Sindy, did you ever resolve this as I am experiencing the same issue?

      Author's profile photo Neha Kumari
      Neha Kumari

      Hi Petros Yannoutsos , did you find a solution to this error earlier?

      Author's profile photo Petros Yannoutsos
      Petros Yannoutsos

      Hi Neha,

      I did not... I need to revisit it when I get some time again.

      Author's profile photo Alix PELLETIER
      Alix PELLETIER

      Hi Sindy, Petros and Neha,

      I am arriving a bit late 🙂 but if you are deploying the MTA archive from the terminal, you first need to login.

      => cf login => you will need to enter the api endpoint, your email & password, and then you will be able to deploy.

      Kind regards,

      Alix.

      Author's profile photo Harshad Porwal
      Harshad Porwal

      Hi Sindy,

       

      I was also facing the same error. You need to login to Cloud foundary before deploying you app.

      In the bottom left corner you will see a message that you have not logged into cloud foundary while deploying. You can click on that message and try to login to your cloud foundary account.

       

      Hope this helps

       

      Kind Regards,

      Harshad