Multi-Target Application Model (MTA) | Migrating from the Neo Environment to the Multi-Cloud Foundation
|This blog post series is about developing applications in a multi-cloud environment.
For the end-to-end hands-on tutorial example, see
For the step-by-step series, visit
Questions? Post as comment.
Useful? Give us a like and share on social media.
Developing Secure Applications on the SAP Business Technology Platform
In this blog series, we explore authentication and authorisation using XSUAA in the SAP Business Technology Platform, Cloud Foundry environment.
In this blog, we take a side-step and cover the Multi-target Application model (MTA).
You can download the sample code from repository
Multi-Target Application Model
The business application blueprint contains multiple applications and services. To deploy the app we used the Cloud Foundry CLI commands
# deploy cf push # update cf push # delete (optionally also the random routes) cf delete MYAPP -f -r
To create the service instances, we used the commands
cf create-service SERVICE-NAME -c <configuration in JSON> cf update-service SERVICE-NAME -c <configuration in JSON> cf delete-service SERVICE-NAME
To bind the service app with the business logic to service instances we used the Cloud Foundry deployment manifest, manifest.yml, but we could have used command
Multiple Modules, Single Lifecycle
To make it easier to manage the lifecycle of business applications using microservices in the SAP Business Technology Platform, Cloud Foundry environment, SAP conceived the Multi-target Application (MTA) model.
MTA was originally architected for SAP HANA XS Advanced (XSA) applications with the different UI, application, and database modules. The objective was to provide a similar developer experience as with XS classic, the repository, and SAP HANA studio (2015). When the SAP Business Technology Platform, Cloud Foundry environment was released, the MTA model was included, as part of the SAP HANA XS Advanced programming model (2016). As defined in the original specification:
A multi-target application (MTA)is comprised of multiple parts (modules), created with different technologies and deployed to different targets, but with a single, common lifecycle.
Abstraction, Assembly, Automation
The benefits of MTA are the 3 A’s.
- Abstraction addresses the heterogeneity of the underlying modules (Python webapp, HANA database, Node.js approuter, etc.)
- Assembly provides a standard packaging for distribution (for example as signed artifact)
- Automation covers aspects like
- Auto-provisioning of required services and technical artifacts, like routes, or domains
- Deterministic deployment order
- Transactional consistency: a deployment either finishes successfully or fails completely, leaving no inconsistent intermediate states
- Recoverability: resume deployment from the point of failure of a multi-step operation
- CI/CD deployments with zero downtime update (e.g. blue-green strategy)
Development and Deployment Descriptors
Two configuration files govern MTA:
- What to build and how to built it is defined in the development descriptor: mta.yaml
- What and how to deploy is defined in the deployment descriptor: mtad.yaml
For more information about the concepts, see
- The XS Advanced Programming Model | SAP HANA Developer Guide for SAP HANA XS Advanced Model
- SAP HANA XS Advanced Multi-Target Applications | SAP HANA Developer Guide for SAP HANA XS Advanced Model
- Multitarget Applications in the Cloud Foundry Environment | SAP Business Technology Platform
MTA Descriptor Model
The MTA contains an ID and version in its header. Apps are defined as modules. Services as resources. The dependencies are defined using the keywords provides and requires.
For the syntax details, see
- MTA Descriptor Elements | SAP Web IDE Full-Stack
- Multitarget Application Structure | SAP Business Technology Platform
Using the Command Line
Like the Cloud Foundry deployment manifest.yml, all we need to create the file is a text editor.
Here is a sample development descriptor (mta.yaml) containing an app and a service instance.
You can validate the syntax using www.yamllint.com.
_schema-version: "3.2" ID: app version: 0.0.1 modules: - name: myapp type: staticfile path: contents.zip requires: - name: myapp-service resources: - name: myapp-service type: org.cloudfoundry.managed-service parameters: service: application-logs service-plan: lite
To create the MTA archive, we first need to compress the contents into a zip file (as specified in the development descriptor (mta.yaml).
zip myapp/contents.zip myapp/index.html
Cloud MTA Build Tool
Next, we to create the MTA archive by adding a MANIFEST.MF with the mtad.yaml descriptor file.
To facilitate this, SAP has made the Cloud MTA Build Tool available (the predecessor Multitarget Application Archive Builder is now deprecated).
To create the MTA archive run command:
Although any file editor will do, we have used here Microsoft Visual Studio Code with built-in terminal support and a plugin for YAML files.
The result is <APPNAME><VERSION>.mtar file.
When we extract the file, we can see the MANIFEST.MF and mtad.yaml (identical to the mta.yaml, in this simple example, apart from formatting).
CF CLI Multiapps Plugin
To deploy the app, we use a plugin for the CF CLI.
Add the plugin repository and install the plugin with commands:
cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org cf install-plugin multiapps
For the documentation and alternative download options, see
To deploy an MTA, use command:
# for the help menu # cf deploy -h cf deploy # cf undeploy
Like cf push, cf deploy requires the deployment descriptor file (mtad.yaml). You can extract this from the MTA archive. When using the IDEs (see below) this will be done automatically.
To commands to get information about MTAs and specific MTAs follow the same syntax as the cf apps and cf services commands.
cf mtas cf mta APP-NAME
With a single command, we now have created an app, service, with binding.
As a side note, the application-logs service adds a Kibana dashboard.
SAP Web IDE
The contemporary SAP Web IDE provides built-in support for MTAs. The tool is available for local development as SAP Web IDE for SAP HANA (XSA) and as a service for the SAP Business Technology Platform, Neo environment (2017) as SAP Web IDE Full-Stack.
The SAP Web IDE includes a wizard to generate the configuration for a new MTA.
The tool also include an MTA Editor to define modules, resources, and dependencies.
For the documentation, see
SAP Business Application Studio
The SAP Business Application Studio was released earlier this year as the tool for developing mulit-cloud applications for the Cloud Foundry environment. Like the SAP Web IDE, the appstudio is available as subscription.
The tool uses Eclipse Theia, which brings the look-and-feel of VSCode to the Cloud (and the Desktop).
To develop MTA applications, you can use the Basic Dev Space and add MTA Tools.
The interface includes a menu to build and deploy the app directly to your Cloud Foundry environment.
For the documentation, see
For the additional code samples, see:
Share and Connect
Questions? Post as comment.
Useful? Give us a like and share on social media. Thanks!
If you would like to receive updates, connect with me on
Denys van Kempen