Skip to content

Commit e519f09

Browse files
CF-MTA-Examples Revised (#83)
* Update README.adoc
1 parent b221aae commit e519f09

File tree

23 files changed

+893
-565
lines changed

23 files changed

+893
-565
lines changed

Diff for: README.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Clone the repository, following the link:https://help.github.com/en/github/creat
3131
## SAP Content Deployment
3232
* link:/content-deployment/[SAP Content Deployment]
3333
** link:/content-deployment/html5-content-deployment/[HTML5 Application Content Deployment]
34-
** link:/content-deployment/html5-content-deployment/with-existing-key[Content Deployment to an Existing Service Key]
34+
** link:/content-deployment/html5-content-deployment/with-existing-key[Content Deployment with an Existing Service Key]
3535
** link:/content-deployment/html5-content-deployment/with-user-provided-service[Content Deployment to a User-Provided Service]
3636

3737
## Manage CF Services

Diff for: active-optional-resources/README.adoc

+51-34
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
# Active and Optional Resources
44

5-
This example shows how to mark service resources as optional/mandatory or active/inactive in order to influence the deployment behaviour
5+
This example shows how to mark service resources as optional/mandatory or active/inactive in order to influence the deployment behaviour.
66

7-
Orchestration of the following CF features is covered:
7+
Orchestration of the following Cloud Foundry features is covered:
88

99
- creation of service instances: https://docs.cloudfoundry.org/devguide/services/managing-services.html
1010
- creation of app bindings to service instances https://docs.cloudfoundry.org/devguide/services/application-binding.html#bind
1111
12-
## Modelling
12+
## Modeling
1313

1414
### Service instances
15-
Service instances are modelled as MTA resources of type `org.cloudfoundry.managed-service`.
15+
Service instances are modeled as MTA resources of type `org.cloudfoundry.managed-service`.
1616

1717
### Optional service instances
18-
In case a service instance is not mandatory for a deployment but should be used if availalble, it can be marked as optional in the mta(d).yaml descriptor
18+
If a service instance is not mandatory for a deployment but you want it to be used if availalble, it can be marked as `optional` in the `mta(d).yaml` descriptor:
19+
1920
....
2021
...
2122
- name: my-cf-service-instance-resource
@@ -25,11 +26,12 @@ In case a service instance is not mandatory for a deployment but should be used
2526
...
2627
....
2728

28-
NOTE: the value of the `optional` resource attribute can be changed for each deployment by link:https://github.com/SAP-samples/cf-mta-examples/tree/main/extension-descriptor-different-environments[using an extension descriptor]
29+
NOTE: The value of the `optional` resource attribute can be changed for each deployment by link:https://github.com/SAP-samples/cf-mta-examples/tree/main/extension-descriptor-different-environments[using an extension descriptor].
2930

3031

3132
### Including/excluding services from deployment
32-
To give fine control over what get's deployed or not, resources representing service instances can be marked as active or not. This will cause the MTA deployer to process/not-process them at deploy time.
33+
Service instance resources can be marked as active or inactive to provide finer control over what is deployed. Depending on their status, the MTA deployer will either process or ignore these resources when deploying.
34+
3335
....
3436
...
3537
- name: my-cf-service-instance-resource
@@ -39,63 +41,72 @@ To give fine control over what get's deployed or not, resources representing ser
3941
...
4042
....
4143

42-
NOTE: the value of the `active` resource attribute can be changed for each deployment by link:https://github.com/SAP-samples/cf-mta-examples/tree/main/extension-descriptor-different-environments[using an extension descriptor]
44+
NOTE: The value of the `active` resource attribute can be changed for each deployment by link:https://github.com/SAP-samples/cf-mta-examples/tree/main/extension-descriptor-different-environments[using an extension descriptor].
4345

44-
NOTE: the `active` attribute can also be specified for resources of type `org.cloudfoundry.existing-service`. In that case it determines if app bindings to the service would be created or not. I.e. if an app module has a reference to an existing-service resource via `requires: ...` and the resource has `active: false`, a service binding between them will not be created during deployment.
46+
NOTE: The `active` attribute can also be specified for resources of type `org.cloudfoundry.existing-service`. In that case it determines if app bindings to the service would be created or not. If an app module has a reference to an existing-service resource via `requires: ...` and the resource has `active: false`, a service binding between them will not be created during deployment.
4547

4648
## Related examples
47-
- service instance and binding creation(configurations) management with MTAs
48-
- update of service instances and bindings [updating parameters, changing plans and labels; recreation ]
49+
- service instance and binding creation (configurations) management with MTAs
50+
- update of service instances and bindings [updating parameters, changing plans and labels; recreation]
4951

5052
## Requirements
51-
- access to a CF space with quota for creation of service instances
53+
- access to a Cloud Foundry space with quota for creation of service instances
5254

53-
## Oficial documemtation in Help SAP Portal
55+
## Official documentation in SAP Help Portal
5456
- link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/9e34487b1a8643fb9a93ae6c4894f015.html[Resources]
5557
- link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/a36df26b36484129b482ae20c3eb8004.html[Service creation parameters]
5658
- link:https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/c7b09b79d3bb4d348a720ba27fe9a2d5.html[Service binding parameters]
5759

58-
## Try out
60+
## Try it out
5961
### Deploy the MTA
60-
The example can be run with 2 approaches for building an MTA. Bothj lead to the same result.
62+
The example demostrates 2 different approaches that lead to the same result.
6163

62-
#### A. Deeploying from a directory
63-
That approach uses deployment descritpr `link:mtad.yaml[mtad.yaml]` and ready application binaries `link:appBits.zip[appBits.zip]`:
64+
#### Deploying from a directory
65+
This approach uses deployment descriptor `link:mtad.yaml[mtad.yaml]` and ready application binaries `link:appBits.zip[appBits.zip]`:
6466

6567
``` bash
66-
cf deploy ./ -f ;
68+
$ cf deploy ./ -f ;
6769
```
6870

6971
_OR_
7072

71-
First assemble an MTA archive using the link:mtad.yaml[mtad.yaml]` and then deploy the archive:
73+
You can assemble an MTA archive using the `link:mtad.yaml[mtad.yaml]` by running the following command:
7274

7375
``` bash
74-
mbt assemble -t ./ ;
75-
cf deploy my-mta_0.0.0.mtar ;
76+
$ mbt assemble -t ./ ;
77+
```
78+
79+
Then deploy the assembled archive:
80+
81+
``` bash
82+
$ cf deploy my-mta_0.0.0.mtar ;
7683
```
7784

7885
NOTE: See link:mtad.yaml[mtad.yaml] for the modelling
7986

8087
NOTE: please adjust the service label and plan values to match the available in your environment
8188

8289

83-
#### B. Build and Deploy
84-
The approach is using development descriptor `link:mta.yaml[mta.yaml]` and application binaries `link:appBits.zip[appBits.zip]` to build MTAR.
85-
Then the MTAR is deployed.
90+
#### Build and deploy
91+
This approach uses development descriptor `link:mta.yaml[mta.yaml]` and application binaries `link:appBits.zip[appBits.zip]` to build an MTAR archive.
8692

8793
``` bash
88-
mbt build -p cf -t . ;
89-
cf deploy a.cf.app_0.0.0.mtar -f ;
94+
$ mbt build -p cf -t . ;
9095
```
9196

92-
NOTE: See link:mta.yaml[mta.yaml] for the concrete modelling
97+
The built MTAR archive is then deployed:
98+
99+
``` bash
100+
$ cf deploy my-mta_0.0.0.mtar -f ;
101+
```
102+
103+
NOTE: See link:mta.yaml[mta.yaml] for the specific modeling
93104

94105

95106
## Deploy with an inactive resource
96107

97108
```bash
98-
cf deploy ./
109+
$ cf deploy ./
99110
...
100111
Operation ID: 7c8d9c49-badf-11ea-9455-eeee0a9e129b
101112
Deploying in org "deploy-service" and space "********"
@@ -106,15 +117,15 @@ Deployed MTA version: "0.0.0"
106117
Service "my-cf-service-instance-resource" is inactive and will not be processed
107118
...
108119
```
109-
The cf application get's created. Since the service's resource is inactive, the service is not created and not bound to the app
120+
The Cloud Foundry application gets created. Since the service's resource is inactive, the service is not created and not bound to the app.
110121

111122
## Deploy with an active optional & misconfigured service resource
112123

113124
Let's enable the resource and mark it optional, but make sure to make the service creation not-possible in order to see how the deploy behaves.
114125
See how this is done in link:active_optional.mtaext[active_optional.mtaext]
115126

116127
```bash
117-
cf deploy ./ -f -e active_mandatory.mtaext  6895
128+
$ cf deploy ./ -f -e active_optional.mtaext  6895
118129
Deploying multi-target app archive /Users/********/dev/repos/ds/cf-mta-examples/active-optional-resources/my-mta.mtar in org deploy-service / space ******** as ********...
119130

120131
Uploading 1 files...
@@ -133,15 +144,15 @@ Processing service "my-cf-service-instance-resource"...
133144
Updating application "my-mta-managed-app-module"...
134145
...
135146
```
136-
The cf application get's created. Since the service's resource is inactive, the service is not created and not bound to the app
147+
The Cloud Foundry application gets created. Since the service's resource is inactive, the service is not created and not bound to the app.
137148

138149
## Deploy with an active properly configured service resource
139150

140151
Let's enable the resource with an extension descriptor
141152
See how this is done in link:active_mandatory.mtaext[active_mandatory.mtaext]
142153

143154
```bash
144-
cf deploy ./ -f -e active_mandatory.mtaext
155+
$ cf deploy ./ -f -e active_mandatory.mtaext
145156
...
146157
Operation ID: 6cc12802-bae0-11ea-9455-eeee0a9e129b
147158
Deploying in org "deploy-service" and space "********"
@@ -153,13 +164,13 @@ Processing service "my-cf-service-instance-resource"...
153164
Updating application "my-mta-managed-app-module"...
154165
...
155166
```
156-
The service instance & app get created and bound as expected
167+
The service instance & app get created and bound as expected.
157168

158169
## Print the MTA details to confirm the deployment
159170
At any step you can check the created deployment with the following:
160171

161172
``` bash
162-
$cf mta my-mta
173+
$ cf mta my-mta
163174
Showing health and status for multi-target app my-mta in org deploy-service / space ******** as ********...
164175
OK
165176
Version: 0.0.0
@@ -172,3 +183,9 @@ Services:
172183
name service plan bound apps last operation
173184
my-cf-service-instance-resource application-logs lite my-mta-managed-app-module create succeeded
174185
```
186+
187+
## Clean up resources
188+
It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command:
189+
``` bash
190+
$ cf undeploy <mta-id> -f --delete-services
191+
```

0 commit comments

Comments
 (0)