Skip to content

Latest commit

 

History

History
 
 

cf-app

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Managing CF apps with an MTA

This example shows how to model a simple Cloud Foundry application (CF app) in an MTA, deploy it, set specific attributes and configure the deployer behavior.

Try it out

Deploy an MTA containing a CF app

The example demostrates 2 different approaches that lead to the same result.

Deploy from directory

This approach uses deployment descriptor mtad.yaml and ready application binaries appBits.zip:

$ cf deploy ./ -f ;

Build and deploy

This approach uses development descriptor mta.yaml and application binaries appBits.zip to build an MTAR archive:

$ mbt build -p cf -t . ;

The built MTAR is then deployed:

$ cf deploy a.cf.app_0.0.0.mtar -f ;
Note
See mta.yaml or mtad.yaml for details on the attributes and environment and deployer parameters used.

Examine the result

List the deployed MTA

$ cf mta a.cf.app ;
Showing health and status ...
OK
Version: 0.0.0
Apps:
name        requested state   instances   memory   disk   urls
my-cf-app   started           1/1         1G       1G     orgname-spacename-my-mta-managed-app-module.cfapps.sap.hana.ondemand.com, my-custom-host.at.some.domain

List app status and attributes

$ cf app my-cf-app ;
Showing health and status for app my-cf-app in org ********** / space ******** as **********...

name:              my-cf-app
requested state:   started
routes:            orgname-spacename-my-mta-managed-app-module.cfapps.sap.hana.ondemand.com, my-custom-host.at.some.domain
last uploaded:     Thu 22 Aug 00:46:00 EEST 2019
stack:             cflinuxfs4
buildpacks:        staticfile

type:           web
instances:      1/1
memory usage:   1024M
     state     since                  cpu    memory        disk         details
#0   running   2019-08-21T21:46:14Z   1.1%   12.2M of 1G   5.3M of 1G

List app env variables and find the defined properties in the User Provided section

$ cf env my-cf-app | grep "MY_CF_APP_ENV_VARIABLE" ;
  MY_CF_APP_ENV_VARIABLE: HELLO MTA
$ cf env my-cf-app | grep "A_MORE_COMPLEX_VAR" ;
  A_MORE_COMPLEX_VAR: { "can be an entire":"json object", "with": [ "nested": { "elements": "https://each-host-is-registered-for-all-specified-domans.cfapps.sap.hana.ondemand.com" } ]

Clean up resources

It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command:

$ cf undeploy a.cf.app -f --delete-services