cf-mta-examples
cf-mta-examples copied to clipboard
Example: SAP CP Destinations
Create an example showing the modelling & creation of SAP CP "destinations" with an mta deploy. The example should cover both:
- instance level destinations and sub-account level destinations
- destinations to service instances (keys) & destinations to a route of an app within the same MTA
Any timeline on this? I am really struggling with it atm!
I hope those snippets & links to documentation help, until a suitable scenario covering all aspects is defined, and the documentation is done & reviewed:
- Instance level destinations - e.g. in the CF environment. Currently, in MTA deployment, instance level destinations can be defined as creation/update parameters for the particular service instance.
resources:
- name: destination-service
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-name: my-destination-service
service-plan: lite
config: {
"init_data" {
"subaccount" : {
"existing_destinations_policy": "update|fail|ignore",
"existing_certificates_policy": "fail|ignore",
"destinations" : [
{
...
}
],
"certificates" : [
{
...
}
]
},
"instance" : {
"destinations" : [
{
...
}
],
"certificates" : [
{
...
}
]
}
}
}
Here yaml and json are mixed (ugly but works). Have in mind that you can convert any json to yaml in the mta(d).yaml or can extract the config json to an external file and reference/overwrite it in the mta(d).yaml.
- sub-account level destinations - those are created not where the service instance is defined, but in a content module as this:
module:
- name: destination-content
type: com.sap.application.content
requires:
- name: xsuaa_service
parameters:
service-key:
name: xsuaa_service-key
- name: destination-service
parameters:
content-target: true
- name: myapp-route # required, in order to reference the app url from the module above
parameters:
content:
subaccount:
existing_destinations_policy: update
destinations:
- Name: myappOauth
ServiceInstanceName: myApp-xsuaa-service
ServiceKeyName: xsuaa_service-key
< ... destination definition here ... >
To create the special kind of service instance destination, you should pass some extra properties in the definition of the destination which reference the service instance for which the destination would be created/updated as the example above
@steinroe, can you tell what kind of destinations/scenarios do you aim to use? This could help us making the example/tutorial more useful for others having your case.
@ddonchev Thanks for providing the examples!
Essentially, I am trying to set up a really basic scenario: A Node.js Backend, an Approuter, and a React Frontend. However, although fairly basic, this is rather complex to set up due to the decision to run the Approuter as a separate application and deploy the react frontend to the html5 repositories. After several days of try and error I now finally got it all deployed and working. However, to develop offline, I somehow have to redirect to a locally running Webpack server instead of the HTML5 repo in CF. My idea was to use a custom destination pointing to a localhost endpoint for local development, and that is why I needed that information. However, with my current setup, this throws some really weird errors. Any help is greatly appreciated! Best Philipp