This is a searchable description of the content of a live stream recording, specifically “Episode 24 – Going from local CAP to cloud CAP with MTA based deployments” 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, titled “Going from local CAP to cloud CAP with MTA based deployments”, was streamed live on Fri 10 May 2019 and is approximately one hour in length. The stream recording is available on YouTube.
Below is a brief synopsis, and links to specific highlights – use these links to jump directly to particular places of interest in the recording, based on ‘hh:mm:ss’ style timestamps.
In this episode, we cover the knowledge transfer from local to (SAP) Cloud. In the previous episodes, we developed and tested the CAP project locally. Now, we repeat the same steps, but make some tiny changes to replace the SQLite database with a HANA HDI Container in the Cloud.
Links to specific highlights
00:01:30 Shoutout to the SAP CoffeeCorner folks (@uxkjaer and @skemp) who were at SAPPHIRE NOW 2019. DJ also tells us about his new coffee machine and what he thinks of decaf.
00:06:03 Review of the recent certificate expiration of the ES5 demo system and the associated Twitter discussion (and problem-solving process).
00:07:49 DJ demos the “Developing inside a Container” feature of VS Code. He also mentions the recently announced Visual Studio Online companion editor. I’m really looking forward to this! The highlight of the episode: DJ also openly shares his 💙 for Microsoft
00:17:40 DJ connects to Munich and kindly “sets the stage” for me. After a short introduction, we jump right into the topic “Deploying a CAP project to SAP Cloud Platform”. Obviously, we’ll do this in Cloud Foundry! This week we’ll set up a slightly modified version of the canonical sample project -> we code a beer shop 🍻.
00:20:45 We initialize the project with npx to avoid global node modules. We also make use of some new CLI flags to prepare our project for SAP Cloud Platform and the HDI container.
npx @sap/cds init --modules db,srv --insecure --mta --db-technology hana beershop
00:25:00 I talk about the mta.yaml project descriptor and explain why this file is the core part of our application. I also mention the content of package.json file in the project root and explain what the included npm scripts have to do with npx.
00:28:45 We manually change the plugin_version property of the .hdiconfig file to specify the HANA version we’re running our cloud database on.
00:32:00 I add some files for the sample data and the data mapping to the db module of our project. The data mapping defined in the Data.hdbtabledata file maps the CSV file content to the columns in the to-be-created HANA tables. We also receive some sample data suggestions from the great (and beer-friendly) audience while we complete the svr module as well.
00:35:45 This is the first hurdle we have to take: Test our application locally with a sqlite3 database by leveraging the cds commands in the defined npm scripts. It works immediately!
00:37:00 So far we just repeated the content of previous episodes. Now we add a new module to our project to add some UI. We choose SAPUI5 over Fiori in this case, as it makes our life a little bit easier. I also explain how and why we need to modify the MTA descriptor file. Next, I install the mbt tool and use it to create a Makefile. This Makefile helps us to bundle all the files of all the modules into one single, deployable archive: The .mtar file
00:48:30 After struggling for the whitespace indention of yaml for a while, we finally get to the last deployment step. While we wait for the archive to be uploaded and deployed to SAP Cloud Platform, I talk about the concept of npx and why I think following it keeps your development environment clean.
00:53:40 I demo how the name of the packages archive changes when the version of the project is updated. Unfortunately, I change the version number in the package.json file and not the one in the mta.yaml file 🙃. Which is why this doesn’t work out.
00:55:00 The deployment finishes and we can see our favorite beers live on SAP Cloud Platform, powered by the Cloud Application Programming Model. Awesome✌️! DJ summarizes what we build and how the modules of our project translate to the Cloud Foundry apps we can see in the cockpit. He also mentions that the db module is not a normal app, but a Cloud Foundry task (which is why it changes into the stopped state). You can also read my blog post about CF Tasks if you want to more know CF tasks them.
I really enjoyed being a guest in DJ’s show. I hope you also had a great time watching the demo I showed you – thanks so much again. Until next time!