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: 
dvankempen
Product and Topic Expert
Product and Topic Expert
6,594






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

  1. Cloud Foundry, UAA, and XSUAA

  2. Business Logic App

  3. Service Instance (SAP HANA Cloud)

  4. Application Router

  5. Authentication using XSUAA

  6. Authorization using XSUAA

  7. Multi-target applications (MTA) <<< this post

  8. Application Runtime (Appendix)


Questions? Post as comment.

Useful? Give us a like and share on social media.

Thanks!



Hands-On Tutorials


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


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



Documentation


For more information about the concepts, see


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


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.

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



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


More Information


For the additional code samples, see:



Share and Connect


Questions? Please 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

For the author page of SAP PRESS, visit








Over the years, for the SAP HANA Academy, SAP’s Partner Innovation Lab, and à titre personnel, I have written a little over 300 posts here for the SAP Community. Some articles only reached a few readers. Others attracted quite a few more.

For your reading pleasure and convenience, here is a curated list of posts which somehow managed to pass the 10k-view mile stone and, as sign of current interest, still tickle the counters each month.