├── .gitignore ├── .gitmodules ├── .reuse └── dep5 ├── .vscode └── settings.json ├── LICENSE ├── LICENSES └── Apache-2.0.txt ├── README.adoc ├── TEMPLATE_USE_CASE.adoc ├── active-optional-resources ├── README.adoc ├── active_mandatory.mtaext ├── active_optional.mtaext ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── app-routes ├── README.adoc ├── appBits.zip ├── http2-routes │ ├── appBits.zip │ ├── mta.yaml │ └── mtad.yaml ├── keep_existing │ ├── appBits.zip │ └── mtad.yaml ├── modelled_with_host_and_domain │ ├── appBits.zip │ ├── mta.yaml │ └── mtad.yaml ├── modelled_with_hosts_and_domains │ ├── appBits.zip │ ├── mta.yaml │ └── mtad.yaml ├── mta.yaml ├── mtad.yaml ├── no_hostname │ ├── appBits.zip │ ├── mta.yaml │ └── mtad.yaml └── no_route │ ├── appBits.zip │ ├── mta.yaml │ └── mtad.yaml ├── blue-green-deploy-legacy ├── README.adoc ├── blue-green-skip-idle-start │ └── README.adoc ├── diagrams │ ├── bg-deploy-green-final.png │ ├── bg-deploy-green-temp.png │ ├── bg-deploy-green-validation.png │ └── initial-bg-deploy-blue.png ├── hello-blue │ ├── backend.war │ ├── backend │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── mta │ │ │ │ └── example │ │ │ │ └── Backend.java │ │ │ └── webapp │ │ │ └── WEB-INF │ │ │ └── web.xml │ ├── hello.mtar │ ├── mta.yaml │ ├── mtad.yaml │ ├── router.war │ └── router │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── sap │ │ │ └── mta │ │ │ └── example │ │ │ └── Router.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml └── hello-green │ ├── backend.war │ ├── backend │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── sap │ │ │ └── mta │ │ │ └── example │ │ │ └── Backend.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ ├── hello.mtar │ ├── mta.yaml │ ├── mtad.yaml │ ├── router.war │ └── router │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── sap │ │ └── mta │ │ └── example │ │ └── Router.java │ └── webapp │ └── WEB-INF │ └── web.xml ├── blue-green-deploy-strategy ├── README.adoc ├── blue-green-deploy-with-live-parameters │ ├── README.adoc │ ├── hello.mtar │ ├── mtad.yaml │ └── router.war ├── blue-green-deploy-with-live-routes │ ├── README.adoc │ ├── backend.war │ ├── hello.mtar │ ├── mta.yaml │ ├── mtad.yaml │ └── router.war ├── blue-green-skip-idle-start │ └── README.adoc ├── diagrams │ ├── bg-deploy-green-final.png │ ├── bg-deploy-green-temp.png │ ├── bg-deploy-green-validation.png │ └── initial-bg-deploy-blue.png ├── hello-blue │ ├── backend.war │ ├── backend │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── mta │ │ │ │ └── example │ │ │ │ └── Backend.java │ │ │ └── webapp │ │ │ └── WEB-INF │ │ │ └── web.xml │ ├── hello.mtar │ ├── mta.yaml │ ├── mtad.yaml │ ├── router.war │ └── router │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── sap │ │ │ └── mta │ │ │ └── example │ │ │ └── Router.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml ├── hello-green │ ├── backend.war │ ├── backend │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sap │ │ │ │ └── mta │ │ │ │ └── example │ │ │ │ └── Backend.java │ │ │ └── webapp │ │ │ └── WEB-INF │ │ │ └── web.xml │ ├── hello.mtar │ ├── mta.yaml │ ├── mtad.yaml │ ├── router.war │ └── router │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── sap │ │ │ └── mta │ │ │ └── example │ │ │ └── Router.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml └── incremental-blue-green-deploy │ ├── README.adoc │ ├── backend.war │ ├── hello.mtar │ ├── mta.yaml │ ├── mtad.yaml │ └── router.war ├── cf-app-docker ├── README.adoc ├── mta.yaml └── mtad.yaml ├── cf-app ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── cf-destination ├── README.adoc ├── a.cf.app.mtar ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── cf-service-destination ├── README.adoc ├── mta.yaml └── mtad.yaml ├── content-deployment ├── README.adoc ├── content-deployment-with-recreatable-key │ ├── README.adoc │ ├── mtad.yaml │ ├── service_keys_rotation.png │ └── test-destination-gacd-x509.mtar ├── content-deployment-with-service-key-deletion-after-deploy │ ├── README.adoc │ └── mtad.yaml └── html5-content-deployment │ ├── README.adoc │ ├── content │ └── content.zip │ ├── mtad.yaml │ ├── with-certificates │ ├── README.adoc │ ├── content │ │ └── content.zip │ └── mtad.yaml │ ├── with-existing-key │ ├── README.adoc │ ├── content │ │ └── content.zip │ └── mtad.yaml │ └── with-user-provided-service │ ├── README.adoc │ ├── content │ └── content.zip │ └── mtad.yaml ├── create-managed-services ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── cross-mta-config-with-dev-descriptor ├── README.adoc ├── consumer │ ├── Staticfile.zip │ ├── ci.mtaext │ ├── mta.yaml │ └── mtad.yaml └── provider │ ├── Staticfile.zip │ └── mtad.yaml ├── cross-mta-configurations ├── README.adoc ├── consumer │ ├── Staticfile.zip │ ├── ci.mtaext │ └── mtad.yaml └── provider │ ├── Staticfile.zip │ └── mtad.yaml ├── deploy-with-sequential-resources ├── README.adoc ├── appBits.zip ├── mta.yaml ├── mtad.yaml └── multiple-anatz.mtar ├── deploy-with-url ├── README.adoc └── anatz.zip ├── dynamic-parameters ├── README.adoc ├── appBits.zip ├── dynamic-parameters-for-cross-mta-configurations │ ├── README.adoc │ ├── deploy-cross-mta-configuration-consumer │ │ ├── appBits.zip │ │ └── mtad.yaml │ └── deploy-cross-mta-configuration-provider │ │ ├── appBits.zip │ │ └── mtad.yaml └── mtad.yaml ├── dynatrace-monitoring ├── README.adoc ├── mtad.yaml └── service-credentials.mtaext ├── extension-descriptor-different-environments ├── README.adoc ├── appBits.zip ├── dev.mtaext ├── mtad.yaml ├── prod-scale-vertically.mtaext └── prod.mtaext ├── externalize-services-configurations ├── README.adoc ├── config.json ├── mta.yaml ├── mtad.yaml └── upsconfig.json ├── fail-on-service-update ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── hooks ├── README.adoc ├── appBits.zip ├── mtad.yaml └── output │ ├── all-hooks-execution.txt │ ├── blue-green.application.after-stop.idle.and.live.txt │ ├── blue-green.application.after-stop.idle.txt │ ├── blue-green.application.after-stop.live.txt │ ├── blue-green.application.before-start.idle.and.live.txt │ ├── blue-green.application.before-start.idle.txt │ ├── blue-green.application.before-start.live.txt │ ├── blue-green.application.before-stop.idle.and.live.txt │ ├── blue-green.application.before-stop.idle.txt │ ├── blue-green.application.before-stop.live.txt │ ├── blue-green.application.before-unmap-routes.live.txt │ ├── deploy.application.after-stop.txt │ ├── deploy.application.before-stop.txt │ └── deploy.application.before.start.txt ├── idle-parameters ├── README.adoc ├── content │ └── hello-world.zip ├── idle-domain.mtaext ├── idle-domains.mtaext ├── idle-host-idle-domain.mtaext ├── idle-host-idle-domains.mtaext ├── idle-host.mtaext ├── idle-hosts-idle-domain.mtaext ├── idle-hosts-idle-domains.mtaext ├── idle-hosts.mtaext ├── idle-routes.mtaext └── mtad.yaml ├── keep-existing-bindings ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── keep-existing-env ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── keep-existing-routes ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── modify-packaged-mta ├── README.adoc └── original.mtar ├── namespace ├── README.adoc ├── global-parameters │ ├── appBits.zip │ └── mtad.yaml ├── module-and-service-with-apply-flag │ ├── backend.war │ ├── hello.mtar │ └── mtad.yaml ├── module-with-apply-as-suffix-flag │ ├── appBits.zip │ └── mtad.yaml ├── module-with-apply-as-suffix-global-parameter │ ├── appBits.zip │ └── mtad.yaml ├── module-with-apply-flag-to-route │ ├── backend.war │ ├── hello.mtar │ └── mtad.yaml └── two-modules │ ├── backend.war │ ├── hello.mtar │ └── mtad.yaml ├── parallel-deployment ├── README.adoc ├── content │ └── hello_world.zip ├── hello-world-no-parallel.mtaext ├── hello-world-parallel.mtaext ├── mta.yaml └── mtad.yaml ├── parameter-and-property-metadata ├── README.adoc ├── extension.yaml └── test.mtar ├── partial-build-deploy ├── MTAstructure.png ├── README.adoc ├── content │ └── hello_world.zip ├── mta.yaml └── mtad.yaml ├── service-key-renewal ├── README.adoc ├── mtad.yaml ├── service_keys_handling_diagram.png └── test-rotating-service-keys.mtar ├── sharing-values-between-apps ├── README.adoc ├── appBits.zip ├── mta.yaml ├── mtad.yaml └── my-mta.mtar ├── skip-service-updates ├── README.adoc ├── appBits.zip ├── mta.yaml └── mtad.yaml ├── streaming-logs-with-user-provided-service ├── README.adoc ├── appBits.zip └── mtad.yaml └── user-provided-service ├── README.adoc ├── mtad.yaml └── service-credentials.mtaext /.gitignore: -------------------------------------------------------------------------------- 1 | */mta_archives/*.mtar 2 | .DS_Store 3 | */target/* 4 | *.code-workspace 5 | *.iml 6 | .idea 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "gs-rest-service"] 2 | path = gs-rest-service 3 | url = https://github.com/spring-guides/gs-rest-service.git 4 | [submodule "dynatrace-monitoring/gs-rest-service"] 5 | path = dynatrace-monitoring/gs-rest-service 6 | url = https://github.com/spring-guides/gs-rest-service.git 7 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: cf-mta-examples 3 | Upstream-Contact: boyan.velinov@sap.com 4 | Source: https://github.com/SAP-samples/cf-mta-examples 5 | Disclaimer: The code in this project may include calls to APIs (“API Calls”) of 6 | SAP or third-party products or services developed outside of this project 7 | (“External Products”). 8 | “APIs” means application programming interfaces, as well as their respective 9 | specifications and implementing code that allows software to communicate with 10 | other software. 11 | API Calls to External Products are not licensed under the open source license 12 | that governs this project. The use of such API Calls and related External 13 | Products are subject to applicable additional agreements with the relevant 14 | provider of the External Products. In no event shall the open source license 15 | that governs this project grant any rights in or to any External Products,or 16 | alter, expand or supersede any terms of the applicable additional agreements. 17 | If you have a valid license agreement with SAP for the use of a particular SAP 18 | External Product, then you may make use of any API Calls included in this 19 | project’s code for that SAP External Product, subject to the terms of such 20 | license agreement. If you do not have a valid license agreement for the use of 21 | a particular SAP External Product, then you may only make use of any API Calls 22 | in this project for that SAP External Product for your internal, non-productive 23 | and non-commercial test and evaluation of such API Calls. Nothing herein grants 24 | you any rights to use or access any SAP External Product, or provide any third 25 | parties the right to use of access any SAP External Product, through API Calls. 26 | 27 | Files: ** 28 | Copyright: 2019-2020 SAP SE or an SAP affiliate company and contributors 29 | License: Apache-2.0 30 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /TEMPLATE_USE_CASE.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # 4 | 5 | - What is purpose of the feature/scenario. 6 | - [Optional] Any links to official Cloud Foundry features? 7 | 8 | ## [Optional] Requirements 9 | - what you should know in advance 10 | - what should exist in local dev 11 | - any other prerequisites? 12 | 13 | ## [Optional] Oficial documemtation in Help SAP Portal 14 | - link:https://help.sap.com/[Official Name of the page] 15 | 16 | # Try out 17 | 18 | ## How to execute 19 | 20 | ### [Optional] Any alternatives for execution, e.g. `cf deploy xx.mtar` and `cf deploy folder/` 21 | 22 | ## Verify the result 23 | - Check with CF natives 24 | -------------------------------------------------------------------------------- /active-optional-resources/active_mandatory.mtaext: -------------------------------------------------------------------------------- 1 | ID: "optional" 2 | extends: "my-mta" 3 | _schema-version: 3.3.0 4 | version: 0.0.0 5 | 6 | resources: 7 | - name: my-cf-service-instance-resource 8 | active: true 9 | 10 | -------------------------------------------------------------------------------- /active-optional-resources/active_optional.mtaext: -------------------------------------------------------------------------------- 1 | ID: "optional" 2 | extends: "my-mta" 3 | _schema-version: 3.3.0 4 | version: 0.0.0 5 | 6 | resources: 7 | - name: my-cf-service-instance-resource 8 | active: true 9 | optional: true # sets the service as optional, which will make the deplyer ignore any failures related to the service 10 | parameters: 11 | service: "not-existing-service" # set the service offering to something which does not exist so the service processing would fail 12 | service-name: "someothername" 13 | 14 | -------------------------------------------------------------------------------- /active-optional-resources/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/active-optional-resources/appBits.zip -------------------------------------------------------------------------------- /active-optional-resources/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-cf-service-instance-resource 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-plan: "lite" # set the service plan to use 10 | service: application-logs #set the service offering (label) 11 | active: false # defalt value is true, if unchanged with an extension descriptor, the service will not get created 12 | optional: false # default value 13 | 14 | 15 | modules: 16 | #A cf app which will be bound to the service 17 | - name: my-mta-managed-app-module 18 | type: application 19 | path: "appBits.zip" 20 | requires: 21 | - name: my-cf-service-instance-resource 22 | -------------------------------------------------------------------------------- /active-optional-resources/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-cf-service-instance-resource 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-plan: "lite" # set the service plan to use 10 | service: application-logs #set the service offering (label) 11 | active: false # defalt value is true, if unchanged with an extension descriptor, the service will not get created 12 | optional: false # default value 13 | 14 | 15 | modules: 16 | #A cf app which will be bound to the service 17 | - name: my-mta-managed-app-module 18 | type: application 19 | path: "appBits.zip" 20 | requires: 21 | - name: my-cf-service-instance-resource 22 | -------------------------------------------------------------------------------- /app-routes/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/appBits.zip -------------------------------------------------------------------------------- /app-routes/http2-routes/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/http2-routes/appBits.zip -------------------------------------------------------------------------------- /app-routes/http2-routes/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: 11 | - route: my-app-route-http1.${default-domain} 12 | protocol: http1 # explicitly specified, this is the default value 13 | - route: my-app-route-http2.${default-domain} 14 | protocol: http2 # default is empty which defaults to http1 15 | -------------------------------------------------------------------------------- /app-routes/http2-routes/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: 11 | - route: my-app-route-http1.${default-domain} 12 | protocol: http1 # explicitly specified, this is the default value 13 | - route: my-app-route-http2.${default-domain} 14 | protocol: http2 # default is empty which defaults to http1 15 | -------------------------------------------------------------------------------- /app-routes/keep_existing/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/keep_existing/appBits.zip -------------------------------------------------------------------------------- /app-routes/keep_existing/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #when globally defined, applies to all cf apps in MTA (unless overriden) 7 | keep-existing-routes: false 8 | 9 | modules: 10 | #A cf app consuming the configuration 11 | - name: my-cf-app-module 12 | type: application # value custom would do just as well 13 | path: "appBits.zip" 14 | parameters: #ALL parameters are optional and can be deleted- defaults will be taken/detected if non specified. 15 | app-name: my-cf-app 16 | keep-existing-routes: true 17 | - name: my-other-cf-app-module 18 | type: application # value custom would do just as well 19 | path: "appBits.zip" 20 | parameters: #ALL parameters are optional and can be deleted- defaults will be taken/detected if non specified. 21 | app-name: my-other-cf-app 22 | keep-existing: 23 | env: false 24 | service-bindings: true 25 | 26 | 27 | -------------------------------------------------------------------------------- /app-routes/modelled_with_host_and_domain/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/modelled_with_host_and_domain/appBits.zip -------------------------------------------------------------------------------- /app-routes/modelled_with_host_and_domain/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | #defines a single host to be set to the app route 11 | host: my-single-host-value 12 | #defines the domain for which the app route would be set 13 | domain: ${default-domain} 14 | 15 | #Setting env variables to showcase the default/generated values provided by the mta deployer 16 | properties: 17 | default-host: ${default-host} #usually generated using the -- 18 | default-domain: ${default-domain} #the default shared domain of the landscape 19 | default-uri: ${default-uri} #composed by ${host}.${domain} 20 | protocol: ${protocol} #usually defaults to "http" 21 | default-url: ${default-url} # composed of ${protocol}://${default-uri} -------------------------------------------------------------------------------- /app-routes/modelled_with_host_and_domain/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | #defines a single host to be set to the app route 11 | host: my-single-host-value 12 | #defines the domain for which the app route would be set 13 | domain: ${default-domain} 14 | 15 | #Setting env variables to showcase the default/generated values provided by the mta deployer 16 | properties: 17 | default-host: ${default-host} #usually generated using the -- 18 | default-domain: ${default-domain} #the default shared domain of the landscape 19 | default-uri: ${default-uri} #composed by ${host}.${domain} 20 | protocol: ${protocol} #usually defaults to "http" 21 | default-url: ${default-url} # composed of ${protocol}://${default-uri} -------------------------------------------------------------------------------- /app-routes/modelled_with_hosts_and_domains/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/modelled_with_hosts_and_domains/appBits.zip -------------------------------------------------------------------------------- /app-routes/modelled_with_hosts_and_domains/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 11 | - route: my-custom-host.at.some.domain 12 | - route: ${default-host}-with-custom-suffix.${default-domain} 13 | 14 | #Setting env variables to showcase the default/generated values provided by the mta deployer 15 | properties: 16 | default-host: ${default-host} #usually generated using the -- 17 | default-domain: ${default-domain} #the default shared domain of the landscape 18 | default-uri: ${default-uri} #composed by ${host}.${domain} 19 | protocol: ${protocol} #usually defaults to "http" 20 | default-url: ${default-url} # composed of ${protocol}://${default-uri} 21 | firstRoute: ${routes/0/route} 22 | secondRoute: ${routes/1/route} 23 | 24 | -------------------------------------------------------------------------------- /app-routes/modelled_with_hosts_and_domains/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | hosts: # if not defined, a default route would be auto assigned unless no-route is specified 11 | - my-custom-host 12 | - ${default-host}-with-custom-suffix 13 | domains: 14 | - ${default-domain} 15 | - at.some.domain 16 | 17 | #Setting env variables to showcase the default/generated values provided by the mta deployer 18 | properties: 19 | default-host: ${default-host} #usually generated using the -- 20 | default-domain: ${default-domain} #the default shared domain of the landscape 21 | default-uri: ${default-uri} #composed by ${host}.${domain} 22 | protocol: ${protocol} #usually defaults to "http" 23 | default-url: ${default-url} # composed of ${protocol}://${default-uri} 24 | -------------------------------------------------------------------------------- /app-routes/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 11 | - route: "my-custom-host.at.some.domain/with/path" 12 | - route: ${default-host}-with-custom-suffix.${default-domain} 13 | - route: "*.wildcard.for.host.at.some.domain" 14 | 15 | #Setting env variables to showcase the default/generated values provided by the mta deployer 16 | properties: 17 | default-host: ${default-host} #usually generated using the -- 18 | default-domain: ${default-domain} #the default shared domain of the landscape 19 | default-uri: ${default-uri} #composed by ${host}.${domain} 20 | protocol: ${protocol} #usually defaults to "http" 21 | default-url: ${default-url} # composed of ${protocol}://${default-uri} 22 | firstRoute: ${routes/0/route} 23 | secondRoute: ${routes/1/route} -------------------------------------------------------------------------------- /app-routes/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 11 | - route: "my-custom-host.at.some.domain/with/path" 12 | - route: ${default-host}-with-custom-suffix.${default-domain} 13 | - route: "*.wildcard.for.host.at.some.domain" 14 | 15 | #Setting env variables to showcase the default/generated values provided by the mta deployer 16 | properties: 17 | default-host: ${default-host} #usually generated using the -- 18 | default-domain: ${default-domain} #the default shared domain of the landscape 19 | default-uri: ${default-uri} #composed by ${host}.${domain} 20 | protocol: ${protocol} #usually defaults to "http" 21 | default-url: ${default-url} # composed of ${protocol}://${default-uri} 22 | firstRoute: ${routes/0/route} 23 | secondRoute: ${routes/1/route} -------------------------------------------------------------------------------- /app-routes/no_hostname/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/no_hostname/appBits.zip -------------------------------------------------------------------------------- /app-routes/no_hostname/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 11 | - route: host1.${default-domain} 12 | - route: host2.${default-domain} 13 | no-hostname: false # same as the above, 'false' is the default 14 | - route: subdomain.${default-domain} 15 | no-hostname: true # this tells the deployer that 'subdomain' is not a separate host, the whole route will be used as a cf domain -------------------------------------------------------------------------------- /app-routes/no_hostname/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: my-app-module 7 | type: application 8 | path: "appBits.zip" 9 | parameters: 10 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 11 | - route: host1.${default-domain} 12 | - route: host2.${default-domain} 13 | no-hostname: false # same as the above, 'false' is the default 14 | - route: subdomain.${default-domain} 15 | no-hostname: true # this tells the deployer that 'subdomain' is not a separate host, the whole route will be used as a cf domain -------------------------------------------------------------------------------- /app-routes/no_route/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/app-routes/no_route/appBits.zip -------------------------------------------------------------------------------- /app-routes/no_route/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | #A cf app consuming the configuration 7 | - name: my-mta-managed-app-module 8 | type: application # value custom would do just as well 9 | path: "appBits.zip" 10 | parameters: #ALL paramters are optional and can be deleted - defaults will be taken/detected if non specified. 11 | app-name: my-routless-cf-app 12 | no-route: true 13 | 14 | 15 | -------------------------------------------------------------------------------- /app-routes/no_route/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | #A cf app consuming the configuration 7 | - name: my-mta-managed-app-module 8 | type: application # value custom would do just as well 9 | path: "appBits.zip" 10 | parameters: #ALL parameters are optional and can be deleted - defaults will be taken/detected if non specified. 11 | app-name: my-routless-cf-app 12 | no-route: true 13 | 14 | 15 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/diagrams/bg-deploy-green-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/diagrams/bg-deploy-green-final.png -------------------------------------------------------------------------------- /blue-green-deploy-legacy/diagrams/bg-deploy-green-temp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/diagrams/bg-deploy-green-temp.png -------------------------------------------------------------------------------- /blue-green-deploy-legacy/diagrams/bg-deploy-green-validation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/diagrams/bg-deploy-green-validation.png -------------------------------------------------------------------------------- /blue-green-deploy-legacy/diagrams/initial-bg-deploy-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/diagrams/initial-bg-deploy-blue.png -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/hello-blue/backend.war -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/backend/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.backend 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | backend 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/backend/src/main/java/com/sap/mta/example/Backend.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.IOException; 3 | import javax.servlet.ServletException; 4 | import javax.servlet.annotation.WebServlet; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | @WebServlet({"/backend"}) 10 | public class Backend 11 | extends HttpServlet 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 16 | throws ServletException, IOException 17 | { 18 | response.getWriter().append("BLUE").flush(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/backend/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.backend 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/hello-blue/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router/ 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java 23 | path: backend/ 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "2.0.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java.tomcat 8 | path: router.war 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java.tomcat 23 | path: backend.war 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/hello-blue/router.war -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/router/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.router 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | router 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/router/src/main/java/com/sap/mta/example/Router.java: -------------------------------------------------------------------------------- 1 | package com.sap.mta.example; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.HttpURLConnection; 7 | import java.net.URL; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | @WebServlet({"/router"}) 16 | public class Router extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | String urlString = (String)System.getenv().get("backend"); 21 | System.out.println("URL is " + urlString); 22 | URL url = new URL(urlString); 23 | HttpURLConnection connection = (HttpURLConnection)url.openConnection(); 24 | connection.setRequestMethod("GET"); 25 | connection.connect(); 26 | String message = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); 27 | System.out.println("message is " + message); 28 | response.getWriter().append(message).flush(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-blue/router/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.router 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/hello-green/backend.war -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/backend/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.backend 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | backend 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/backend/src/main/java/com/sap/mta/example/Backend.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.IOException; 3 | import javax.servlet.ServletException; 4 | import javax.servlet.annotation.WebServlet; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | @WebServlet({"/backend"}) 10 | public class Backend 11 | extends HttpServlet 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 16 | throws ServletException, IOException 17 | { 18 | response.getWriter().append("GREEN").flush(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/backend/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.backend 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/hello-green/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router/ 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java 23 | path: backend/ 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "2.0.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java.tomcat 8 | path: router.war 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java.tomcat 23 | path: backend.war 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-legacy/hello-green/router.war -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/router/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.router 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | router 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/router/src/main/java/com/sap/mta/example/Router.java: -------------------------------------------------------------------------------- 1 | package com.sap.mta.example; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.HttpURLConnection; 7 | import java.net.URL; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | @WebServlet({"/router"}) 16 | public class Router extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | String urlString = (String)System.getenv().get("backend"); 21 | System.out.println("URL is " + urlString); 22 | URL url = new URL(urlString); 23 | HttpURLConnection connection = (HttpURLConnection)url.openConnection(); 24 | connection.setRequestMethod("GET"); 25 | connection.connect(); 26 | String message = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); 27 | System.out.println("message is " + message); 28 | response.getWriter().append(message).flush(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /blue-green-deploy-legacy/hello-green/router/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.router 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-parameters/README.adoc: -------------------------------------------------------------------------------- 1 | ## Execute blue-green deployment using live parameters 2 | During the testing phase of the blue-green deployment, parameters ${default-host}, ${default-url} and ${default-uri} receive the "idle" suffix. In other words, these parameters are deemed to be in a standby or inactive state. However, while this is useful for resolving those URLs during the testing phase and connecting the deployed applications with each other, this could be an issue if the "idle" version of that parameter cannot be updated after the testing phase, as is the case with service creation parameters. The "idle" URLs are supposed to be deleted at the end of blue-green deployments. This might lead to functional issues if services dependent on these URLs are not updated with productive URLs unlike the applications. Here's an example: 3 | 4 | ```yaml 5 | ... 6 | provides: 7 | - name: provided-router 8 | properties: 9 | provided-default-live-url: ${default-live-url} 10 | provided-default-live-uri: ${default-live-uri} 11 | provided-default-live-host: ${default-live-host} 12 | provided-default-live-app-name: ${default-live-app-name} 13 | 14 | resources: 15 | - name: example-resource 16 | type: org.cloudfoundry.managed-service 17 | requires: 18 | - name: provided-router 19 | parameters: 20 | service-plan: "lite" 21 | service: application-logs 22 | config: 23 | router-provided-default-live-url: ~{provided-router/provided-default-live-url} 24 | router-provided-default-live-uri: ~{provided-router/provided-default-live-uri} 25 | router-provided-default-live-host: ~{provided-router/provided-default-live-host} 26 | router-provided-default-live-ap-name: ~{provided-router/provided-default-live-app-name} 27 | 28 | ``` 29 | 30 | ### Try it out 31 | The example demonstrates blue-green deployment of one MTA, comprised of one application and one service. The application, called "hello-router", is used to provide the live parameters of the MTA. The service requires the live parameters of the application. 32 | 33 | 34 | 35 | ``` 36 | cf deploy ./blue-green-deploy-with-live-parameters --strategy blue-green --skip-testing-phase 37 | ``` 38 | In the testing phase the parameters of the resource will be resolved this way: 39 | ``` 40 | "router-provided-default-live-ap-name" : "hello-router" 41 | "router-provided-default-live-host" : "--hello-router" 42 | "router-provided-default-live-uri" : "--hello-router.cfapps.sap.hana.ondemand.com" 43 | "router-provided-default-live-url" : "https://--hello-router.cfapps.sap.hana.ondemand.com" 44 | ``` 45 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-parameters/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/blue-green-deploy-with-live-parameters/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-parameters/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.0.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java.tomcat 8 | path: router.war 9 | requires: 10 | - name: example-resource 11 | provides: 12 | - name: provided-router 13 | properties: 14 | provided-default-live-url: ${default-live-url} 15 | provided-default-live-uri: ${default-live-uri} 16 | provided-default-live-host: ${default-live-host} 17 | provided-default-live-app-name: ${default-live-app-name} 18 | 19 | resources: 20 | - name: example-resource 21 | type: org.cloudfoundry.managed-service 22 | requires: 23 | - name: provided-router 24 | parameters: 25 | service-plan: "lite" 26 | service: application-logs 27 | config: 28 | router-provided-default-live-url: ~{provided-router/provided-default-live-url} 29 | router-provided-default-live-uri: ~{provided-router/provided-default-live-uri} 30 | router-provided-default-live-host: ~{provided-router/provided-default-live-host} 31 | router-provided-default-live-ap-name: ~{provided-router/provided-default-live-app-name} 32 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-parameters/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/blue-green-deploy-with-live-parameters/router.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-routes/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/blue-green-deploy-with-live-routes/backend.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-routes/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/blue-green-deploy-with-live-routes/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-routes/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router/ 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java 23 | path: backend/ 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-routes/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.0.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-backend 7 | type: java.tomcat 8 | path: backend.war 9 | provides: 10 | - name: backend-idle-route 11 | properties: 12 | provided-idle-route: ${routes/0/route} 13 | parameters: 14 | #this is the default 15 | use-live-routes: false 16 | - name: backend-live-route 17 | properties: 18 | provided-live-route: ${routes/0/route} 19 | parameters: 20 | use-live-routes: true 21 | parameters: 22 | routes: 23 | - route: ${default-live-uri} 24 | 25 | - name: hello-router 26 | type: java.tomcat 27 | path: router.war 28 | requires: 29 | - name: backend-idle-route 30 | parameters: 31 | backend-required-route: ~{backend-idle-route/provided-idle-route} 32 | 33 | resources: 34 | - name: example-resource 35 | type: org.cloudfoundry.managed-service 36 | requires: 37 | - name: backend-live-route 38 | parameters: 39 | service-plan: "lite" 40 | service: application-logs 41 | config: 42 | backend-live-route: ~{backend-live-route/provided-live-route} -------------------------------------------------------------------------------- /blue-green-deploy-strategy/blue-green-deploy-with-live-routes/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/blue-green-deploy-with-live-routes/router.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/diagrams/bg-deploy-green-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/diagrams/bg-deploy-green-final.png -------------------------------------------------------------------------------- /blue-green-deploy-strategy/diagrams/bg-deploy-green-temp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/diagrams/bg-deploy-green-temp.png -------------------------------------------------------------------------------- /blue-green-deploy-strategy/diagrams/bg-deploy-green-validation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/diagrams/bg-deploy-green-validation.png -------------------------------------------------------------------------------- /blue-green-deploy-strategy/diagrams/initial-bg-deploy-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/diagrams/initial-bg-deploy-blue.png -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/hello-blue/backend.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/backend/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.backend 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | backend 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/backend/src/main/java/com/sap/mta/example/Backend.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.IOException; 3 | import javax.servlet.ServletException; 4 | import javax.servlet.annotation.WebServlet; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | @WebServlet({"/backend"}) 10 | public class Backend 11 | extends HttpServlet 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 16 | throws ServletException, IOException 17 | { 18 | response.getWriter().append("BLUE").flush(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/backend/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.backend 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/hello-blue/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router/ 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java 23 | path: backend/ 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "2.0.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java.tomcat 8 | path: router.war 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java.tomcat 23 | path: backend.war 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/hello-blue/router.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/router/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.router 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | router 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/router/src/main/java/com/sap/mta/example/Router.java: -------------------------------------------------------------------------------- 1 | package com.sap.mta.example; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.HttpURLConnection; 7 | import java.net.URL; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | @WebServlet({"/router"}) 16 | public class Router extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | String urlString = (String)System.getenv().get("backend"); 21 | System.out.println("URL is " + urlString); 22 | URL url = new URL(urlString); 23 | HttpURLConnection connection = (HttpURLConnection)url.openConnection(); 24 | connection.setRequestMethod("GET"); 25 | connection.connect(); 26 | String message = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); 27 | System.out.println("message is " + message); 28 | response.getWriter().append(message).flush(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-blue/router/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.router 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/hello-green/backend.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/backend/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.backend 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | backend 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/backend/src/main/java/com/sap/mta/example/Backend.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.IOException; 3 | import javax.servlet.ServletException; 4 | import javax.servlet.annotation.WebServlet; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | @WebServlet({"/backend"}) 10 | public class Backend 11 | extends HttpServlet 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 16 | throws ServletException, IOException 17 | { 18 | response.getWriter().append("GREEN").flush(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/backend/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.backend 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/hello-green/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router/ 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java 23 | path: backend/ 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "2.0.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java.tomcat 8 | path: router.war 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | properties: 19 | MEMORY_CALCULATOR_V1: true 20 | 21 | - name: hello-backend 22 | type: java.tomcat 23 | path: backend.war 24 | provides: 25 | - name: backend 26 | properties: 27 | url: "${default-url}" 28 | parameters: 29 | memory: 512M 30 | disk-quota: 256M 31 | properties: 32 | MEMORY_CALCULATOR_V1: true 33 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/hello-green/router.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/router/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.sap.mta.example 4 | com.sap.mta.example.router 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | javax.servlet 10 | javax.servlet-api 11 | 3.1.0 12 | provided 13 | 14 | 15 | 16 | javax.servlet 17 | jsp-api 18 | 2.0 19 | provided 20 | 21 | 22 | 23 | router 24 | 25 | 26 | maven-compiler-plugin 27 | 3.5.1 28 | 29 | 1.8 30 | 1.8 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/router/src/main/java/com/sap/mta/example/Router.java: -------------------------------------------------------------------------------- 1 | package com.sap.mta.example; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.HttpURLConnection; 7 | import java.net.URL; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | @WebServlet({"/router"}) 16 | public class Router extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | String urlString = (String)System.getenv().get("backend"); 21 | System.out.println("URL is " + urlString); 22 | URL url = new URL(urlString); 23 | HttpURLConnection connection = (HttpURLConnection)url.openConnection(); 24 | connection.setRequestMethod("GET"); 25 | connection.connect(); 26 | String message = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); 27 | System.out.println("message is " + message); 28 | response.getWriter().append(message).flush(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/hello-green/router/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.sap.mta.example.router 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/incremental-blue-green-deploy/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/incremental-blue-green-deploy/backend.war -------------------------------------------------------------------------------- /blue-green-deploy-strategy/incremental-blue-green-deploy/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/incremental-blue-green-deploy/hello.mtar -------------------------------------------------------------------------------- /blue-green-deploy-strategy/incremental-blue-green-deploy/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router/ 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | instances: 3 19 | properties: 20 | MEMORY_CALCULATOR_V1: true 21 | 22 | - name: hello-backend 23 | type: java 24 | path: backend/ 25 | provides: 26 | - name: backend 27 | properties: 28 | url: "${default-url}" 29 | parameters: 30 | memory: 512M 31 | disk-quota: 256M 32 | instances: 3 33 | properties: 34 | MEMORY_CALCULATOR_V1: true 35 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/incremental-blue-green-deploy/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: hello 3 | version: 0.1.0 4 | 5 | modules: 6 | - name: hello-router 7 | type: java 8 | path: router.war 9 | requires: 10 | - name: backend 11 | properties: 12 | backend: ~{url}/backend 13 | name: backend 14 | url: ~{url} 15 | parameters: 16 | memory: 512M 17 | disk-quota: 256M 18 | instances: 3 19 | properties: 20 | MEMORY_CALCULATOR_V1: true 21 | 22 | - name: hello-backend 23 | type: java 24 | path: backend.war 25 | provides: 26 | - name: backend 27 | properties: 28 | url: "${default-url}" 29 | parameters: 30 | memory: 512M 31 | disk-quota: 256M 32 | instances: 3 33 | properties: 34 | MEMORY_CALCULATOR_V1: true 35 | -------------------------------------------------------------------------------- /blue-green-deploy-strategy/incremental-blue-green-deploy/router.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/blue-green-deploy-strategy/incremental-blue-green-deploy/router.war -------------------------------------------------------------------------------- /cf-app-docker/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.docker.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | # A cf app consuming the configuration 7 | - name: my-mta-managed-app 8 | type: application # value custom would do just as well 9 | parameters: # All parameters are optional and can be deleted - defaults will be taken/detected if non specified. 10 | docker: # Schedule a docker image found in that repository instead of staging bits 11 | image: cloudfoundry/test-app # repo/image:tag 12 | # username: # credentials to access docker repo 13 | # password: 14 | instances: 1 #optional 15 | routes: # Optional, otherwise one generated by template is assigned 16 | - route: ${org}-${space}-${app-name}.${domain} 17 | properties: # How environment variables are defined 18 | MY_ENV_VAR: "value-of-my-env-var" 19 | build-parameters: 20 | # Use 'no-source' build parameters to instruct the Cloud MTA Build tool not to package any content for this module in the MTA archive 21 | # For more details https://sap.github.io/cloud-mta-build-tool/configuration/#configuring-a-module-that-does-not-have-source-code-to-build-and-package 22 | no-source: true 23 | -------------------------------------------------------------------------------- /cf-app-docker/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.docker.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | # A cf app consuming the configuration 7 | - name: my-mta-managed-app 8 | type: application # value custom would do just as well 9 | parameters: # All parameters are optional and can be deleted - defaults will be taken/detected if non specified. 10 | docker: # Schedule a docker image found in that repository instead of staging bits 11 | image: cloudfoundry/test-app # repo/image:tag 12 | # username: # credentials to access docker repo 13 | # password: 14 | instances: 1 #optional 15 | routes: # Optional, otherwise one generated by template is assigned 16 | - route: ${org}-${space}-${app-name}.${domain} 17 | properties: # How environment variables are defined 18 | MY_ENV_VAR: "value-of-my-env-var" 19 | -------------------------------------------------------------------------------- /cf-app/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Managing CF apps with an MTA 4 | 5 | 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. 6 | 7 | # Try it out 8 | 9 | ## Deploy an MTA containing a CF app 10 | 11 | The example demostrates 2 different approaches that lead to the same result. 12 | 13 | ### Deploy from directory 14 | This approach uses deployment descriptor `mtad.yaml` and ready application binaries `appBits.zip`: 15 | ``` bash 16 | $ cf deploy ./ -f ; 17 | ``` 18 | ### Build and deploy 19 | This approach uses development descriptor `mta.yaml` and application binaries `appBits.zip` to build an MTAR archive: 20 | 21 | ``` bash 22 | $ mbt build -p cf -t . ; 23 | ``` 24 | 25 | The built MTAR is then deployed: 26 | 27 | ``` bash 28 | $ cf deploy a.cf.app_0.0.0.mtar -f ; 29 | ``` 30 | 31 | NOTE: See link:mta.yaml[mta.yaml] or link:mtad.yaml[mtad.yaml] for details on the attributes and environment and deployer parameters used. 32 | 33 | ## Examine the result 34 | 35 | ### List the deployed MTA 36 | ```bash 37 | $ cf mta a.cf.app ; 38 | Showing health and status ... 39 | OK 40 | Version: 0.0.0 41 | Apps: 42 | name requested state instances memory disk urls 43 | 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 44 | ``` 45 | 46 | ### List app status and attributes 47 | ``` bash 48 | $ cf app my-cf-app ; 49 | Showing health and status for app my-cf-app in org ********** / space ******** as **********... 50 | 51 | name: my-cf-app 52 | requested state: started 53 | routes: orgname-spacename-my-mta-managed-app-module.cfapps.sap.hana.ondemand.com, my-custom-host.at.some.domain 54 | last uploaded: Thu 22 Aug 00:46:00 EEST 2019 55 | stack: cflinuxfs4 56 | buildpacks: staticfile 57 | 58 | type: web 59 | instances: 1/1 60 | memory usage: 1024M 61 | state since cpu memory disk details 62 | #0 running 2019-08-21T21:46:14Z 1.1% 12.2M of 1G 5.3M of 1G 63 | ``` 64 | 65 | ### List app env variables and find the defined properties in the User Provided section 66 | ``` bash 67 | $ cf env my-cf-app | grep "MY_CF_APP_ENV_VARIABLE" ; 68 | MY_CF_APP_ENV_VARIABLE: HELLO MTA 69 | $ cf env my-cf-app | grep "A_MORE_COMPLEX_VAR" ; 70 | 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" } ] 71 | ``` 72 | 73 | ## Clean up resources 74 | It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command: 75 | ``` bash 76 | $ cf undeploy a.cf.app -f --delete-services 77 | ``` 78 | -------------------------------------------------------------------------------- /cf-app/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cf-app/appBits.zip -------------------------------------------------------------------------------- /cf-app/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | #A cf app consuming the configuration 7 | - name: my-mta-managed-app-module 8 | type: application # value custom would do just as well 9 | path: "appBits.zip" 10 | properties: #module properties for CF Apps can be consumed as app environment variables at runitime 11 | MY_CF_APP_ENV_VARIABLE: "HELLO MTA" 12 | A_MORE_COMPLEX_VAR: "{ 13 | \"can be an entire\":\"json object\", 14 | \"with\": [ 15 | \"nested\": { 16 | \"elements\": \"${default-url}\" 17 | } 18 | ]" 19 | parameters: #ALL paramters are optional and can be deleted- defaults will be taken/detected if non specified. 20 | buildpack: staticfile_buildpack 21 | app-name: my-cf-app 22 | memory: 1G 23 | disk-quota: 1G 24 | no-route: false 25 | no-start: false 26 | instances: 1 27 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 28 | - route: ${default-host}.${default-domain} 29 | - route: my-custom-host.at.some.domain 30 | upload-timeout: 180 #seconds 31 | health-check-type: http #http/port/process 32 | health-check-http-endpoint: "/index" # the http route pinged 33 | health-check-timeout: 180 #seconds 34 | enable-ssh: true # allows to `cf ssh ` 35 | ##out of scope for this example: 36 | #hosts: #registering multitude of hosts 37 | #domain: #rarely are custom domain registered in such manner 38 | #domains: 39 | # 40 | #command: java -jar ... #start my app in a custom way with this command 41 | # 42 | #docker: # schedule a docker image found in that repository instead of staging bits 43 | # image: cloudfoundry/test-app # repo/image:tag 44 | # username: #credentials to access docker repo 45 | # password: $ 46 | # 47 | #tasks: # Execute this task after staging my app 48 | # - name: my task 49 | # command: echo "Custom command executed in an app container!" 50 | #keep-existing: #Usually used when *.mtaext files are not maintained and the platform is relied on to persist the config state. E.g. multitenant apps which receive additional routes on onboarding of accounts 51 | # env: false 52 | # routes: false 53 | # service-bindings: false 54 | # 55 | #Uncommon: 56 | # 57 | #dependency-type: #used when dealing with circular 'requires' dependencies 58 | # 59 | #create-service-broker: # and all complementary sb-name, sb-password, sb-space-scoped... 60 | # 61 | #restart-on-env-change: #Fine tunes deployment behavior on whether to restart on certain events during deployment 62 | # - user-provided: false 63 | # - vcap-application: true 64 | # - vcal-services: false -------------------------------------------------------------------------------- /cf-app/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | #A cf app consuming the configuration 7 | - name: my-mta-managed-app-module 8 | type: application # value custom would do just as well 9 | path: "appBits.zip" 10 | properties: #module properties for CF Apps can be consumed as app environment variables at runitime 11 | "MY_CF_APP_ENV_VARIABLE": "HELLO MTA" 12 | A_MORE_COMPLEX_VAR: "{ 13 | \"can be an entire\":\"json object\", 14 | \"with\": [ 15 | \"nested\": { 16 | \"elements\": \"${default-url}\" 17 | } 18 | ]" 19 | parameters: #ALL paramters are optional and can be deleted- defaults will be taken/detected if non specified. 20 | buildpack: staticfile_buildpack 21 | app-name: my-cf-app 22 | memory: 1G 23 | disk-quota: 1G 24 | no-route: false 25 | no-start: false 26 | instances: 1 27 | routes: # if not defined, a default route would be auto assigned unless no-route is specified 28 | - route: ${default-host}.${default-domain} 29 | - route: my-custom-host${generated-password}.at.some.domain 30 | upload-timeout: 180 #seconds 31 | health-check-type: http #http/port/process 32 | health-check-http-endpoint: "/index" # the http route pinged 33 | health-check-timeout: 180 #seconds 34 | enable-ssh: true # allows to `cf ssh ` 35 | ##out of scope for this example: 36 | # 37 | #hosts: #registering multitude of hosts 38 | # 39 | #domain: #rarely are custom domains registered in such way 40 | #domains: 41 | # 42 | #command: java -jar ... #start my app in a custom way with this command 43 | # 44 | #docker: # schedule a docker image found in that repository instead of staging bits 45 | # image: cloudfoundry/test-app # repo/image:tag 46 | # username: #credentials to access docker repo 47 | # password: $ 48 | # 49 | #tasks: # Execute this task after staging my app 50 | # - name: my task 51 | # command: echo "Custom command executed in an app container!" 52 | #keep-existing: #Usually used when *.mtaext files are not maintained and the platform is relied on to persist the config state. E.g. multitenant apps which receive additional routes on onboarding of accounts 53 | # env: false 54 | # routes: false 55 | # service-bindings: false 56 | # 57 | #Uncommon: 58 | # 59 | #dependency-type: #used when dealing with circular 'requires' dependencies 60 | # 61 | #create-service-broker: # and all complementary sb-name, sb-password, sb-space-scoped... 62 | # 63 | #restart-on-env-change: #Fine tunes deployment behavior on whether to restart on certain events during deployment 64 | # - user-provided: false 65 | # - vcap-application: true 66 | # - vcal-services: false 67 | 68 | -------------------------------------------------------------------------------- /cf-destination/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Managing CF Apps and SAP BTP Destination with an MTA 4 | 5 | This example shows how to model a simple CF application in an MTA, and a SAP BTP sub-account destination pointing to its url. 6 | 7 | # Try out 8 | 9 | ## Deploy an MTA containing a CF app 10 | 11 | The example demonstrates 2 different approaches that lead to the same result. 12 | 13 | ### Deploy from directory 14 | That approach uses deployment descriptor *mta.yaml* and ready application binaries *appBits.zip*: 15 | ``` bash 16 | cf deploy ./ -f ; 17 | ``` 18 | ### Build and Deploy 19 | The approach is using development descriptor *mta.yaml* and application binaries *appBits.zip* to build MTAR. 20 | Then the MTAR is deployed. 21 | 22 | ``` bash 23 | mbt build -p cf -t . ; 24 | cf deploy a.cf.app.mtar -f ; 25 | ``` 26 | 27 | NOTE: See link:mta.yaml[mta.yaml] or link:mtad.yaml[mtad.yaml] for details on the attributes and environment and deployer parameters used. 28 | 29 | ## Examine the result 30 | 31 | ### List the deployed MTA application 32 | ```bash 33 | Showing health and status for multi-target app a.cf.app in org / space as ... 34 | OK 35 | Version: 0.0.0 36 | Namespace: 37 | 38 | Apps: 39 | name requested state instances memory disk urls 40 | backend STARTED 1/1 20.8M 5.2M --backend. 41 | 42 | Services: 43 | name service plan bound apps last operation 44 | destination-service destination lite create succeeded 45 | xsuaa-service xsuaa application backend create succeeded 46 | ``` 47 | 48 | Verify the destination is available in your subaccount. 49 | -------------------------------------------------------------------------------- /cf-destination/a.cf.app.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cf-destination/a.cf.app.mtar -------------------------------------------------------------------------------- /cf-destination/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cf-destination/appBits.zip -------------------------------------------------------------------------------- /cf-destination/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | modules: 5 | - name: destination-content-deployer 6 | type: com.sap.application.content 7 | build-parameters: 8 | no-source: true 9 | parameters: 10 | content: 11 | subaccount: # subacount level destination 12 | existing_destinations_policy: update # the destination will be updated 13 | destinations: 14 | - Name: uaa-destination 15 | URL: ~{backend-api/url} # from here, properties from different requires dependencies can be references - via ~{fully-qualified/references} 16 | forwardAuthToken: true 17 | ServiceInstanceName: "xsuaa-service" # the name of the service instance to which the destination will be created (uaa in this example) 18 | requires: 19 | - name: destination-service 20 | parameters: 21 | content-target: true 22 | - name: xsuaa-service 23 | - name: backend-api 24 | 25 | - name: backend 26 | type: application 27 | path: "appBits.zip" 28 | requires: 29 | - name: xsuaa-service 30 | parameters: 31 | buildpack: staticfile_buildpack 32 | memory: 1G 33 | disk-quota: 1G 34 | provides: 35 | - name: backend-api 36 | properties: 37 | url: ${default-url} 38 | 39 | resources: 40 | - name: destination-service 41 | type: org.cloudfoundry.managed-service 42 | parameters: 43 | service: destination 44 | service-name: destination-service 45 | service-plan: lite 46 | 47 | - name: xsuaa-service 48 | type: org.cloudfoundry.managed-service 49 | parameters: 50 | service: xsuaa 51 | service-plan: application 52 | -------------------------------------------------------------------------------- /cf-destination/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | modules: 5 | - name: destination-content-deployer 6 | type: com.sap.application.content 7 | parameters: 8 | content: 9 | subaccount: # subacount level destination 10 | existing_destinations_policy: update # the destination will be updated 11 | destinations: 12 | - Name: uaa-destination 13 | URL: ~{backend-api/url} # from here, properties from different requires dependencies can be references - via ~{fully-qualified/references} 14 | forwardAuthToken: true 15 | ServiceInstanceName: "xsuaa-service" # the name of the service instance to which the destination will be created (uaa in this example) 16 | requires: 17 | - name: destination-service 18 | parameters: 19 | content-target: true 20 | - name: xsuaa-service 21 | - name: backend-api 22 | 23 | - name: backend 24 | type: application 25 | path: "appBits.zip" 26 | requires: 27 | - name: xsuaa-service 28 | parameters: 29 | buildpack: staticfile_buildpack 30 | memory: 1G 31 | disk-quota: 1G 32 | provides: 33 | - name: backend-api 34 | properties: 35 | url: ${default-url} 36 | 37 | resources: 38 | - name: destination-service 39 | type: org.cloudfoundry.managed-service 40 | parameters: 41 | service: destination 42 | service-name: destination-service 43 | service-plan: lite 44 | 45 | - name: xsuaa-service 46 | type: org.cloudfoundry.managed-service 47 | parameters: 48 | service: xsuaa 49 | service-plan: application 50 | -------------------------------------------------------------------------------- /cf-service-destination/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Managing CF Apps and SAP BTP Service Instance Destination with an MTA 4 | 5 | This example demonstrates how to model a simple Multi-Target Application (MTA) while configuring a SAP BTP service instance destination that connects to both an XSUAA service instance and a Workflow service instance. The setup includes a content deployment module that defines the required destinations inline. During deployment, the service instances are created first, followed by their respective service keys. The service key for the Workflow service instance is then used to configure the “destination-to-workflow” destination. The service key for the XSUAA service instance is used to configure "destination-to-workflow" destination. Since the timestamp parameter is utilized, this service key is regenerated with each deployment which enables the service keys rotation. 6 | 7 | # Try out 8 | 9 | ## Deploy an MTA containing a CF app 10 | 11 | The example demonstrates 2 different approaches that lead to the same result. 12 | 13 | ### Deploy from directory 14 | That approach uses deployment descriptor *mta.yaml* 15 | ``` bash 16 | cf deploy ./ -f ; 17 | ``` 18 | ### Build and Deploy 19 | The approach is using development descriptor *mta.yaml*. 20 | Then the MTAR is deployed. 21 | 22 | ``` bash 23 | mbt build -p cf -t . ; 24 | cf deploy destination.reference.sample.mtar -f ; 25 | ``` 26 | 27 | NOTE: See link:mta.yaml[mta.yaml] or link:mtad.yaml[mtad.yaml] for details on the attributes and environment and deployer parameters used. 28 | 29 | ## Examine the result 30 | 31 | ### List the deployed MTA application 32 | ```bash 33 | Showing health and status for multi-target app a.cf.app in org / space as ... 34 | OK 35 | Version: 1.0.0 36 | Namespace: 37 | 38 | Apps: 39 | name requested state instances memory disk urls 40 | 41 | Services: 42 | name service plan bound apps last operation 43 | destination-service-example destination lite create succeeded 44 | xsuaa-service xsuaa application create succeeded 45 | workflow_service workflow standard create succeeded 46 | ``` 47 | 48 | Verify the destination service instance is created. Then navigate the destination service instance and verify the destinations are created. 49 | -------------------------------------------------------------------------------- /cf-service-destination/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: destination.reference.sample 3 | version: "1.0.0" 4 | 5 | modules: 6 | - name: my-destination-content 7 | type: com.sap.application.content 8 | build-parameters: 9 | no-source: true 10 | requires: 11 | - name: xsuaa-service # service key will be implicitly created and used in "destination-to-uaa" 12 | - name: workflow_service 13 | parameters: 14 | service-key: 15 | name: workflow_sk-${timestamp} # service key name is defined here so a custom configuration parameters can be used during the service key creation 16 | config: 17 | credential-type: x509 18 | x509: 19 | key-length: 4096 20 | validity: 1 21 | validity-type: YEARS 22 | - name: destination-service-example # service key will be implicitly created and used to deploy the destination content 23 | parameters: 24 | content-target: true 25 | parameters: 26 | content: 27 | instance: 28 | existing_destinations_policy: update # configure whether you want to allow destination changes in 29 | destinations: 30 | - Name: destination-to-uaa 31 | Description: My Destination to xsuaa 32 | ServiceInstanceName: xsuaa-service 33 | - Name: destination-to-workflow 34 | Description: My Destination to workflow 35 | ServiceInstanceName: workflow_service 36 | ServiceKeyName: workflow_sk-${timestamp} 37 | 38 | resources: 39 | - name: destination-service-example 40 | type: org.cloudfoundry.managed-service 41 | parameters: 42 | service-plan: lite 43 | service: destination 44 | - name: xsuaa-service 45 | type: org.cloudfoundry.managed-service 46 | parameters: 47 | service: xsuaa 48 | service-plan: application 49 | - name: workflow_service 50 | parameters: 51 | service-plan: standard 52 | service: workflow 53 | type: org.cloudfoundry.managed-service 54 | -------------------------------------------------------------------------------- /cf-service-destination/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: destination.reference.sample 3 | version: "1.0.0" 4 | 5 | modules: 6 | - name: my-destination-content 7 | type: com.sap.application.content 8 | requires: 9 | - name: xsuaa-service # service key will be implicitly created and used in "destination-to-uaa" 10 | - name: workflow_service 11 | parameters: 12 | service-key: 13 | name: workflow_sk-${timestamp} # service key name is defined here so a custom configuration parameters can be used during the service key creation 14 | config: 15 | credential-type: x509 16 | x509: 17 | key-length: 4096 18 | validity: 1 19 | validity-type: YEARS 20 | - name: destination-service-example # service key will be implicitly created and used to deploy the destination content 21 | parameters: 22 | content-target: true 23 | parameters: 24 | content: 25 | instance: 26 | existing_destinations_policy: update # configure whether you want to allow destination changes in 27 | destinations: 28 | - Name: destination-to-uaa 29 | Description: My Destination to xsuaa 30 | ServiceInstanceName: xsuaa-service 31 | - Name: destination-to-workflow 32 | Description: My Destination to workflow 33 | ServiceInstanceName: workflow_service 34 | ServiceKeyName: workflow_sk-${timestamp} 35 | 36 | resources: 37 | - name: destination-service-example 38 | type: org.cloudfoundry.managed-service 39 | parameters: 40 | service-plan: lite 41 | service: destination 42 | - name: xsuaa-service 43 | type: org.cloudfoundry.managed-service 44 | parameters: 45 | service: xsuaa 46 | service-plan: application 47 | - name: workflow_service 48 | parameters: 49 | service-plan: standard 50 | service: workflow 51 | type: org.cloudfoundry.managed-service 52 | -------------------------------------------------------------------------------- /content-deployment/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # SAP Content Deployment 4 | 5 | ## Overview 6 | 7 | An MTA archive deployed in SAP Business Technology Platform Cloud Foundry environment may contain multiple types of content. The section covers SAP specific types of `application content` that excludes link:../cf-app[standard CF applications]. 8 | 9 | Various types of `application content` are deployed using two different approaches: 10 | 11 | * Using temprary deployer application which will receive the content and deploy it to the final backing service 12 | * Using service instance and directly deploying content in the final destination 13 | 14 | The following types are supported: 15 | 16 | * link:./html5-content-deployment[HTML5 Application Repository] 17 | * Worklflow content - using with `workflow` service 18 | * FLP content - using directly `portal` service 19 | * HDI content - using deployer application 20 | * Business Loggging content - using deployer application 21 | 22 | ## Official documentation in SAP Help Portal 23 | 24 | - link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/d3e23196166b443db17b3545c912dfc0.html[Content Deployment] 25 | - link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/177d34d45e3d4fd99f4eeeffc5814cf1.html#loio177d34d45e3d4fd99f4eeeffc5814cf1__section_mtaModuleTypes[MTA Module Types] 26 | -------------------------------------------------------------------------------- /content-deployment/content-deployment-with-recreatable-key/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: destination.name.reference.sample 3 | version: "1.0.0" 4 | 5 | modules: 6 | - name: my-destination-content 7 | type: com.sap.application.content 8 | requires: 9 | - name: xsuaa-service 10 | - name: my_destination_service 11 | parameters: 12 | content-target: true 13 | service-key: 14 | name: destination-service-key-${timestamp} 15 | config: 16 | xsuaa: 17 | credential-type: x509 18 | parameters: 19 | content: 20 | instance: 21 | existing_destinations_policy: update 22 | destinations: 23 | - Name: xsuaa-destination 24 | Description: testing-key-rotation 25 | ServiceInstanceName: xsuaa-service 26 | 27 | resources: 28 | - name: my_destination_service 29 | type: org.cloudfoundry.managed-service 30 | parameters: 31 | service-plan: lite 32 | service: destination 33 | 34 | - name: xsuaa-service 35 | type: org.cloudfoundry.managed-service 36 | parameters: 37 | service: xsuaa 38 | service-plan: application 39 | 40 | 41 | -------------------------------------------------------------------------------- /content-deployment/content-deployment-with-recreatable-key/service_keys_rotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/content-deployment/content-deployment-with-recreatable-key/service_keys_rotation.png -------------------------------------------------------------------------------- /content-deployment/content-deployment-with-recreatable-key/test-destination-gacd-x509.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/content-deployment/content-deployment-with-recreatable-key/test-destination-gacd-x509.mtar -------------------------------------------------------------------------------- /content-deployment/content-deployment-with-service-key-deletion-after-deploy/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Delete Service Keys After Content Deployment 4 | 5 | ## Overview 6 | 7 | This is an extension of the existing content deployment modeling. 8 | 9 | During deployment a number of service keys are used either for retrieving credentials, a content endpoint from the content service instance or any number or required configurations from other service instances (depending on the content service implementation). After the content deploy the generated service key still exist which could lead to creating hundreds of service keys without deleting them. That's why we created a new `delete-service-key-after-deployment` parameter which when specified after the content deploy has finished, we delete the service keys generated during the deploy. This feature does not work for existing-service-keys 10 | 11 | ```yaml 12 | ... 13 | parameters: 14 | content-target: true 15 | service-key: 16 | name: destination-service-key-${timestamp} 17 | config: 18 | xsuaa: 19 | credential-type: x509 20 | delete-service-key-after-deployment: true 21 | ``` 22 | 23 | ## Try it out 24 | 25 | You can test the feature by executing in this folder: 26 | ``` 27 | cf deploy 28 | ``` 29 | 30 | This will create two services and create service keys for each of them but the content deploy has finished, it will delete the generated service key for `my_destination_service` 31 | 32 | ## Clean up resources 33 | It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command: 34 | ``` bash 35 | $ cf undeploy -f --delete-services --delete-service-keys 36 | ``` 37 | 38 | ## Official related documentation in SAP Help Portal 39 | 40 | - link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/d3e23196166b443db17b3545c912dfc0.html[Content Deployment] 41 | - link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/177d34d45e3d4fd99f4eeeffc5814cf1.html#loio177d34d45e3d4fd99f4eeeffc5814cf1__section_mtaModuleTypes[MTA Module Types] 42 | -------------------------------------------------------------------------------- /content-deployment/content-deployment-with-service-key-deletion-after-deploy/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: destination.name.reference.sample 3 | version: "1.0.0" 4 | 5 | modules: 6 | - name: my-destination-content 7 | type: com.sap.application.content 8 | requires: 9 | - name: xsuaa-service 10 | - name: my_destination_service 11 | parameters: 12 | content-target: true 13 | service-key: 14 | name: destination-service-key-${timestamp} 15 | config: 16 | xsuaa: 17 | credential-type: x509 18 | delete-service-key-after-deployment: true 19 | parameters: 20 | content: 21 | instance: 22 | existing_destinations_policy: update 23 | destinations: 24 | - Name: xsuaa-destination 25 | Description: testing-key-rotation 26 | ServiceInstanceName: xsuaa-service 27 | 28 | resources: 29 | - name: my_destination_service 30 | type: org.cloudfoundry.managed-service 31 | parameters: 32 | service-plan: lite 33 | service: destination 34 | 35 | - name: xsuaa-service 36 | type: org.cloudfoundry.managed-service 37 | parameters: 38 | service: xsuaa 39 | service-plan: application -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/content/content.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/content-deployment/html5-content-deployment/content/content.zip -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: ui5MTA 2 | _schema-version: '3.1' 3 | modules: 4 | - name: ui5module 5 | type: com.sap.application.content 6 | path: content/content.zip 7 | requires: 8 | - name: ui5-repo-service-instance 9 | parameters: 10 | content-target: true 11 | resources: 12 | - name: ui5-repo-service-instance 13 | parameters: 14 | service-plan: app-host 15 | service: html5-apps-repo 16 | type: org.cloudfoundry.managed-service 17 | version: 0.0.1 -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-certificates/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Generic Application Content Deployment With Service Key With XSUAA managed certificates 4 | 5 | The Deployment Service is capable of deploying content to services using a service key that has a 'certificate', 'key' and 'clientId'. This way the Deployment Service does not use the standard token exchange with 'clientId' and 'clientSecret' but uses the provided certificate (mTLS). 6 | 7 | # Try it out 8 | In the current directory execute `cf deploy`. This will automatically assemble the MTA archive and deploy it: 9 | 10 | ```bash 11 | $ cf deploy 12 | Deploying multi-target app archive */with-certificates/ui5MTA.mtar in org ******** / space ******** as ********... 13 | 14 | Uploading 1 files... 15 | */with-certificates/ui5MTA.mtar 16 | OK 17 | Operation ID: ******** 18 | Deploying in org "********" and space "********" 19 | Detected MTA schema version: "3" 20 | No deployed MTA detected - this is initial deployment 21 | Detected new MTA version: "0.0.1" 22 | Processing service "ui5-repo-service-instance"... 23 | Creating service "ui5-repo-service-instance" from MTA resource "ui5-repo-service-instance"... 24 | 1 of 1 done 25 | Creating service key "html5-service-key" for service "ui5-repo-service-instance"... 26 | Uploading content module "ui5module" in target service "ui5-repo-service-instance"... 27 | Deploying content module "ui5module" in target service "ui5-repo-service-instance"... 28 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 29 | Process finished. 30 | ``` -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-certificates/content/content.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/content-deployment/html5-content-deployment/with-certificates/content/content.zip -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-certificates/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: ui5MTA 2 | _schema-version: '3.1' 3 | version: 0.0.1 4 | 5 | modules: 6 | - name: ui5module 7 | type: com.sap.application.content 8 | path: content/content.zip 9 | requires: 10 | - name: ui5-repo-service-instance 11 | parameters: 12 | content-target: true 13 | service-key: 14 | name: html5-service-key 15 | config: 16 | xsuaa: 17 | credential-type: x509 18 | x509: 19 | key-length: 2048 20 | validity: 7 21 | validity-type: DAYS 22 | 23 | resources: 24 | - name: ui5-repo-service-instance 25 | parameters: 26 | service-plan: app-host 27 | service: html5-apps-repo 28 | type: org.cloudfoundry.managed-service 29 | -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-existing-key/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Generic Application Content Deployment With Existing Key 4 | 5 | Another option is to deploy Generic Application Content to an already existing service instance, perhaps owned by another MTA. This can be done utilizing the `org.cloudfoundry.existing-service-key` resource type as shown in the `mtad.yaml`. 6 | 7 | # Prerequisites 8 | This example requires the service and service key to already be existing. The easiest way to ensure that is to run the link:/content-deployment[previous example] beforehand. 9 | 10 | # Try it out 11 | In the current directory execute `cf deploy`. This will automatically assemble the MTA archive and deploy it: 12 | 13 | ```bash 14 | $ cf deploy 15 | Deploying multi-target app archive */with-existing-key/ui5MTA-with-key.mtar in org ******** / space ******** as ********... 16 | 17 | Uploading 1 files... 18 | */with-existing-key/ui5MTA-with-key.mtar 19 | OK 20 | Deploying in org "********" and space "********" 21 | Detected MTA schema version: "3" 22 | No deployed MTA detected - this is initial deployment 23 | Detected new MTA version: "0.0.1" 24 | Uploading content module "ui5module" in target service "ui5module-ui5-repo-service-instance-credentials"... 25 | Deploying content module "ui5module" in target service "ui5module-ui5-repo-service-instance-credentials"... 26 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 27 | Process finished. 28 | ``` -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-existing-key/content/content.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/content-deployment/html5-content-deployment/with-existing-key/content/content.zip -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-existing-key/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: ui5MTA-with-key 2 | _schema-version: '3.1' 3 | modules: 4 | - name: ui5module 5 | type: com.sap.application.content 6 | path: content/content.zip 7 | requires: 8 | - name: ui5module-ui5-repo-service-instance-credentials 9 | parameters: 10 | content-target: true 11 | resources: 12 | - name: ui5module-ui5-repo-service-instance-credentials # the name of the existing service key 13 | parameters: 14 | service-name: ui5-repo-service-instance # the name of the service 15 | type: org.cloudfoundry.existing-service-key 16 | version: 0.0.1 -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-user-provided-service/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Generic Application Content Deployment With User-Provided Service 4 | 5 | Another option is to deploy Generic Application Content with a user-provided service. 6 | 7 | This can be done utilizing the `org.cloudfoundry.user-provided-service` resource type as shown in the `mtad.yaml`. 8 | 9 | # Prerequisites 10 | This example requires a content deployer agent (app or service) to already be existing. 11 | However, it doesn't have to be in the same space as the deployment. 12 | 13 | NOTE: The credentials that will be used for the content deployment *must* be in either 14 | the user-provided service's credentials (passed either as an inline json or a json file when creating the service) 15 | _or_ 16 | the `config` parameter of the resource definition. 17 | 18 | link:https://cli.cloudfoundry.org/en-US/v7/create-user-provided-service.html[Creating user-provided services] 19 | 20 | # Try it out 21 | In the current directory execute `cf deploy`. This will automatically assemble the MTA archive and deploy it: 22 | 23 | ```bash 24 | $ cf deploy 25 | Deploying multi-target app archive */with-user-provided-service/ui5MTA-with-ups.mtar in org ******** / space ******** as ********... 26 | 27 | Uploading 1 files... 28 | */with-user-provided-service/ui5MTA-with-ups.mtar 29 | OK 30 | Deploying in org "********" and space "********" 31 | Detected MTA schema version: "3" 32 | No deployed MTA detected - this is initial deployment 33 | Detected new MTA version: "0.0.1" 34 | Uploading content module "ui5module" in target service "ui5-repo-service-instance-credentials"... 35 | Deploying content module "ui5module" in target service "ui5-repo-service-instance-credentials"... 36 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 37 | Process finished. 38 | ``` -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-user-provided-service/content/content.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/content-deployment/html5-content-deployment/with-user-provided-service/content/content.zip -------------------------------------------------------------------------------- /content-deployment/html5-content-deployment/with-user-provided-service/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: ui5MTA-with-ups 2 | _schema-version: '3.1' 3 | version: 0.0.1 4 | 5 | modules: 6 | - name: ui5module 7 | type: com.sap.application.content 8 | path: content/content.zip 9 | requires: 10 | - name: ui5-repo-service-instance-credentials 11 | parameters: 12 | content-target: true 13 | 14 | resources: 15 | - name: ui5-repo-service-instance-credentials # the name of the user provided service 16 | type: org.cloudfoundry.user-provided-service 17 | parameters: 18 | config: 19 | # the credentials could either be here or passed to the cli when creating the service 20 | content_endpoint: "https://my.content.backend.com" # Endpoint, implementing generic content deploy API. 21 | uaa: 22 | clientid: "my-client-id" 23 | clientsecret: "my-client-secret" 24 | url: https://my-uaa.authentication.sap.hana.ondemand.com # uaa endpoint which is used to get oauth token for further calls to content endpoint 25 | # if the service exists, include this so as to not overwrite the credentials 26 | #skip-service-updates: 27 | #parameters: true 28 | 29 | -------------------------------------------------------------------------------- /create-managed-services/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/create-managed-services/appBits.zip -------------------------------------------------------------------------------- /create-managed-services/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | resources: 5 | - name: my-cf-service-instance-resource 6 | type: org.cloudfoundry.managed-service 7 | parameters: 8 | service-name: "my-logging-service-instance-name" #optional, can be skipped 9 | service-plan: "lite" # set the service plan to use 10 | service: application-logs #set the service offering (label) 11 | # config: #optional, can configure service creation/update with service speciffic parameters 12 | # service-config-key: "service-config-value" 13 | 14 | modules: 15 | #A cf app which will be bound to the service 16 | - name: my-mta-managed-app-module 17 | type: application 18 | path: "appBits.zip" 19 | requires: 20 | - name: my-cf-service-instance-resource 21 | parameters: 22 | config: 23 | binding-config-key: "binding-config-value" -------------------------------------------------------------------------------- /create-managed-services/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-cf-service-instance-resource 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-name: "my-logging-service-instance-name" #optional, can be skipped 10 | service-plan: "lite" # set the service plan to use 11 | service: application-logs #set the service offering (label) 12 | # config: #optional, can configure service creation/update with service speciffic parameters 13 | # service-config-key: "service-config-value" 14 | 15 | # modules: 16 | # #A cf app which will be bound to the service 17 | # - name: my-mta-managed-app-module 18 | # type: application 19 | # path: "appBits.zip" 20 | # requires: 21 | # - name: my-cf-service-instance-resource 22 | # parameters: 23 | # config: 24 | # binding-config-key: "binding-config-value" -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/README.adoc: -------------------------------------------------------------------------------- 1 | WARNING: THE SCENARIO WITH MTA.YAML AND (cloud) MBT IS NOT CURRENTLY FUNCTIONAL! For modelling with mtad.yaml please refer to link:../cross-mta-configurations[Cross MTA configurations example] 2 | 3 | Cross MTA configurations is a feature, allowing for consumption of external string values in the mta(d).yaml during deploy time. 4 | The values are usually provided by other MTAs during their deployments and most-often contain alocated routes mapped to apps in those mtas. Thus a 'service discovery' is achieved at deploy-time. 5 | 6 | Since the SAP Cloud Deployment service persists those configurations until the providing MTA is undeployed, they can be used to also hold arbitrary configuration data - e.g. org/space speciffic settings which don't fit an extension descriptor. 7 | 8 | help.sap.com: https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/b8e1953a618e47e1bd3c3a60c213226e.html 9 | -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/consumer/Staticfile.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cross-mta-config-with-dev-descriptor/consumer/Staticfile.zip -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/consumer/ci.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: '3.1' 2 | ID: test.consumer.ci 3 | extends: test.consumer 4 | 5 | parameters: 6 | env: ci -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/consumer/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: test.consumer 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #default value for a global property. can be overwritten with an *.mtaext 7 | env: dev 8 | 9 | 10 | resources: 11 | #This is how you consume configurations persisted in the deployer 12 | - name: external-configurations 13 | type: configuration 14 | parameters: #all optional but it makes sense for at least one to be used 15 | #you can select which exact configuration to consume with a single param in a *.mtaext file 16 | provider-id: test.provider:configuration_${env} 17 | target: 18 | org: ${org} 19 | space: ${space} 20 | version: ">=0.0.0" 21 | 22 | #a cf backing service using the configs 23 | - name: myBackingService 24 | type: org.cloudfoundry.managed-service 25 | requires: #A resource can consume another ressource 26 | - name: external-configurations 27 | parameters: 28 | service: application-logs 29 | service-plan: lite 30 | #using a configuration value to select the e.g. service name 31 | service-name: ~{external-configurations/a-config-property} 32 | #modifying the config value and using it as a service tag 33 | customParamValue: ~{external-configurations/a-config-property}.customized_tag 34 | service-tags: 35 | - ${customParamValue} 36 | 37 | modules: 38 | #A cf app consuming the configuration 39 | - name: staticapp 40 | type: staticfile 41 | path: Staticfile.zip 42 | parameters: 43 | no-route: true 44 | no-start: true 45 | #A parameter consuming a config 46 | the-config-in-module-parameter: ~{external-configurations/a-config-property}.inModuleParameter 47 | properties: #defines env variables 48 | #one can directly reference a config without requires->properties and without explicitly specifying parameter names elsewhere 49 | property-directly-referencing-the-config: ~{external-configurations/a-config-property}.directly 50 | via-module-parameter-value: ${the-config-in-module-parameter} 51 | requires: 52 | - name: external-configurations 53 | parameters: 54 | #configs can be referenced form a parameter 55 | param-in-requires: ~{a-config-property}.inRequiresParam 56 | properties: #also define env variables referencing the config 57 | #references a property from the external config 58 | property-referencing-config-in-requires: ~{a-config-property}.inRequiresProperty 59 | #parameters within a requires can be consumed as: 60 | via-param-in-requires: ${param-in-requires}.inRequiresProperty 61 | #binding 62 | - name: myBackingService 63 | -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/consumer/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: test.consumer 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #default value for a global property. can be overwritten with an *.mtaext 7 | env: dev 8 | 9 | 10 | resources: 11 | #This is how you consume configurations persisted in the deployer 12 | - name: external-configurations 13 | type: configuration 14 | parameters: #all optional but it makes sense for at least one to be used 15 | #you can select which exact configuration to consume with a single param in a *.mtaext file 16 | provider-id: test.provider:configuration_${env} 17 | target: 18 | org: ${org} 19 | space: ${space} 20 | version: ">=0.0.0" 21 | 22 | #a cf backing service using the configs 23 | - name: myBackingService 24 | type: org.cloudfoundry.managed-service 25 | requires: #A resource can consume another ressource 26 | - name: external-configurations 27 | parameters: 28 | service: application-logs 29 | service-plan: lite 30 | #using a configuration value to select the e.g. service name 31 | service-name: ~{external-configurations/a-config-property} 32 | #modifying the config value and using it as a service tag 33 | customParamValue: ~{external-configurations/a-config-property}.customized_tag 34 | service-tags: 35 | - ${customParamValue} 36 | 37 | modules: 38 | #A cf app consuming the configuration 39 | - name: staticapp 40 | type: staticfile 41 | path: Staticfile.zip 42 | parameters: 43 | no-route: true 44 | no-start: true 45 | #A parameter consuming a config 46 | the-config-in-module-parameter: ~{external-configurations/a-config-property}.inModuleParameter 47 | properties: #defines env variables 48 | #one can directly reference a config without requires->properties and without explicitly specifying parameter names elsewhere 49 | property-directly-referencing-the-config: ~{external-configurations/a-config-property}.directly 50 | via-module-parameter-value: ${the-config-in-module-parameter} 51 | requires: 52 | - name: external-configurations 53 | parameters: 54 | #configs can be referenced form a parameter 55 | param-in-requires: ~{a-config-property}.inRequiresParam 56 | properties: #also define env variables referencing the config 57 | #references a property from the external config 58 | property-referencing-config-in-requires: ~{a-config-property}.inRequiresProperty 59 | #parameters within a requires can be consumed as: 60 | via-param-in-requires: ${param-in-requires}.inRequiresProperty 61 | #binding 62 | - name: myBackingService 63 | -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/provider/Staticfile.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cross-mta-config-with-dev-descriptor/provider/Staticfile.zip -------------------------------------------------------------------------------- /cross-mta-config-with-dev-descriptor/provider/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: test.provider 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | # Limitation: dummy application used to provide the configurations 7 | - name: configMtaApp 8 | type: staticfile 9 | path: "Staticfile.zip" 10 | parameters: 11 | no-start: true 12 | no-route: true 13 | memory: 1M 14 | provides: 15 | - name: configuration_dev 16 | public: true 17 | properties: 18 | a-config-property: ${default-url} 19 | parameters: 20 | #those are optional and limit the scope where the config can be consumed 21 | visibility: 22 | - org: ${org} 23 | space: ${space} 24 | - name: configuration_ci 25 | public: true 26 | properties: 27 | a-config-property: myCIService 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /cross-mta-configurations/consumer/Staticfile.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cross-mta-configurations/consumer/Staticfile.zip -------------------------------------------------------------------------------- /cross-mta-configurations/consumer/ci.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: '3.1' 2 | ID: test.consumer.ci 3 | extends: test.consumer 4 | 5 | parameters: 6 | env: ci -------------------------------------------------------------------------------- /cross-mta-configurations/consumer/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: test.consumer 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #default value for a global property. can be overwritten with an *.mtaext 7 | env: dev 8 | 9 | 10 | resources: 11 | #This is how you consume configurations persisted in the deployer 12 | - name: external-configurations 13 | type: configuration 14 | parameters: #all optional but it makes sense for at least one to be used 15 | #you can select which exact configuration to consume with a single param in a *.mtaext file 16 | provider-id: test.provider:configuration_${env} 17 | target: 18 | org: ${org} 19 | space: ${space} 20 | version: ">=0.0.0" 21 | 22 | #a cf backing service using the configs 23 | - name: myBackingService 24 | type: org.cloudfoundry.managed-service 25 | requires: #A resource can consume another ressource 26 | - name: external-configurations 27 | parameters: 28 | service: application-logs 29 | service-plan: lite 30 | #using a configuration value to select the e.g. service name 31 | service-name: ~{external-configurations/a-config-property} 32 | #modifying the config value and using it as a service tag 33 | customParamValue: ~{external-configurations/a-config-property}.customized_tag 34 | service-tags: 35 | - ${customParamValue} 36 | 37 | modules: 38 | #A cf app consuming the configuration 39 | - name: staticapp 40 | type: staticfile 41 | path: Staticfile.zip 42 | parameters: 43 | no-route: true 44 | no-start: true 45 | #A parameter consuming a config 46 | the-config-in-module-parameter: ~{external-configurations/a-config-property}.inModuleParameter 47 | properties: #defines env variables 48 | #one can directly reference a config without requires->properties and without explicitly specifying parameter names elsewhere 49 | property-directly-referencing-the-config: ~{external-configurations/a-config-property}.directly 50 | via-module-parameter-value: ${the-config-in-module-parameter} 51 | requires: 52 | - name: external-configurations 53 | parameters: 54 | #configs can be referenced form a parameter 55 | param-in-requires: ~{a-config-property}.inRequiresParam 56 | properties: #also define env variables referencing the config 57 | #references a property from the external config 58 | property-referencing-config-in-requires: ~{a-config-property}.inRequiresProperty 59 | #parameters within a requires can be consumed as: 60 | via-param-in-requires: ${param-in-requires}.inRequiresProperty 61 | #binding 62 | - name: myBackingService 63 | -------------------------------------------------------------------------------- /cross-mta-configurations/provider/Staticfile.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/cross-mta-configurations/provider/Staticfile.zip -------------------------------------------------------------------------------- /cross-mta-configurations/provider/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: test.provider 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | # Limitation: dummy application used to provide the configurations 7 | - name: configMtaApp 8 | type: staticfile 9 | path: "Staticfile.zip" 10 | parameters: 11 | no-start: true 12 | no-route: true 13 | memory: 1M 14 | provides: 15 | - name: configuration_dev 16 | public: true 17 | properties: 18 | a-config-property: myDevService 19 | parameters: 20 | #those are optional and limit the scope where the config can be consumed 21 | visibility: 22 | - org: ${org} 23 | space: ${space} 24 | - name: configuration_ci 25 | public: true 26 | properties: 27 | a-config-property: myCIService 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /deploy-with-sequential-resources/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/deploy-with-sequential-resources/appBits.zip -------------------------------------------------------------------------------- /deploy-with-sequential-resources/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.0.0 2 | ID: multiple-anatz 3 | version: 3.0.0 4 | 5 | modules: 6 | - name: multiple-anatz 7 | type: staticfile 8 | path: appBits.zip 9 | resources: 10 | - name: serviceA 11 | type: org.cloudfoundry.managed-service 12 | parameters: 13 | service: application-logs 14 | service-plan: lite 15 | processed-after: [serviceB, serviceC] 16 | - name: serviceB 17 | type: org.cloudfoundry.managed-service 18 | parameters: 19 | service: application-logs 20 | service-plan: lite 21 | processed-after: [serviceD] 22 | - name: serviceC 23 | type: org.cloudfoundry.managed-service 24 | parameters: 25 | service: application-logs 26 | service-plan: lite 27 | processed-after: [serviceD] 28 | - name: serviceD 29 | type: org.cloudfoundry.managed-service 30 | parameters: 31 | service: application-logs 32 | service-plan: lite 33 | -------------------------------------------------------------------------------- /deploy-with-sequential-resources/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.0.0 2 | ID: multiple-anatz 3 | version: 3.0.0 4 | 5 | modules: 6 | - name: multiple-anatz 7 | type: staticfile 8 | path: appBits.zip 9 | resources: 10 | - name: serviceA 11 | type: org.cloudfoundry.managed-service 12 | parameters: 13 | service: application-logs 14 | service-plan: lite 15 | processed-after: [serviceB, serviceC] 16 | - name: serviceB 17 | type: org.cloudfoundry.managed-service 18 | parameters: 19 | service: application-logs 20 | service-plan: lite 21 | processed-after: [serviceD] 22 | - name: serviceC 23 | type: org.cloudfoundry.managed-service 24 | parameters: 25 | service: application-logs 26 | service-plan: lite 27 | processed-after: [serviceD] 28 | - name: serviceD 29 | type: org.cloudfoundry.managed-service 30 | parameters: 31 | service: application-logs 32 | service-plan: lite 33 | -------------------------------------------------------------------------------- /deploy-with-sequential-resources/multiple-anatz.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/deploy-with-sequential-resources/multiple-anatz.mtar -------------------------------------------------------------------------------- /deploy-with-url/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Deploy an MTAR referenced by a remote URL 4 | 5 | This example shows how to deploy an MTAR that isn't present on your local system. 6 | 7 | NOTE: With this scenario, the Deploy Service *will not* check for any ongoing operations with the current MTA. 8 | 9 | # Try it out 10 | 11 | ## Deploy the MTA 12 | 13 | ``` bash 14 | $ echo "https://github.com/SAP-samples/cf-mta-examples/blob/main/deploy-with-url/anatz.zip?raw=true" | cf deploy ; 15 | ``` 16 | 17 | ## Examine the result 18 | 19 | ### List the deployed MTA 20 | 21 | ``` bash 22 | $ cf mta anatz ; 23 | Showing health and status for multi-target app anatz in org ****** / space ****** as ******... 24 | OK 25 | Version: 4.0.0 26 | Namespace: 27 | 28 | Apps: 29 | name requested state instances memory disk urls 30 | anatz started 1/1 64M 1G --anatz.cfapps.sap.hana.ondemand.com 31 | ``` 32 | 33 | ### List app status and attributes 34 | 35 | ``` bash 36 | $ cf app anatz ; 37 | Showing health and status for app anatz in org ****** / space ****** as ******... 38 | 39 | name: anatz 40 | requested state: started 41 | routes: --anatz.cfapps.sap.hana.ondemand.com 42 | last uploaded: Wed 03 Feb 11:33:55 EET 2021 43 | stack: cflinuxfs4 44 | buildpacks: staticfile 45 | 46 | type: web 47 | instances: 1/1 48 | memory usage: 64M 49 | state since cpu memory disk details 50 | #0 running 2021-02-03T09:34:39Z 0.5% 13.8M of 64M 6M of 1G 51 | ``` 52 | 53 | ## Clean up resources 54 | It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command: 55 | ``` bash 56 | $ cf undeploy -f --delete-services 57 | ``` 58 | 59 | -------------------------------------------------------------------------------- /deploy-with-url/anatz.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/deploy-with-url/anatz.zip -------------------------------------------------------------------------------- /dynamic-parameters/README.adoc: -------------------------------------------------------------------------------- 1 | # Dynamic Parameters 2 | :toc: 3 | 4 | ## Overview 5 | 6 | Dynamic Parameters feature enables consumption of entities from existing environment in Cloud Foundry inside of mta descriptor. 7 | 8 | [example] 9 | Currently only supported dynamic parameter is "service guid" of service instances and reference only from other mta resources or as a link:https://github.com/SAP-samples/cf-mta-examples/tree/main/dynamic-parameters/dynamic-parameters-for-cross-mta-configurations[provided module depedency]. Major Schema version of mta project must be 3 or higher 10 | 11 | ## Official documentation in Help SAP Portal 12 | - link:https://help.sap.com/docs/btp/sap-business-technology-platform/parameters-and-properties#dynamic-parameters[Dynamic Parameters] 13 | 14 | ## Execute Deploy 15 | 16 | ```bash 17 | $ cf deploy ./ 18 | ``` 19 | 20 | ### Examine the result 21 | Check resolved parameters by inspecting VCAP_SERVICES: 22 | ```text 23 | cf env app 24 | ... 25 | VCAP_SERVICES: { 26 | "user-provided": [ 27 | { 28 | "binding_guid": "d3483655-4368-4bbb-ba28-095614106faf", 29 | "binding_name": null, 30 | "credentials": {}, 31 | "instance_guid": "9932d7b2-8dc6-4448-a05c-42b4fc065317", 32 | "instance_name": "test-usp2", 33 | "label": "user-provided", 34 | "name": "test-usp2", 35 | "syslog_drain_url": "", 36 | "tags": [], 37 | "volume_mounts": [] 38 | }, 39 | { 40 | "binding_guid": "f8bee8e1-d809-42eb-93bd-6d63d708f3b1", 41 | "binding_name": null, 42 | "credentials": { 43 | "persistence-service-guid": "9932d7b2-8dc6-4448-a05c-42b4fc065317" 44 | }, 45 | "instance_guid": "f6566e2c-186a-492b-8ba8-09268e85fea5", 46 | "instance_name": "test-usp", 47 | "label": "user-provided", 48 | "name": "test-usp", 49 | "syslog_drain_url": "", 50 | "tags": [], 51 | "volume_mounts": [] 52 | } 53 | ] 54 | } 55 | ... 56 | ``` 57 | -------------------------------------------------------------------------------- /dynamic-parameters/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/dynamic-parameters/appBits.zip -------------------------------------------------------------------------------- /dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/README.adoc: -------------------------------------------------------------------------------- 1 | # Dynamic Parameters for Configuration Entries 2 | :toc: 3 | 4 | ## Overview 5 | 6 | Dynamic Parameters can also be referenced under a module's provided dependencies, which allows them to be used in link:https://github.com/SAP-samples/cf-mta-examples/tree/main/cross-mta-configurations[cross mta configurations] 7 | 8 | ## Deploy provider MTA 9 | 10 | ```bash 11 | $ cf deploy deploy-cross-mta-configuration-provider/ 12 | ``` 13 | 14 | ## Deploy consumer MTA 15 | 16 | ```bash 17 | $ cf deploy deploy-cross-mta-configuration-consumer/ 18 | ``` 19 | 20 | ### Examine the result 21 | Check resolved parameters under the user-provided variables for the consumer app: 22 | ```text 23 | cf env anatz-consumer 24 | ... 25 | DEPLOY_ATTRIBUTES: { 26 | "app-content-digest" : "B0FF19ED574D37E24C1FB7AE57B81806", 27 | "no-start" : true 28 | } 29 | reference_instance: 26c85b8c-6ad4-4ad2-bdea-d87e3a7692f2 30 | ... 31 | ``` 32 | -------------------------------------------------------------------------------- /dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/deploy-cross-mta-configuration-consumer/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/deploy-cross-mta-configuration-consumer/appBits.zip -------------------------------------------------------------------------------- /dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/deploy-cross-mta-configuration-consumer/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3 2 | ID: dynamic.service.guid.consumer 3 | version: 1.0.0 4 | 5 | modules: 6 | - name: anatz-consumer 7 | type: staticfile 8 | path: appBits.zip 9 | parameters: 10 | memory: 128M 11 | no-start: true 12 | requires: 13 | - name: ups-config 14 | properties: 15 | reference_instance: ~{ups-instanceid} 16 | 17 | resources: 18 | - name: ups-config 19 | type: configuration 20 | parameters: 21 | provider-nid: "mta" 22 | provider-id: "dynamic.service.guid.producer:ups-guid" 23 | version: ">=1.0.0" 24 | target: 25 | org: ${org} 26 | space: ${space} 27 | -------------------------------------------------------------------------------- /dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/deploy-cross-mta-configuration-provider/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/deploy-cross-mta-configuration-provider/appBits.zip -------------------------------------------------------------------------------- /dynamic-parameters/dynamic-parameters-for-cross-mta-configurations/deploy-cross-mta-configuration-provider/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3 2 | ID: dynamic.service.guid.producer 3 | version: 1.0.0 4 | 5 | modules: 6 | - name: app-guid-provider 7 | type: staticfile 8 | path: appBits.zip 9 | parameters: 10 | memory: 128M 11 | no-start: true 12 | provides: 13 | - name: ups-guid 14 | public: true 15 | parameters: 16 | visibility: 17 | - org: ${org} 18 | space: ${space} 19 | properties: 20 | ups-instanceid: ~{test-ups/my-ups-service-guid} 21 | requires: 22 | - name: test-ups 23 | 24 | resources: 25 | - name: test-ups 26 | type: org.cloudfoundry.user-provided-service 27 | properties: 28 | my-ups-service-guid: ${service-guid} 29 | -------------------------------------------------------------------------------- /dynamic-parameters/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.0.0" 2 | ID: dynamic.service.guid 3 | version: 1.0.0 4 | 5 | modules: 6 | - name: app 7 | type: staticfile 8 | path: appBits.zip 9 | requires: 10 | - name: test-usp 11 | - name: test-usp2 12 | 13 | resources: 14 | - name: test-usp 15 | type: org.cloudfoundry.user-provided-service 16 | parameters: 17 | config: 18 | persistence-service-guid: ~{test-usp2/my-db-service-guid} 19 | requires: 20 | - name: test-usp2 21 | processed-after: [test-usp2] 22 | 23 | 24 | - name: test-usp2 25 | type: org.cloudfoundry.user-provided-service 26 | properties: 27 | my-db-service-guid: ${service-guid} 28 | -------------------------------------------------------------------------------- /dynatrace-monitoring/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.1.0 2 | ID: enable.dynatrace.example 3 | version: 1.0.0 4 | 5 | resources: 6 | - name: my-dynatrace-ups # The dynatrace user provided service 7 | type: org.cloudfoundry.user-provided-service 8 | parameters: 9 | service-name: my-dynatrace-credentials # Note! The service name must contain 'dynatrace' for the build pack to detect it. 10 | config: # The concrete credentials. Note! Consider specifying such in an extension descriptor (*.mtaext), external to a packaged MTA archive (*.mtar). 11 | environmentid: "YOUR_ENVIRONMENTID" 12 | apitoken: "YOUR_API_TOKEN" 13 | apiurl: "https:///e//api" 14 | 15 | modules: 16 | - name: my-java-app-module 17 | type: application 18 | path: gs-rest-service/complete/target/gs-rest-service-0.1.0.jar 19 | parameters: 20 | buildpack: sap_java_buildpack # Not all buildpacks can enable dynatrace integration 21 | app-name: spring-app 22 | requires: 23 | - name: my-dynatrace-ups # Binding to the dynatrace service 24 | properties: # Environemnt variables 25 | DT_CLUSTER_ID: ${app-name} # DT One Agent setting - ignoring application name changes, e.g. during zdm updates. 26 | 27 | -------------------------------------------------------------------------------- /dynatrace-monitoring/service-credentials.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: 3.1.0 2 | ID: dynatrace.credentials 3 | extends: enable.dynatrace.example 4 | version: 1.0.0 5 | 6 | resources: 7 | - name: my-dynatrace-ups 8 | parameters: 9 | config: 10 | environmentid: "YOUR_ENVIRONMENTID" 11 | apitoken: "YOUR_API_TOKEN" 12 | apiurl: "https:///e//api" 13 | -------------------------------------------------------------------------------- /extension-descriptor-different-environments/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/extension-descriptor-different-environments/appBits.zip -------------------------------------------------------------------------------- /extension-descriptor-different-environments/dev.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: my-mta-dev 3 | extends: my-mta 4 | version: 1.0.0 5 | 6 | resources: 7 | - name: my-service 8 | parameters: 9 | service-plan: "lite" -------------------------------------------------------------------------------- /extension-descriptor-different-environments/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 1.0.0 4 | 5 | modules: 6 | #A cf app which will be bound to the service 7 | - name: my-app 8 | type: application 9 | path: "appBits.zip" 10 | requires: 11 | - name: my-service 12 | parameters: 13 | instances: 1 14 | 15 | resources: 16 | - name: my-service 17 | type: org.cloudfoundry.managed-service 18 | parameters: 19 | service-plan: # set the service plan to use 20 | service: application-logs #set the service offering (label) 21 | parameters-metadata: 22 | service-plan: 23 | optional: false # make the parameter required 24 | -------------------------------------------------------------------------------- /extension-descriptor-different-environments/prod-scale-vertically.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: my-mta-prod-scale-vertically 3 | extends: my-mta-prod 4 | version: 1.0.0 5 | 6 | modules: 7 | - name: my-app 8 | parameters: 9 | memory: 2G 10 | 11 | resources: 12 | - name: my-service 13 | parameters: 14 | service-plan: "lite" 15 | -------------------------------------------------------------------------------- /extension-descriptor-different-environments/prod.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: my-mta-prod 3 | extends: my-mta 4 | version: 1.0.0 5 | 6 | modules: 7 | - name: my-app 8 | parameters: 9 | instances: 2 10 | 11 | resources: 12 | - name: my-service 13 | parameters: 14 | service-plan: "lite" -------------------------------------------------------------------------------- /externalize-services-configurations/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "xsappname": "app-name-template-value-to-be-overwritten-in-mta(d).yaml", 3 | "tenant-mode": "dedicated" 4 | } -------------------------------------------------------------------------------- /externalize-services-configurations/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-service-instance 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | path: config.json #The content of the json will be taken as a base 10 | config: #Those configurations will be merged in the config.json content 11 | xsappname: "appname-with-suffix-${space-guid}" 12 | service-plan: "application" 13 | service: xsuaa 14 | - name: my-user-provided-service-instance 15 | type: org.cloudfoundry.user-provided-service 16 | parameters: 17 | path: upsconfig.json #The content of the json will be taken as a base 18 | config: #Those configurations will be merged in the config.json content 19 | xsappname: "appname-with-suffix-${space-guid}" -------------------------------------------------------------------------------- /externalize-services-configurations/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-service-instance 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | path: config.json #The content of the json will be taken as a base 10 | config: #Those configurations will be merged in the config.json content 11 | xsappname: "appname-with-suffix-${space-guid}" 12 | service-plan: "application" 13 | service: xsuaa 14 | - name: my-user-provided-service-instance 15 | type: org.cloudfoundry.user-provided-service 16 | parameters: 17 | path: upsconfig.json #The content of the json will be taken as a base 18 | config: #Those configurations will be merged in the config.json content 19 | xsappname: "appname-with-suffix-${space-guid}" -------------------------------------------------------------------------------- /externalize-services-configurations/upsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "xsappname": "app-name-template-value-to-be-overwritten-in-mta(d).yaml", 3 | "tenant-mode": "dedicated" 4 | } -------------------------------------------------------------------------------- /fail-on-service-update/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/fail-on-service-update/appBits.zip -------------------------------------------------------------------------------- /fail-on-service-update/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: '3.1' 2 | ID: fail-on-service-update-example 3 | version: 1.0.0 4 | 5 | resources: 6 | - name: example-service-instance 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-plan: "lite" 10 | service: application-logs 11 | config: 12 | key: value 13 | fail-on-service-update: 14 | parameters: true 15 | plan: true 16 | tags: true 17 | -------------------------------------------------------------------------------- /fail-on-service-update/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: '3.1' 2 | ID: fail-on-service-update-example 3 | version: 1.0.0 4 | 5 | resources: 6 | - name: example-service-instance 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-plan: "lite" 10 | service: application-logs 11 | config: 12 | key: value 13 | fail-on-service-update: 14 | parameters: true 15 | plan: true 16 | tags: true 17 | -------------------------------------------------------------------------------- /hooks/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Module hooks 4 | 5 | Define and execute hooks at specific phases of module deployment. 6 | 7 | You can use hooks to change the typical deployment process, in this case to enable tasks to be executed during a specific moment of the application deployment. For example, you can set hooks can be executed before or after the actual deployment steps for a module, depending on the applications' need. 8 | 9 | ## Official Documentation 10 | * SAP Help Portal: link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/b9245ba90aa14681a416065df8e8c593.html[Module Hooks] 11 | 12 | ## Activation 13 | 14 | To activate the feature: 15 | 16 | - Use `_schema-version` with major version `3`, for instance `3.1.0` or `3.3.0` 17 | - Add hooks section in the module as well as some hooks 18 | 19 | ```yaml 20 | ... 21 | ID: a.cf.app 22 | _schema-version: 3.3.0 23 | version: 0.0.0 24 | 25 | modules: 26 | - name: cf-app-with-hooks 27 | type: application 28 | path: "appBits.zip" 29 | hooks: 30 | - name: test-hook 31 | type: task 32 | phases: 33 | - blue-green.application.before-stop.idle 34 | parameters: 35 | name: foo-task 36 | command: "echo Hello" 37 | ... 38 | ``` 39 | ## Hooks and extension descriptor 40 | You can also extend module hooks through the extension descriptor. To do so, add the code with your specific parameters. 41 | ##### What can be done 42 | - Parameters section can be modified which includes all properties like name, command, memory and disk quota. 43 | ##### What cannot be done 44 | - Phases of the hooks cannot be modified via extension descriptors 45 | - Type of the hook cannot be modified 46 | - Required dependencies cannot be modified 47 | - New hooks cannot be added 48 | ```yaml 49 | ... 50 | ID: a.cf.app 51 | _schema-version: 3.3 52 | extends: foo 53 | 54 | modules: 55 | - name: cf-app-with-hooks 56 | hooks: 57 | - name: test-hook-1 58 | parameters: 59 | name: foo-task-1 60 | command: "echo Hello" 61 | ... 62 | ``` 63 | 64 | ## Try out 65 | 66 | In the current directory of the repository, run `cf deploy` that will use `mtad.yaml`. This will automatically assemble an MTA archive and deploy it. 67 | ```bash 68 | $cf deploy 69 | Deploying multi-target app archive ~/hooks.mtar in org ****** / space ****** as ******... 70 | ... 71 | Stopping application "cf-app-with-hooks-blue"... 72 | Executing hook "test-hook" 73 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 74 | Starting application "cf-app-with-hooks-blue"... 75 | ... 76 | ``` 77 | -------------------------------------------------------------------------------- /hooks/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/hooks/appBits.zip -------------------------------------------------------------------------------- /hooks/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | modules: 6 | - name: cf-app-with-hooks 7 | type: application 8 | path: "appBits.zip" 9 | hooks: 10 | - name: deploy-before-stop 11 | type: task 12 | phases: 13 | - deploy.application.before-stop 14 | parameters: 15 | command: "echo 'Will be executed before the application stops during normal deployment'" 16 | - name: blue-green-before-stop-idle 17 | type: task 18 | phases: 19 | - blue-green.application.before-stop.idle 20 | parameters: 21 | command: "echo 'Will be executed before the idle application stops during blue-green deployment'" 22 | - name: blue-green-before-stop-live 23 | type: task 24 | phases: 25 | - blue-green.application.before-stop.live 26 | parameters: 27 | command: "echo 'Will be executed before the live application stops during blue-green deployment'" 28 | - name: deploy-after-stop 29 | type: task 30 | phases: 31 | - deploy.application.after-stop 32 | parameters: 33 | command: "echo 'Will be executed after the application stops during normal deployment'" 34 | - name: blue-green-after-stop-idle 35 | type: task 36 | phases: 37 | - blue-green.application.after-stop.idle 38 | parameters: 39 | command: "echo 'Will be executed after the idle application stops during blue-green deployment (resume phase)'" 40 | - name: blue-green-after-stop-live 41 | type: task 42 | phases: 43 | - blue-green.application.after-stop.live 44 | parameters: 45 | command: "echo 'Will be executed after the live application stops during blue-green deployment (resume phase)'" 46 | - name: blue-green-before-unmap-routes-live 47 | type: task 48 | phases: 49 | - blue-green.application.before-unmap-routes.live 50 | parameters: 51 | command: "echo 'Will be executed before the unmapping of the live application routes druing blue-green deployment (resume phase)'" 52 | - name: deploy-before-start 53 | type: task 54 | phases: 55 | - deploy.application.before-start 56 | parameters: 57 | command: "echo 'Will be executed before the application starts during normal deployment'" 58 | - name: blue-green-before-start-idle 59 | type: task 60 | phases: 61 | - blue-green.application.before-start.idle 62 | parameters: 63 | command: "echo 'Will be executed before the idle application starts during blue-green deployment'" 64 | - name: blue-green-before-start-live 65 | type: task 66 | phases: 67 | - blue-green.application.before-start.live 68 | parameters: 69 | command: "echo 'Will be executed before the live application start during blue-green deployment (resume phase)'" 70 | -------------------------------------------------------------------------------- /hooks/output/all-hooks-execution.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: GREEN 10 | New MTA color: BLUE 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-blue" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-blue"... 15 | Scaling application "cf-app-with-hooks-blue" to "1" instances... 16 | Staging application "cf-app-with-hooks-blue"... 17 | Application "cf-app-with-hooks-blue" staged 18 | Executing hook "blue-green-before-start-idle" 19 | Executing task "blue-green-before-start-idle" on application "cf-app-with-hooks-blue"... 20 | Starting application "cf-app-with-hooks-blue"... 21 | Application "cf-app-with-hooks-blue" started and available at "********" 22 | Detected new MTA version: "0.0.0" 23 | Deployed MTA version: "0.0.0" 24 | Updating application "cf-app-with-hooks-blue"... 25 | Executing hook "blue-green-before-stop-idle" 26 | Executing task "blue-green-before-stop-idle" on application "cf-app-with-hooks-blue"... 27 | Stopping application "cf-app-with-hooks-blue"... 28 | Executing hook "blue-green-after-stop-idle" 29 | Executing task "blue-green-after-stop-idle" on application "cf-app-with-hooks-blue"... 30 | Executing hook "blue-green-before-start-live" 31 | Executing task "blue-green-before-start-live" on application "cf-app-with-hooks-blue"... 32 | Starting application "cf-app-with-hooks-blue"... 33 | Application "cf-app-with-hooks-blue" started and available at "********" 34 | Executing hook "blue-green-before-unmap-routes-live" 35 | Executing task "blue-green-before-unmap-routes-live" on application "cf-app-with-hooks-green"... 36 | Executing hook "blue-green-before-stop-live" 37 | Executing task "blue-green-before-stop-live" on application "cf-app-with-hooks-green"... 38 | Stopping application "cf-app-with-hooks-green"... 39 | Executing hook "blue-green-after-stop-live" 40 | Executing task "blue-green-after-stop-live" on application "cf-app-with-hooks-green"... 41 | Deleting application "cf-app-with-hooks-green"... 42 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 43 | Process finished. 44 | Use "cf dmol -i ********" to download the logs of the process. 45 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.after-stop.idle.and.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: GREEN 10 | New MTA color: BLUE 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-blue" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-blue"... 15 | Scaling application "cf-app-with-hooks-blue" to "1" instances... 16 | Staging application "cf-app-with-hooks-blue"... 17 | Application "cf-app-with-hooks-blue" staged 18 | Starting application "cf-app-with-hooks-blue"... 19 | Application "cf-app-with-hooks-blue" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-blue"... 23 | Stopping application "cf-app-with-hooks-blue"... 24 | Executing hook "test-hook" 25 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 26 | Starting application "cf-app-with-hooks-blue"... 27 | Application "cf-app-with-hooks-blue" started and available at "********" 28 | Deleting routes for application "cf-app-with-hooks-green"... 29 | Route "********" not deleted since it is in use 30 | Stopping application "cf-app-with-hooks-green"... 31 | Executing hook "test-hook" 32 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 33 | Deleting application "cf-app-with-hooks-green"... 34 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 35 | Process finished. 36 | Use "cf dmol -i ********" to download the logs of the process. 37 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.after-stop.idle.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: GREEN 10 | New MTA color: BLUE 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-blue" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-blue"... 15 | Scaling application "cf-app-with-hooks-blue" to "1" instances... 16 | Staging application "cf-app-with-hooks-blue"... 17 | Application "cf-app-with-hooks-blue" staged 18 | Starting application "cf-app-with-hooks-blue"... 19 | Application "cf-app-with-hooks-blue" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-blue"... 23 | Stopping application "cf-app-with-hooks-blue"... 24 | Executing hook "test-hook" 25 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 26 | Starting application "cf-app-with-hooks-blue"... 27 | Application "cf-app-with-hooks-blue" started and available at "********" 28 | Deleting routes for application "cf-app-with-hooks-green"... 29 | Route "********" not deleted since it is in use 30 | Stopping application "cf-app-with-hooks-green"... 31 | Deleting application "cf-app-with-hooks-green"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | Use "cf dmol -i ********" to download the logs of the process. 35 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.after-stop.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: BLUE 10 | New MTA color: GREEN 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-green" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-green"... 15 | Scaling application "cf-app-with-hooks-green" to "1" instances... 16 | Staging application "cf-app-with-hooks-green"... 17 | Application "cf-app-with-hooks-green" staged 18 | Starting application "cf-app-with-hooks-green"... 19 | Application "cf-app-with-hooks-green" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-green"... 23 | Stopping application "cf-app-with-hooks-green"... 24 | Starting application "cf-app-with-hooks-green"... 25 | Application "cf-app-with-hooks-green" started and available at "********" 26 | Deleting routes for application "cf-app-with-hooks-blue"... 27 | Route "********" not deleted since it is in use 28 | Stopping application "cf-app-with-hooks-blue"... 29 | Executing hook "test-hook" 30 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 31 | Deleting application "cf-app-with-hooks-blue"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | Use "cf dmol -i ********" to download the logs of the process. 35 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-start.idle.and.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: BLUE 10 | New MTA color: GREEN 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-green" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-green"... 15 | Scaling application "cf-app-with-hooks-green" to "1" instances... 16 | Staging application "cf-app-with-hooks-green"... 17 | Application "cf-app-with-hooks-green" staged 18 | Executing hook "test-hook" 19 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 20 | Starting application "cf-app-with-hooks-green"... 21 | Application "cf-app-with-hooks-green" started and available at "********" 22 | Detected new MTA version: "0.0.0" 23 | Deployed MTA version: "0.0.0" 24 | Updating application "cf-app-with-hooks-green"... 25 | Stopping application "cf-app-with-hooks-green"... 26 | Executing hook "test-hook" 27 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 28 | Starting application "cf-app-with-hooks-green"... 29 | Application "cf-app-with-hooks-green" started and available at "********" 30 | Deleting routes for application "cf-app-with-hooks-blue"... 31 | Route "********" not deleted since it is in use 32 | Stopping application "cf-app-with-hooks-blue"... 33 | Deleting application "cf-app-with-hooks-blue"... 34 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 35 | Process finished. 36 | Use "cf dmol -i ********" to download the logs of the process. 37 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-start.idle.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: BLUE 10 | New MTA color: GREEN 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-green" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-green"... 15 | Scaling application "cf-app-with-hooks-green" to "1" instances... 16 | Staging application "cf-app-with-hooks-green"... 17 | Application "cf-app-with-hooks-green" staged 18 | Executing hook "test-hook" 19 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 20 | Starting application "cf-app-with-hooks-green"... 21 | Application "cf-app-with-hooks-green" started and available at "********" 22 | Detected new MTA version: "0.0.0" 23 | Deployed MTA version: "0.0.0" 24 | Updating application "cf-app-with-hooks-green"... 25 | Stopping application "cf-app-with-hooks-green"... 26 | Starting application "cf-app-with-hooks-green"... 27 | Application "cf-app-with-hooks-green" started and available at "********" 28 | Deleting routes for application "cf-app-with-hooks-blue"... 29 | Route "********" not deleted since it is in use 30 | Stopping application "cf-app-with-hooks-blue"... 31 | Deleting application "cf-app-with-hooks-blue"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | Use "cf dmol -i ********" to download the logs of the process. 35 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-start.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: GREEN 10 | New MTA color: BLUE 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-blue" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-blue"... 15 | Scaling application "cf-app-with-hooks-blue" to "1" instances... 16 | Staging application "cf-app-with-hooks-blue"... 17 | Application "cf-app-with-hooks-blue" staged 18 | Starting application "cf-app-with-hooks-blue"... 19 | Application "cf-app-with-hooks-blue" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-blue"... 23 | Stopping application "cf-app-with-hooks-blue"... 24 | Executing hook "test-hook" 25 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 26 | Starting application "cf-app-with-hooks-blue"... 27 | Application "cf-app-with-hooks-blue" started and available at "********" 28 | Deleting routes for application "cf-app-with-hooks-green"... 29 | Route "********" not deleted since it is in use 30 | Stopping application "cf-app-with-hooks-green"... 31 | Deleting application "cf-app-with-hooks-green"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | Use "cf dmol -i ********" to download the logs of the process. 35 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-stop.idle.and.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: BLUE 10 | New MTA color: GREEN 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-green" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-green"... 15 | Scaling application "cf-app-with-hooks-green" to "1" instances... 16 | Staging application "cf-app-with-hooks-green"... 17 | Application "cf-app-with-hooks-green" staged 18 | Starting application "cf-app-with-hooks-green"... 19 | Application "cf-app-with-hooks-green" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-green"... 23 | Executing hook "test-hook" 24 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 25 | Stopping application "cf-app-with-hooks-green"... 26 | Starting application "cf-app-with-hooks-green"... 27 | Application "cf-app-with-hooks-green" started and available at "********" 28 | Deleting routes for application "cf-app-with-hooks-blue"... 29 | Route "********" not deleted since it is in use 30 | Executing hook "test-hook" 31 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 32 | Stopping application "cf-app-with-hooks-blue"... 33 | Deleting application "cf-app-with-hooks-blue"... 34 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 35 | Process finished. 36 | Use "cf dmol -i ********" to download the logs of the process. 37 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-stop.idle.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: BLUE 10 | New MTA color: GREEN 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-green" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-green"... 15 | Scaling application "cf-app-with-hooks-green" to "1" instances... 16 | Staging application "cf-app-with-hooks-green"... 17 | Application "cf-app-with-hooks-green" staged 18 | Starting application "cf-app-with-hooks-green"... 19 | Application "cf-app-with-hooks-green" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-green"... 23 | Executing hook "test-hook" 24 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 25 | Stopping application "cf-app-with-hooks-green"... 26 | Starting application "cf-app-with-hooks-green"... 27 | Application "cf-app-with-hooks-green" started and available at "********" 28 | Deleting routes for application "cf-app-with-hooks"... 29 | Route "********" not deleted since it is in use 30 | Stopping application "cf-app-with-hooks"... 31 | Deleting application "cf-app-with-hooks"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | Use "cf dmol -i ********" to download the logs of the process. 35 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-stop.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: BLUE 10 | New MTA color: GREEN 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-green" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-green"... 15 | Scaling application "cf-app-with-hooks-green" to "1" instances... 16 | Staging application "cf-app-with-hooks-green"... 17 | Application "cf-app-with-hooks-green" staged 18 | Starting application "cf-app-with-hooks-green"... 19 | Application "cf-app-with-hooks-green" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-green"... 23 | Stopping application "cf-app-with-hooks-green"... 24 | Starting application "cf-app-with-hooks-green"... 25 | Application "cf-app-with-hooks-green" started and available at "********" 26 | Deleting routes for application "cf-app-with-hooks-blue"... 27 | Route "********" not deleted since it is in use 28 | Executing hook "test-hook" 29 | Executing task "foo-task" on application "cf-app-with-hooks-blue"... 30 | Stopping application "cf-app-with-hooks-blue"... 31 | Deleting application "cf-app-with-hooks-blue"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | Use "cf dmol -i ********" to download the logs of the process. 35 | -------------------------------------------------------------------------------- /hooks/output/blue-green.application.before-unmap-routes.live.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Deployed MTA color: GREEN 10 | New MTA color: BLUE 11 | Detected new MTA version: "0.0.0" 12 | Deployed MTA version: "0.0.0" 13 | Creating application "cf-app-with-hooks-blue" from MTA module "cf-app-with-hooks"... 14 | Uploading application "cf-app-with-hooks-blue"... 15 | Scaling application "cf-app-with-hooks-blue" to "1" instances... 16 | Staging application "cf-app-with-hooks-blue"... 17 | Application "cf-app-with-hooks-blue" staged 18 | Starting application "cf-app-with-hooks-blue"... 19 | Application "cf-app-with-hooks-blue" started and available at "********" 20 | Detected new MTA version: "0.0.0" 21 | Deployed MTA version: "0.0.0" 22 | Updating application "cf-app-with-hooks-blue"... 23 | Stopping application "cf-app-with-hooks-blue"... 24 | Starting application "cf-app-with-hooks-blue"... 25 | Application "cf-app-with-hooks-blue" started and available at "********" 26 | Executing hook "test-hook" 27 | Executing task "foo-task" on application "cf-app-with-hooks-green"... 28 | Stopping application "cf-app-with-hooks-green"... 29 | Deleting application "cf-app-with-hooks-green"... 30 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 31 | Process finished. 32 | Use "cf dmol -i ********" to download the logs of the process. 33 | -------------------------------------------------------------------------------- /hooks/output/deploy.application.after-stop.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Detected new MTA version: "0.0.0" 10 | Deployed MTA version: "0.0.0" 11 | Updating application "cf-app-with-hooks"... 12 | Application "cf-app-with-hooks" attributes are not modified and will not be updated 13 | Uploading application "cf-app-with-hooks"... 14 | Stopping application "cf-app-with-hooks"... 15 | Executing hook "test-hook" 16 | Executing task "foo-task" on application "cf-app-with-hooks"... 17 | Staging application "cf-app-with-hooks"... 18 | Application "cf-app-with-hooks" staged 19 | Starting application "cf-app-with-hooks"... 20 | Application "cf-app-with-hooks" started and available at "********" 21 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 22 | Process finished. 23 | Use "cf dmol -i ********" to download the logs of the process. 24 | -------------------------------------------------------------------------------- /hooks/output/deploy.application.before-stop.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Detected new MTA version: "0.0.0" 10 | Deployed MTA version: "0.0.0" 11 | Updating application "cf-app-with-hooks"... 12 | Application "cf-app-with-hooks" attributes are not modified and will not be updated 13 | Uploading application "cf-app-with-hooks"... 14 | Executing hook "test-hook" 15 | Executing task "foo-task" on application "cf-app-with-hooks"... 16 | Stopping application "cf-app-with-hooks"... 17 | Staging application "cf-app-with-hooks"... 18 | Application "cf-app-with-hooks" staged 19 | Starting application "cf-app-with-hooks"... 20 | Application "cf-app-with-hooks" started and available at "********" 21 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 22 | Process finished. 23 | Use "cf dmol -i ********" to download the logs of the process. 24 | -------------------------------------------------------------------------------- /hooks/output/deploy.application.before.start.txt: -------------------------------------------------------------------------------- 1 | Deploying multi-target app archive ~/a.cf.app.mtar in org ******** / space ******** as ********... 2 | 3 | Uploading 1 files... 4 | ~/a.cf.app.mtar 5 | OK 6 | Deploying in org "********" and space "********" 7 | Detected MTA schema version: "3" 8 | Detected deployed MTA with ID "a.cf.app" and version "0.0.0" 9 | Detected new MTA version: "0.0.0" 10 | Deployed MTA version: "0.0.0" 11 | Updating application "cf-app-with-hooks"... 12 | Application "cf-app-with-hooks" attributes are not modified and will not be updated 13 | Uploading application "cf-app-with-hooks"... 14 | Stopping application "cf-app-with-hooks"... 15 | Staging application "cf-app-with-hooks"... 16 | Application "cf-app-with-hooks" staged 17 | Executing hook "test-hook" 18 | Executing task "foo-task" on application "cf-app-with-hooks"... 19 | Starting application "cf-app-with-hooks"... 20 | Application "cf-app-with-hooks" started and available at "********" 21 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 22 | Process finished. 23 | Use "cf dmol -i ********" to download the logs of the process. 24 | -------------------------------------------------------------------------------- /idle-parameters/content/hello-world.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/idle-parameters/content/hello-world.zip -------------------------------------------------------------------------------- /idle-parameters/idle-domain.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-domain 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-domain: "your.${default-domain}" -------------------------------------------------------------------------------- /idle-parameters/idle-domains.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-domains 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-domains: ["your.first.${default-domain}", "your.second.${default-domain}"] 9 | -------------------------------------------------------------------------------- /idle-parameters/idle-host-idle-domain.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-host-idle-domain 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-host: "your-idle-hostname" 9 | idle-domain: "your.${default-domain}" -------------------------------------------------------------------------------- /idle-parameters/idle-host-idle-domains.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-host-idle-domains 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-host: "your-idle-hostname" 9 | idle-domains: ["your.first.${default-domain}", "your.second.${default-domain}"] -------------------------------------------------------------------------------- /idle-parameters/idle-host.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-host 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-host: your-idle-host 9 | -------------------------------------------------------------------------------- /idle-parameters/idle-hosts-idle-domain.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-hosts-idle-domain 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-hosts: ["your-first-idle-hostname", "your-second-idle-hostname"] 9 | idle-domain: "your.idle.domain" -------------------------------------------------------------------------------- /idle-parameters/idle-hosts-idle-domains.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-hosts-idle-domains 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-hosts: ["your-first-idle-hostname", "your-second-idle-hostname"] 9 | idle-domains: ["your.first.idle.domain", "your.second.idle.domain"] -------------------------------------------------------------------------------- /idle-parameters/idle-hosts.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-hosts 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-hosts: ["your-first-idle-hostname", "your-second-idle-hostname"] 9 | -------------------------------------------------------------------------------- /idle-parameters/idle-routes.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1.0" 2 | ID: idle.parameters.example.idle-routes 3 | extends: idle.parameters.example 4 | 5 | modules: 6 | - name: app 7 | parameters: 8 | idle-routes: 9 | - idle-route: "your-first-idle-hostname.your.first.${default-domain}" 10 | - idle-route: "your-second-idle-hostname.your.second.${default-domain}" -------------------------------------------------------------------------------- /idle-parameters/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.1.0 2 | ID: idle.parameters.example 3 | version: 1.0.0 4 | 5 | modules: 6 | - name: app 7 | type: staticfile 8 | path: content/hello-world.zip -------------------------------------------------------------------------------- /keep-existing-bindings/README.adoc: -------------------------------------------------------------------------------- 1 | # Keeping existing CF app service bindings during update 2 | :toc: 3 | 4 | ## Overview 5 | This example shows how to preserve manually created service bindings, during an MTA deployment, that are created outside of the MTA. A real use case for that is a multi-tenant scenario where bindings are created during tenant onboarding of a multitenant application, and those bindings are not maintained by MTA deployment. 6 | 7 | Modelled via a module level parameter `keep-existing` and parameter option `service-bindings`: 8 | ```bash 9 | modules: 10 | - name:... 11 | parameters: 12 | keep-existing: 13 | service-bindings: true 14 | ``` 15 | 16 | ## Official Documentation 17 | 18 | * SAP Help Portal: link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/177d34d45e3d4fd99f4eeeffc5814cf1.html#loio177d34d45e3d4fd99f4eeeffc5814cf1__section_moduleSpecificParameters[Module-Specific Parameters] 19 | 20 | NOTE: See link:mta.yaml[mta.yaml] or link:mtad.yaml[mtad.yaml] in the current directory. 21 | 22 | ## Try it out 23 | 24 | ### Initial deployment 25 | In this part the MTA will initially be deployed with two applications and one service instance. However, there is no binding between them. 26 | 27 | You can deploy it directly from an `mtad.yaml` file: 28 | 29 | ```bash 30 | $ cf deploy ./ -f ; 31 | ``` 32 | 33 | Alternatively, you can build an MTAR archive from the `mta.yaml` file: 34 | 35 | ```bash 36 | $ mbt build -p cf -t . ; 37 | ``` 38 | 39 | And then deploy the built MTAR archive: 40 | 41 | ```bash 42 | $ cf deploy a.cf.app_0.0.0.mtar -f ; 43 | ``` 44 | 45 | ### Manually bind service instance 46 | 47 | Run the following commands: 48 | 49 | ```bash 50 | $ cf bind-service cf-app-keeping-bindings dummy-service 51 | $ cf bind-service cf-app-resetting-bindings dummy-service 52 | ``` 53 | 54 | #### Examine the result 55 | 56 | To examine the result, run the following command: 57 | 58 | ```bash 59 | $ cf services 60 | Getting services in org ... 61 | name service ... bound apps ... 62 | dummy-service user-provided cf-app-keeping-bindings, cf-app-resetting-bindings 63 | ``` 64 | 65 | ### Re-deply to simulate update 66 | 67 | ```bash 68 | $ cf deploy -f ; 69 | ``` 70 | 71 | or 72 | 73 | ```bash 74 | $ cf deploy a.cf.app_0.0.0.mtar -f ; 75 | ``` 76 | 77 | #### Examine the result 78 | 79 | Verify that app `cf-app-keeping-bindings` has the binding preserved and app `cf-app-keeping-bindings` has lost the binding. 80 | 81 | ```bash 82 | $ cf services 83 | Getting services in org ... 84 | name service ... bound apps ... 85 | dummy-service user-provided cf-app-keeping-bindings 86 | ``` 87 | 88 | ## Clean up resources 89 | It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command: 90 | ``` bash 91 | $ cf undeploy -f --delete-services 92 | ``` 93 | -------------------------------------------------------------------------------- /keep-existing-bindings/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/keep-existing-bindings/appBits.zip -------------------------------------------------------------------------------- /keep-existing-bindings/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #for a faster turnaround 7 | enable-parallel-deployments: true 8 | 9 | 10 | modules: 11 | - name: cf-app-keeping-bindings 12 | type: application 13 | path: "appBits.zip" 14 | parameters: 15 | keep-existing: 16 | service-bindings: true 17 | - name: cf-app-resetting-bindings 18 | type: application 19 | path: "appBits.zip" 20 | 21 | resources: #creates a service instnace without binding it to any apps 22 | - name: dummy-service 23 | type: org.cloudfoundry.user-provided-service 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /keep-existing-bindings/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #for a faster turnaround 7 | enable-parallel-deployments: true 8 | 9 | 10 | modules: 11 | - name: cf-app-keeping-bindings 12 | type: application 13 | path: "appBits.zip" 14 | parameters: 15 | keep-existing: 16 | service-bindings: true 17 | - name: cf-app-resetting-bindings 18 | type: application 19 | path: "appBits.zip" 20 | 21 | resources: #creates a service instnace without binding it to any apps 22 | - name: dummy-service 23 | type: org.cloudfoundry.user-provided-service 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /keep-existing-env/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/keep-existing-env/appBits.zip -------------------------------------------------------------------------------- /keep-existing-env/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #for a faster turnaround 7 | enable-parallel-deployments: true 8 | 9 | 10 | modules: 11 | - name: cf-app-keeping-env-changes 12 | type: application 13 | path: "appBits.zip" 14 | parameters: 15 | keep-existing: 16 | env: true 17 | properties: 18 | managed-env-variable: "original-env-var-val" 19 | - name: cf-app-resetting-env 20 | type: application 21 | path: "appBits.zip" 22 | properties: 23 | managed-env-variable: "original-env-var-val" -------------------------------------------------------------------------------- /keep-existing-env/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #for a faster turnaround 7 | enable-parallel-deployments: true 8 | 9 | 10 | modules: 11 | - name: cf-app-keeping-env-changes 12 | type: application 13 | path: "appBits.zip" 14 | parameters: 15 | keep-existing: 16 | env: true 17 | properties: 18 | managed-env-variable: "original-env-var-val" 19 | - name: cf-app-resetting-env 20 | type: application 21 | path: "appBits.zip" 22 | properties: 23 | managed-env-variable: "original-env-var-val" 24 | 25 | -------------------------------------------------------------------------------- /keep-existing-routes/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/keep-existing-routes/appBits.zip -------------------------------------------------------------------------------- /keep-existing-routes/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #when glboally defined, applies to all cf apps in MTA (unless overriden) 7 | keep-existing-routes: false 8 | #for a faster turnaround 9 | enable-parallel-deployments: true 10 | 11 | 12 | modules: 13 | #A cf app consuming the configuration 14 | - name: cf-app-keeping-simple-param 15 | type: application # value custom would do just as well 16 | path: "appBits.zip" 17 | parameters: #ALL paramters are optional and can be deleted- defaults will be taken/detected if non specified. 18 | keep-existing-routes: true 19 | - name: cf-app-keeping-complex-param 20 | type: application # value custom would do just as well 21 | path: "appBits.zip" 22 | parameters: #ALL paramters are optional and can be deleted- defaults will be taken/detected if non specified. 23 | keep-existing: 24 | env: false 25 | routes: true 26 | - name: cf-app-unmapping-routes 27 | type: application # value custom would do just as well 28 | path: "appBits.zip" -------------------------------------------------------------------------------- /keep-existing-routes/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: a.cf.app 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | parameters: 6 | #when glboally defined, applies to all cf apps in MTA (unless overriden) 7 | keep-existing-routes: false 8 | #for a faster turnaround 9 | enable-parallel-deployments: true 10 | 11 | 12 | modules: 13 | #A cf app consuming the configuration 14 | - name: cf-app-keeping-simple-param 15 | type: application # value custom would do just as well 16 | path: "appBits.zip" 17 | parameters: #ALL paramters are optional and can be deleted- defaults will be taken/detected if non specified. 18 | keep-existing-routes: true 19 | - name: cf-app-keeping-complex-param 20 | type: application # value custom would do just as well 21 | path: "appBits.zip" 22 | parameters: #ALL paramters are optional and can be deleted- defaults will be taken/detected if non specified. 23 | keep-existing: 24 | env: false 25 | routes: true 26 | - name: cf-app-unmapping-routes 27 | type: application # value custom would do just as well 28 | path: "appBits.zip" 29 | 30 | -------------------------------------------------------------------------------- /modify-packaged-mta/README.adoc: -------------------------------------------------------------------------------- 1 | # Modifying assembled MTA archives 2 | 3 | :toc: 4 | :toc-title: Instructions 5 | 6 | This example shows how to manually modify, package and deploy an already assembled MTA 7 | 8 | NOTE: Such operations are generally prone to errors and failure due to change in input. 9 | 10 | WARNING: If the MTA archive is signed, after modifications signatures may no longer be valid. Depending on the CA and cn, the archive deployment may be rejected 11 | 12 | Please consider using other mechanisms for configuring deployments, as: 13 | 14 | * modifying MTA parameters/properties via extension descriptors (-e *.mtaext) (TODO link) 15 | * refactor in source code (before initial assembly) 16 | * deploy multiple MTAs in a single space, use namespaces ( not yet available ) 17 | 18 | ## Try it 19 | Execute the commands below in the current directory 20 | 21 | ### 1. Extract the content of the MTA archive 22 | ``` bash 23 | $ unzip original.mtar 24 | Archive: original.mtar 25 | creating: META-INF/ 26 | inflating: META-INF/MANIFEST.MF 27 | inflating: META-INF/mtad.yaml 28 | inflating: appBits.zip 29 | ``` 30 | 31 | ### 2. Modify the arcive 32 | 33 | In example, change the MTA ID as it is not modifyable in an *.mtaext 34 | ``` bash 35 | $ cat META-INF/mtad.yaml 36 | _schema-version: 3.3.0 37 | ID: a.cf.app 38 | version: 0.0.0 39 | ... 40 | 41 | $ sed -i -e 's/ID:\(.*\)/ID:\1-with-suffix /g' META-INF/mtad.yaml 42 | 43 | $ cat META-INF/mtad.yaml 44 | _schema-version: 3.3.0 45 | ID: a.cf.app-with-suffix 46 | version: 0.0.0 47 | ... 48 | ``` 49 | ### 3. Assemble the archive 50 | ``` bash 51 | zip modified.mtar META-INF/* appBits.zip 52 | adding: META-INF/MANIFEST.MF (deflated 25%) 53 | adding: META-INF/mtad.yaml (deflated 41%) 54 | adding: META-INF/mtad.yaml-e (deflated 41%) 55 | adding: appBits.zip (stored 0%) 56 | ``` 57 | 58 | ### 4. Deploy 59 | 60 | ``` bash 61 | $ cf deploy modified.mtar Deploying multi-target app archive modified.mtar in org ***** / space ****** as ******... 62 | Uploading 1 files... 63 | .../modified.mtar 64 | OK 65 | Deploying in org "*****" and space "******" 66 | ... 67 | Process finished. 68 | ``` 69 | ### 5. Check out the result 70 | ``` bash 71 | $ cf mtas 72 | Getting multi-target apps in org ****** / space ****** as ******... 73 | OK 74 | mta id version 75 | a.cf.app-with-suffix 0.0.0 76 | ``` -------------------------------------------------------------------------------- /modify-packaged-mta/original.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/modify-packaged-mta/original.mtar -------------------------------------------------------------------------------- /namespace/global-parameters/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/global-parameters/appBits.zip -------------------------------------------------------------------------------- /namespace/global-parameters/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: hello 3 | version: 1.0.0 4 | 5 | parameters: 6 | apply-namespace: 7 | app-names: true 8 | service-names: true 9 | app-routes: true 10 | 11 | modules: 12 | - name: hello-backend 13 | type: application 14 | path: appBits.zip 15 | parameters: 16 | apply-namespace: false 17 | 18 | - name: hello-router 19 | type: application 20 | path: appBits.zip 21 | requires: 22 | - name: my-cf-service 23 | parameters: 24 | routes: 25 | - route: route-without-namespace.${default-domain} 26 | apply-namespace: false 27 | resources: 28 | - name: my-cf-service 29 | type: org.cloudfoundry.managed-service 30 | parameters: 31 | service-plan: "lite" 32 | service: application-logs 33 | -------------------------------------------------------------------------------- /namespace/module-and-service-with-apply-flag/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/module-and-service-with-apply-flag/backend.war -------------------------------------------------------------------------------- /namespace/module-and-service-with-apply-flag/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/module-and-service-with-apply-flag/hello.mtar -------------------------------------------------------------------------------- /namespace/module-and-service-with-apply-flag/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: hello 3 | version: 1.0.0 4 | 5 | modules: 6 | - name: hello-backend 7 | type: java.tomcat 8 | path: backend.war 9 | parameters: 10 | memory: 256M 11 | disk-quota: 256M 12 | routes: 13 | - route: ${app-name}.${default-domain} 14 | apply-namespace: true 15 | properties: 16 | message: "Hello World!" 17 | MEMORY_CALCULATOR_V1: true 18 | resources: 19 | - name: hello-service 20 | type: auditlog 21 | parameters: 22 | apply-namespace: false 23 | -------------------------------------------------------------------------------- /namespace/module-with-apply-as-suffix-flag/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/module-with-apply-as-suffix-flag/appBits.zip -------------------------------------------------------------------------------- /namespace/module-with-apply-as-suffix-flag/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: hello 3 | version: 1.0.0 4 | 5 | parameters: 6 | apply-namespace: 7 | app-names: true 8 | service-names: true 9 | app-routes: true 10 | 11 | modules: 12 | - name: hello-backend 13 | type: application 14 | path: appBits.zip 15 | parameters: 16 | apply-namespace: false -------------------------------------------------------------------------------- /namespace/module-with-apply-as-suffix-global-parameter/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/module-with-apply-as-suffix-global-parameter/appBits.zip -------------------------------------------------------------------------------- /namespace/module-with-apply-as-suffix-global-parameter/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: hello 3 | version: 1.0.0 4 | 5 | parameters: 6 | apply-namespace: 7 | app-names: true 8 | service-names: true 9 | app-routes: true 10 | as-suffix: true 11 | 12 | modules: 13 | - name: hello-backend 14 | type: application 15 | path: appBits.zip 16 | parameters: 17 | apply-namespace: false -------------------------------------------------------------------------------- /namespace/module-with-apply-flag-to-route/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/module-with-apply-flag-to-route/backend.war -------------------------------------------------------------------------------- /namespace/module-with-apply-flag-to-route/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/module-with-apply-flag-to-route/hello.mtar -------------------------------------------------------------------------------- /namespace/module-with-apply-flag-to-route/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: hello 3 | version: 1.0.0 4 | 5 | modules: 6 | - name: hello-backend 7 | type: java.tomcat 8 | path: backend.war 9 | parameters: 10 | memory: 256M 11 | disk-quota: 256M 12 | routes: 13 | - route: hello-backend.${default-domain} 14 | - route: route-without-namespace.${default-domain} 15 | apply-namespace: false 16 | properties: 17 | message: "Hello World!" 18 | MEMORY_CALCULATOR_V1: true 19 | -------------------------------------------------------------------------------- /namespace/two-modules/backend.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/two-modules/backend.war -------------------------------------------------------------------------------- /namespace/two-modules/hello.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/namespace/two-modules/hello.mtar -------------------------------------------------------------------------------- /namespace/two-modules/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: "3.1" 2 | ID: hello 3 | version: 1.0.0 4 | 5 | modules: 6 | 7 | - name: hello-backend 8 | type: java.tomcat 9 | path: backend.war 10 | provides: 11 | - name: backend 12 | properties: 13 | url: "https://${routes/0/route}" 14 | parameters: 15 | memory: 256M 16 | disk-quota: 256M 17 | routes: 18 | - route: ${app-name}.${default-domain}/content 19 | properties: 20 | message: "Hello, from ${app-name}!" 21 | MEMORY_CALCULATOR_V1: true 22 | 23 | - name: hello-router 24 | type: java.tomcat 25 | path: backend.war 26 | requires: 27 | - name: backend 28 | properties: 29 | backend: ~{url} 30 | name: backend 31 | url: ~{url} 32 | parameters: 33 | memory: 256M 34 | disk-quota: 256M 35 | routes: 36 | - route: ${app-name}.${default-domain} 37 | properties: 38 | MEMORY_CALCULATOR_V1: true -------------------------------------------------------------------------------- /parallel-deployment/content/hello_world.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/parallel-deployment/content/hello_world.zip -------------------------------------------------------------------------------- /parallel-deployment/hello-world-no-parallel.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.3.0" 2 | extends: hello-world 3 | ID: hello-world-no-parallel 4 | 5 | parameters: 6 | enable-parallel-deployments: false 7 | -------------------------------------------------------------------------------- /parallel-deployment/hello-world-parallel.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: "3.3.0" 2 | extends: hello-world 3 | ID: hello-world-no-parallel 4 | 5 | parameters: 6 | enable-parallel-deployments: true 7 | -------------------------------------------------------------------------------- /parallel-deployment/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: hello-world 3 | version: 1.0.0 4 | parameters: 5 | enable-parallel-deployments: true 6 | 7 | modules: 8 | - name: hello-world 9 | type: staticfile 10 | path: content/hello_world.zip 11 | parameters: 12 | memory: 64M 13 | 14 | - name: hello-world-first 15 | type: staticfile 16 | path: content/hello_world.zip 17 | parameters: 18 | memory: 64M 19 | 20 | - name: hello-world-second 21 | type: staticfile 22 | path: content/hello_world.zip 23 | parameters: 24 | memory: 64M 25 | 26 | - name: hello-world-third 27 | type: staticfile 28 | path: content/hello_world.zip 29 | deployed-after: 30 | - hello-world 31 | parameters: 32 | memory: 64M -------------------------------------------------------------------------------- /parallel-deployment/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: hello-world 3 | version: 1.0.0 4 | parameters: 5 | enable-parallel-deployments: true 6 | 7 | modules: 8 | - name: hello-world 9 | type: staticfile 10 | path: content/hello_world.zip 11 | parameters: 12 | memory: 64M 13 | 14 | - name: hello-world-first 15 | type: staticfile 16 | path: content/hello_world.zip 17 | parameters: 18 | memory: 64M 19 | 20 | - name: hello-world-second 21 | type: staticfile 22 | path: content/hello_world.zip 23 | parameters: 24 | memory: 64M 25 | 26 | - name: hello-world-third 27 | type: staticfile 28 | path: content/hello_world.zip 29 | deployed-after: 30 | - hello-world 31 | parameters: 32 | memory: 64M -------------------------------------------------------------------------------- /parameter-and-property-metadata/extension.yaml: -------------------------------------------------------------------------------- 1 | ID: test-null-params.ext 2 | _schema-version: '3.1' 3 | extends: test-null-params 4 | 5 | modules: 6 | - name: my-app 7 | parameters: 8 | null-parameter: extension-value 9 | properties: 10 | null-property: extension-value -------------------------------------------------------------------------------- /parameter-and-property-metadata/test.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/parameter-and-property-metadata/test.mtar -------------------------------------------------------------------------------- /partial-build-deploy/MTAstructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/partial-build-deploy/MTAstructure.png -------------------------------------------------------------------------------- /partial-build-deploy/content/hello_world.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/partial-build-deploy/content/hello_world.zip -------------------------------------------------------------------------------- /partial-build-deploy/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: hello-world 2 | version: "1.0.0" 3 | _schema-version: "3.3.0" 4 | parameters: 5 | enable-parallel-deployments: true 6 | 7 | 8 | modules: 9 | - name: module-a 10 | type: staticfile 11 | path: content 12 | requires: 13 | - name: service-1 14 | parameters: 15 | memory: 64M 16 | 17 | build-parameters: 18 | build-result: resources 19 | requires: 20 | - name: module-b 21 | artifacts: 22 | - '*' 23 | target-path: resources/ 24 | - name: module-c 25 | artifacts: 26 | - '*' 27 | target-path: resources/ 28 | 29 | - name: module-b 30 | type: staticfile 31 | path: content/ 32 | requires: 33 | - name: service-2 34 | parameters: 35 | memory: 64M 36 | build-parameters: 37 | build-result: hello_world.zip 38 | 39 | - name: module-c 40 | type: staticfile 41 | path: content/ 42 | requires: 43 | - name: service-3 44 | parameters: 45 | memory: 64M 46 | build-parameters: 47 | build-result: hello_world.zip 48 | 49 | resources: 50 | - name: service-1 51 | optional: false 52 | type: org.cloudfoundry.user-provided-service 53 | 54 | - name: service-2 55 | optional: false 56 | type: org.cloudfoundry.user-provided-service 57 | 58 | - name: service-3 59 | optional: false 60 | type: org.cloudfoundry.user-provided-service 61 | -------------------------------------------------------------------------------- /partial-build-deploy/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: hello-world 3 | version: 1.0.0 4 | parameters: 5 | enable-parallel-deployments: true 6 | 7 | modules: 8 | - name: module-a 9 | type: staticfile 10 | path: content/hello_world.zip 11 | requires: 12 | - name: service-1 13 | parameters: 14 | memory: 64M 15 | - name: module-b 16 | type: staticfile 17 | path: content/hello_world.zip 18 | requires: 19 | - name: service-2 20 | parameters: 21 | memory: 64M 22 | - name: module-c 23 | type: staticfile 24 | path: content/hello_world.zip 25 | requires: 26 | - name: service-3 27 | parameters: 28 | memory: 64M 29 | resources: 30 | - name: service-1 31 | type: org.cloudfoundry.user-provided-service 32 | - name: service-2 33 | type: org.cloudfoundry.user-provided-service 34 | - name: service-3 35 | type: org.cloudfoundry.user-provided-service 36 | -------------------------------------------------------------------------------- /service-key-renewal/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.0.0 2 | ID: app-with-rotating-keys 3 | version: 3.0.0 4 | 5 | modules: 6 | - name: my-app 7 | type: staticfile 8 | path: appBits.zip 9 | requires: 10 | - name: rotating-key-1 11 | parameters: 12 | env-var-name: keycredentials 13 | 14 | resources: 15 | - name: postgre-test-service 16 | type: org.cloudfoundry.managed-service 17 | parameters: 18 | service: postgresql-db 19 | service-plan: development 20 | service-name: postgre-test-service 21 | service-keys: 22 | - name: rotating-key-1-${timestamp} 23 | 24 | - name: rotating-key-1 25 | type: org.cloudfoundry.existing-service-key 26 | parameters: 27 | service-name: postgre-test-service 28 | service-key-name: rotating-key-1-${timestamp} -------------------------------------------------------------------------------- /service-key-renewal/service_keys_handling_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/service-key-renewal/service_keys_handling_diagram.png -------------------------------------------------------------------------------- /service-key-renewal/test-rotating-service-keys.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/service-key-renewal/test-rotating-service-keys.mtar -------------------------------------------------------------------------------- /sharing-values-between-apps/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/sharing-values-between-apps/appBits.zip -------------------------------------------------------------------------------- /sharing-values-between-apps/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: my-mta 2 | version: 0.0.0-SNAPSHOT 3 | _schema-version: 3.3.0 4 | 5 | modules: 6 | - name: providing-module 7 | type: application 8 | path: appBits.zip 9 | properties: #will be set as app environment variables 10 | my-generated-user: ${generated-user} # ${generated-user} parameter has a randomly generated value for each deployment operation 11 | provides: 12 | - name: module-1-provided #declare all values this module would share in such provided objects 13 | properties: 14 | user: ${generated-user} # the ${generated-user} parameter has an unique generated value for each module 15 | config: "static-string" 16 | url: ${default-url} # properties in the provides section can reference all glboal and module parameters, including the ones provided by default as default-url 17 | parameters: 18 | no-start: true 19 | 20 | 21 | - name: consuming-module 22 | type: application 23 | path: appBits.zip 24 | requires: 25 | - name: module-1-provided #declare this in order to 'access' and resolve the provided values 26 | properties: #will be set as app environment variables 27 | m1-user: ~{module-1-provided/user} # note, the ~{/} synthax. The property names are the ones defined in the 'provides' section of module 1 28 | m1-config: '~{module-1-provided/config}-with-suffix' # such references can be part of yaml string expressions 29 | m1-url: ~{module-1-provided/url} 30 | parameters: 31 | no-start: true 32 | -------------------------------------------------------------------------------- /sharing-values-between-apps/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: my-mta 2 | version: 0.0.0-SNAPSHOT 3 | _schema-version: 3.3.0 4 | 5 | modules: 6 | - name: providing-module 7 | type: application 8 | path: appBits.zip 9 | properties: #will be set as app environment variables 10 | my-generated-user: ${generated-user} # ${generated-user} parameter has a randomly generated value for each deployment operation 11 | provides: 12 | - name: module-1-provided #declare all values this module would share in such provided objects 13 | properties: 14 | user: ${generated-user} # the ${generated-user} parameter has an unique generated value for each module 15 | config: "static-string" 16 | url: ${default-url} # properties in the provides section can reference all glboal and module parameters, including the ones provided by default as default-url 17 | parameters: 18 | no-start: true 19 | 20 | 21 | - name: consuming-module 22 | type: application 23 | path: appBits.zip 24 | requires: 25 | - name: module-1-provided #declare this in order to 'access' and resolve the provided values 26 | properties: #will be set as app environment variables 27 | m1-user: ~{module-1-provided/user} # note, the ~{/} synthax. The property names are the ones defined in the 'provides' section of module 1 28 | m1-config: '~{module-1-provided/config}-with-suffix' # such references can be part of yaml string expressions 29 | m1-url: ~{module-1-provided/url} 30 | parameters: 31 | no-start: true 32 | -------------------------------------------------------------------------------- /sharing-values-between-apps/my-mta.mtar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/sharing-values-between-apps/my-mta.mtar -------------------------------------------------------------------------------- /skip-service-updates/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/skip-service-updates/appBits.zip -------------------------------------------------------------------------------- /skip-service-updates/mta.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-cf-service-instance-resource 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-name: "my-logging-service-instance-name" #optional, can be skipped 10 | service-plan: "lite" # set the service plan to use 11 | service: application-logs #set the service offering (label) 12 | skip-service-updates: 13 | parameters: false 14 | plan: false 15 | tags: false 16 | # config: #optional, can configure service creation/update with service speciffic parameters 17 | # service-config-key: "service-config-value" 18 | 19 | modules: 20 | #A cf app which will be bound to the service 21 | - name: my-mta-managed-app-module 22 | type: application 23 | path: "appBits.zip" 24 | requires: 25 | - name: my-cf-service-instance-resource -------------------------------------------------------------------------------- /skip-service-updates/mtad.yaml: -------------------------------------------------------------------------------- 1 | ID: "my-mta" 2 | _schema-version: 3.3.0 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-cf-service-instance-resource 7 | type: org.cloudfoundry.managed-service 8 | parameters: 9 | service-name: "my-logging-service-instance-name" #optional, can be skipped 10 | service-plan: "lite" # set the service plan to use 11 | service: application-logs #set the service offering (label) 12 | skip-service-updates: 13 | parameters: false 14 | plan: false 15 | tags: false 16 | # config: #optional, can configure service creation/update with service speciffic parameters 17 | # service-config-key: "service-config-value" 18 | 19 | modules: 20 | #A cf app which will be bound to the service 21 | - name: my-mta-managed-app-module 22 | type: application 23 | path: "appBits.zip" 24 | requires: 25 | - name: my-cf-service-instance-resource -------------------------------------------------------------------------------- /streaming-logs-with-user-provided-service/appBits.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cf-mta-examples/232286f54411f064df729c9c4e0aa4c3f3c173c8/streaming-logs-with-user-provided-service/appBits.zip -------------------------------------------------------------------------------- /streaming-logs-with-user-provided-service/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.1.0 2 | ID: create.syslog.service.example 3 | version: 0.0.0 4 | 5 | resources: 6 | - name: my-syslog-service 7 | type: org.cloudfoundry.user-provided-service 8 | parameters: 9 | syslog-drain-url: syslog://example.log-aggregator.com 10 | 11 | modules: 12 | #A cf app which will be bound to the service 13 | - name: my-mta-managed-app-module 14 | type: application 15 | path: "appBits.zip" 16 | requires: 17 | - name: my-syslog-service -------------------------------------------------------------------------------- /user-provided-service/README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | # Manage User-Provided Service Instances 4 | 5 | User-provided service instances enable developers to use services that are not available in the marketplace with their apps running on Cloud Foundry. 6 | 7 | The example will demonstrate how to manage User-Provided Service Instances with MTA. 8 | Real use case for SAP Business Technology Platform Cloud Foundry environment where user-provided service are needed is Dynatrace service. With dynatrace you can monitor your application and get insights of it. 9 | 10 | To create user-provided services, you need resource with type `org.cloudfoundry.user-provided-service`. 11 | The resource has only one required parameter `config` that represents credentials of the service. 12 | 13 | 14 | ## Oficial documemtation in Help SAP Portal 15 | - link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/9e34487b1a8643fb9a93ae6c4894f015.html#loio9e34487b1a8643fb9a93ae6c4894f015__section_mtaResourceTypes[Resources] -> Special Resource Types 16 | 17 | # Try out 18 | 19 | ## Execute initial creation of user-provided service 20 | 21 | The step represents the initial creation of service instance. 22 | 23 | ### Deploy with a deployment descriptor (mtad.yaml) 24 | 25 | That approach uses deployment descritpr `link:mtad.yaml[mtad.yaml]` 26 | 27 | ```bash 28 | $ cf deploy ./ -f 29 | ... 30 | Processing service "my-simple-service"... 31 | Creating service "my-simple-service" from MTA resource "my-simple-service"... 32 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 33 | Process finished. 34 | ``` 35 | 36 | ### Verify the result 37 | 38 | ```bash 39 | $ cf s 40 | Getting services in org deploy-service / space i076083 as I076083... 41 | 42 | name service plan bound apps last operation broker upgrade available 43 | my-simple-service user-provided 44 | ``` 45 | 46 | ## Execute update of user-provided service 47 | 48 | The step represents the the update of service instance when it have changed parameters. 49 | 50 | That approach uses deployment descritpr `link:mtad.yaml[mtad.yaml]` and extension descriptor `link:service-credentials.mtaext[service-credentials.mtaext]`: 51 | 52 | ```bash 53 | $ cf deploy ./ -e service-credentials.mtaext -f 54 | ... 55 | Uploading 1 files... 56 | ../create.service.example.mtar 57 | OK 58 | Uploading 1 files... 59 | ./service-credentials.mtaext 60 | OK 61 | ... 62 | Service "my-simple-service" exists but doesnt have any bound applications 63 | Processing service "my-simple-service"... 64 | Updating service "my-simple-service"... 65 | ``` 66 | 67 | NOTE: The service credential `foo` defined in deployment descriptor with value `baz` is overwritten with value `bar` coming from extension descriptor 68 | -------------------------------------------------------------------------------- /user-provided-service/mtad.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.1.0 2 | ID: create.service.example 3 | version: 1.0.0 4 | 5 | resources: 6 | - name: my-simple-service 7 | type: org.cloudfoundry.user-provided-service 8 | parameters: 9 | config: 10 | foo: baz -------------------------------------------------------------------------------- /user-provided-service/service-credentials.mtaext: -------------------------------------------------------------------------------- 1 | _schema-version: 3.1.0 2 | ID: create.service.example.service-credentials 3 | extends: create.service.example 4 | version: 1.0.0 5 | 6 | resources: 7 | - name: my-simple-service 8 | parameters: 9 | config: 10 | foo: bar 11 | --------------------------------------------------------------------------------