Annotated links: Episode 44 of Hands-on SAP dev with qmacro
This is a searchable description of the content of a live stream recording, specifically “Ep.44 – Business Rules in Cloud Foundry – setting things up” in the “Hands-on SAP dev with qmacro” series. There are links directly to specific highlights in the video recording. For links to annotations of other episodes, please see the “Catch the replays” section of the series blog post.
This episode was streamed live on Fri 22 Nov 2019 and is approximately 60 minutes in length. The stream recording is available on YouTube.
Brief synopsis: In previous recent episodes we’ve taken a look at the Business Rules service on Neo, and kicked the tyres with a simple rules service. Now it’s time to move to Cloud Foundry and set things up there. Let’s go!
00:02:00 It’s #TShirtDay today and I’m wearing my favourite Rush tshirt – you should definitely check out their music: https://open.spotify.com/artist/2Hkut4rAAyrQxRdof7FVJq.
00:09:10 I’m trying to work more openly, and am now editing my draft annotations for the live stream replays in a public GitHub repo. So you’ll see the draft annotations as they’re written, and most likely even before they’re made live. In fact, I’ll go and push this new file right now!
00:10:45 Now, in the upcoming section of the main Hands-on SAP dev post, I’m maintaining not only the upcoming episode but, where appropriate, I’ve added future planned episodes – there are already two episodes planned next week, with Tom Jung on Wednesday and Marius Obert on Friday.
00:11:40 Starting where we left off on this topic last time, looking at what we have with respect to the Business Rules service in the Neo environment, so that we know what we’re aiming for in Cloud Foundry (CF). This includes the service itself and also the administration UI.
00:14:45 Mentioning one of the great folks from the Intelligent Enterprise Process Orchestration team Archana Shukla – you should definitely take a look at her blog posts on the subjects of the Business Rules and Workflow services!
00:16:00 Exploring my SAP Cloud Platform CF trial account, and the relationships between the subaccount, the organisation and the space(s), as well as basic CF concepts such as applications, services, service instances and bindings.
00:19:50 Gregor Wolf points out that while you can renew your Cloud Foundry trial three times up to a total of 90 days, you can actually keep renewing, it’s just that your artifacts are removed after 90 days (but you can redeploy and set things up again). He points to a tweet by Cecilia Huergo that relates to this.
00:23:50 Mentioning the SAP Developer Insights Survey, in a conversation about feedback. If you have already completed it – thank you! If you haven’t, please do, it should take you no more than 10 mins.
00:24:15 Creating a new instance of the Business Rules service, with the ‘lite’ plan, and talking about a strategy for naming things, to help with my problem of (a) never knowing what to pick and (b) regardless of what I pick (‘business-rules’ in this case) I forget what it was 5 mins later. This is particularly and painfully prescient as indeed at the end of this episode, the build / deploy process fails … because I forgot what name I’d chosen!
00:26:10 About to create a Service Key for the new instance of this service, so we can make calls to it from other endpoints such as the SAP API Business Hub. Note that the authentication will be based on OAuth 2.0.
00:29:05 There are three pieces of information in the Service Key that we’ll need eventually to make our API calls: the client ID, the client secret, and the endpoint URL.
00:30:15 Mark Teichmann shares a link to a useful resource regarding OAuth 2.0 and SAP service resources: OAuth 2.0 – Integrating access protected web services using the OAuth 2.0 Client Skip to end of metadata. Thanks Mark!
00:31:00 At this stage we move back to the organisation level in CF to create a collection of Business Service related roles and assign that collection to myself. The roles cover superuser access to both of the areas – design-time and runtime, in other words, Repository and Runtime contexts.
00:38:10 With the role collection created, we add it to my user, via Trust Configuration, in the context of the identity provider used (the SAP ID Service).
00:40:10 Almost everything is set up now, but one thing that we still have to do is manually and explicitly bring to life the equivalent of the “Manage Business Rules” app that we know and love from the Neo environment. In Neo it was automatically available to us, but in this CF context we need to build and deploy the app ourselves. It’s a one-time activity, yes, it’s extra work, but I think in this case it’s worth it as it teaches us more stuff about how CF and multi-target apps work.
00:43:40 I mentioned that this process is described in a relatively new tutorial, Set Up the Manage Rules Project Application, which is part of a new mission Get Started with SAP Cloud Platform Business Rules. Check it out!
00:45:50 Loading the SAP Web IDE, straight into a nice workspace “HandsOnSAPDev” that I’ve created for this live stream series purpose, importing the ZIP file, and exploring the contents, and marvelling that there is very little there – most importantly there’s the
mta.yaml file which we look at in detail.
For those (like me) who like to stare at configuration, here’s the content of the
mta.yaml file (including the change from “businessrules” to “business-rules” I had to make at the end to get the build to work and the deploy to be successful (yes, this is the name change that I’d forgotten about!):
ID: businessruleseditor _schema-version: '2.1' parameters: deploy_mode: html5-repo version: 0.0.1 modules: - name: businessruleseditor_appRouter type: approuter.nodejs path: businessruleseditor_appRouter parameters: disk-quota: 256M memory: 256M requires: - name: businessruleseditor_html5_repo_runtime - name: businessrules_uaa - name: business-rules resources: - name: businessruleseditor_html5_repo_runtime parameters: service-plan: app-runtime service: html5-apps-repo type: org.cloudfoundry.managed-service - name: business-rules type: org.cloudfoundry.existing-service - name: businessrules_uaa type: com.sap.xs.uaa parameters: config: xsappname: businessrules_uaa-appname tenant-mode: dedicated role-templates: - name : UaaUser description: Role template for accessing SAP Business Rule APIs.Editor via user token flow scope-references: - uaa.user
00:53:30 We build the project, deliberately choosing the deprecated tool, to remember what it does and how the logs look as we can look at the new build tool
mbt in a future episode (the deprecated, Java-based build tool will be supported to 31 May 2020). The build process completes and a new multi-target application archive
businessruleseditor_0.0.1.mtar is created.
00:56:00 We deploy this to CF, specifying the API endpoint, organisation and space … and it fails! It’s because I’d forgotten I’d named the Business Rules service instance ‘business-rules’ (with a dash) – I needed to adjust the
mta.yaml references to deal with this. Oops! The nice thing was that the failure was fairly clean and obvious – the error message told us exactly what was wrong.
One more issue (again, my fault) – in rushing to make the change, I only changed the reference in a single place, not in both places (referer and referee) so the build failed again. Doh! Shortly after the stream finished, I fixed it. An exciting end to the stream, don’t you think?
And … as Former Member pointed out in the chat right at the end: “Problems are where we learn“. Well said!