Skip to Content
Technical Articles

Multi-Target Application Model (MTA) | Migrating from the Neo Environment to the Multi-Cloud Foundation

This blog post series is about migrating from the Neo environment to the multi-cloud foundation, with focus on implementing security using UAA and XSUAA in the Cloud Foundry environment.

  1. Cloud Foundry, UAA, and XSUAA
  2. Service App (Business Logic)
  3. Service Instance (SAP HANA Cloud)
  4. Application Router
  5. Authentication using XSUAA
  6. Authorization using XSUAA
  7. Multi-target applications (MTA)

Appendix

For the blog post about the SAP Cloud Platform multi-cloud environment, see

Questions? Post as comment.

Useful? Give a like and share on social media. Thanks!

/wp-content/uploads/2016/02/sapnwabline_885687.png

Hands-On Tutorials

Developing Secure Applications on the SAP Cloud Platform

In this blog series, we explore authentication and authorisation using XSUAA in the SAP Cloud 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

/wp-content/uploads/2016/02/sapnwabline_885687.png

Multi-Target Application Model

DIY

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

cf bind-service

Multiple Modules, Single Lifecycle

To make it easier to manage the lifecycle of business applications using microservices in the SAP Cloud 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 Cloud 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

Documentation

For more information about the concepts, see

/wp-content/uploads/2016/02/sapnwabline_885687.png

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

/wp-content/uploads/2016/02/sapnwabline_885687.png

Using the Command Line

Like the Cloud Foundry deployment manifest.yml, all we need to create the file is a text editor.

MTA.YAML

Here is a sample development descriptor (mta.yaml) containing an app and a service instance.

_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:

mbt build

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

Deploying MTAs

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.

/wp-content/uploads/2016/02/sapnwabline_885687.png

Development Tools

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 Cloud Platform, Neo environment (2017) as SAP Web IDE Full-Stack.

As the SAP Cloud Platform, Neo environment is no longer available in the trial environment and while the “next-gen” (successor), SAP Business Application Studio does not yet include support for SAP HANA development, a temporary service is available, accessible from the Subscription menu.

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

/wp-content/uploads/2016/02/sapnwabline_885687.png

More Information

For the additional code samples, see:

/wp-content/uploads/2016/02/sapnwabline_885687.png

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

Best,

Denys van Kempen

/wp-content/uploads/2016/02/sapnwabline_885687.png

Be the first to leave a comment
You must be Logged on to comment or reply to a post.