Skip to content

Commit

Permalink
Example for app + destination creation via content deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ddonchev committed Jun 12, 2020
1 parent 9f9943f commit 9f18cba
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cf-destination/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
:toc:

# Managing CF Apps with an MTA

This example shows how to model a simple CF application in an MTA, and a SCP sub-account destination pointing to it's url.

# Try out

## Deploy an MTA containing an cf app.

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

### Deploy from directory
That approach uses deployment descritpr `mtad.yaml` and ready application binaries `appBits.zip`:
``` bash
cf deploy ./ -f ;
```
### Build and Deploy
The approach is using development descriptor `mta.yaml`and application binaries `appBits.zip` to build MTAR.
Then the MTAR is deployed.

``` bash
mbt build -p cf -t . ;
cf deploy a.cf.app_0.0.0.mtar -f ;
```

NOTE: See link:mta.yaml[mta.yaml] or link:mtad.yaml[mtad.yaml] for details on the attributes and environment and deployer parameters used.

## Examine the result

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

Binary file added cf-destination/appBits.zip
Binary file not shown.
49 changes: 49 additions & 0 deletions cf-destination/mta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ID: a.cf.app
_schema-version: 3.3.0
version: 0.0.0
modules:
- name: destination-content-deployer
type: com.sap.application.content
build-parameters:
no-source: true
parameters:
content: #whole content structure moved up to the module's parameters (was in the destinations')
subaccount:
destinations:
- Name: backend
URL: ~{backend-api/url} #from here, properties from different requires dependencies can be references - via ~{fully-qualified/references}
forwardAuthToken: true
ServiceInstanceName: "backend"
requires:
- name: destination-service
parameters:
content-target: true
# content: # Inlinte content can not be defined as this any more!
# subaccount:
# destinations:
# - Name: backend
# URL: https://abc.d #because such values would have to be hard-coded
# forwardAuthToken: true
# ServiceInstanceName: "backend"
- name: backend-api

- name: backend
type: application
path: "appBits.zip"
parameters:
buildpack: staticfile_buildpack
memory: 1G
disk-quota: 1G
provides:
- name: backend-api
properties:
url: ${default-url}

resources:
- name: destination-service
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-name: destination-service
service-plan: lite

47 changes: 47 additions & 0 deletions cf-destination/mtad.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
ID: a.cf.app
_schema-version: 3.3.0
version: 0.0.0
modules:
- name: destination-content-deployer
type: com.sap.application.content
parameters:
content: #whole content structure moved up to the module's parameters (was in the destinations')
subaccount:
destinations:
- Name: backend
URL: ~{backend-api/url} #from here, properties from different requires dependencies can be references - via ~{fully-qualified/references}
forwardAuthToken: true
ServiceInstanceName: "backend"
requires:
- name: destination-service
parameters:
content-target: true
# content: # Inlinte content can not be defined as this any more!
# subaccount:
# destinations:
# - Name: backend
# URL: https://abc.d #because such values would have to be hard-coded
# forwardAuthToken: true
# ServiceInstanceName: "backend"
- name: backend-api

- name: backend
type: application
path: "appBits.zip"
parameters:
buildpack: staticfile_buildpack
memory: 1G
disk-quota: 1G
provides:
- name: backend-api
properties:
url: ${default-url}

resources:
- name: destination-service
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-name: destination-service
service-plan: lite

0 comments on commit 9f18cba

Please sign in to comment.