Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example: SAP CP Destinations #39

Open
ddonchev opened this issue Jun 19, 2020 · 5 comments
Open

Example: SAP CP Destinations #39

ddonchev opened this issue Jun 19, 2020 · 5 comments

Comments

@ddonchev
Copy link
Contributor

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
@psteinroe
Copy link

Any timeline on this? I am really struggling with it atm!

@ddonchev
Copy link
Contributor Author

ddonchev commented Aug 12, 2020

I hope those snippets & links to documentation help, until a suitable scenario covering all aspects is defined, and the documentation is done & reviewed:

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.

@ddonchev
Copy link
Contributor Author

ddonchev commented Aug 12, 2020

  • 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

@ddonchev
Copy link
Contributor Author

@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.

@psteinroe
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants